0

How to find USB VID/PID on various operating systems

source:http://www.freelabs.com/~whitis/USB_VID_PID.xhtml


Linux users can, of course, just use lsusb or usbview.   Run as root because on some systems, this doesn't show all the information otherwise.


lsusb (short form)



$ sudo lsusb

Bus 002 Device 049: ID eb1a:1760 eMPIA Technology, Inc.

Bus 002 Device 007: ID 04e8:323a Samsung Electronics Co., Ltd ML-1710 Printer

Bus 002 Device 005: ID 055f:0006 Mustek Systems, Inc. ScanExpress 1200 UB

Bus 002 Device 003: ID 0409:0058 NEC Corp. HighSpeed Hub

Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

Bus 001 Device 028: ID 0518:0001 EzKEY Corp. USB to PS2 Adaptor v1.09

Bus 001 Device 003: ID 046d:c03f Logitech, Inc. UltraX Optical Mouse

Bus 001 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub



The "sudo" command is used to run the command as root (Adminstrative User) and is needed on systems where you don't normally log in as root.   If you are already root, you can just run lsusb without the sudo.   The "$" is just the command prompt and will vary depending on system configuration.   It is normally a "$" if you are an ordinary user or "#" if you are root and is often preceeded by the name of the current directory and sometimes the machine name and username.



   If you can't tell which device is the device you are interested in, unplug the device and repeat the listing then plug it back in and do the listing again.   Compare the listings; the device which disappears and then reappears from the listing is the device you want.


lsusb (long form)



   For this, you need the VID/PID obtained using the short form of lsusb.  In this example, it was "eb1a:1760". If you use lsusb -v without this, you get the long form listing for all devices which can be very long indeed and include a lot of irrelevant information.



$ sudo lsusb -v -d eb1a:1760


To save the information above to a file use:



  # lsusb -v eb1a:1760 > output.txt


The verbose listing not only decodes the USB device descriptor, it also decodes the class descriptors for hub, audio, HID, communications, chipcard, and video classes.

   If you are using a Knoppix or Ubunto Live CD, you need a way to share this information with the outside world.   You can run the firefox web browser (if your network adapter is working) and paste the information into a web form if that is all you need.    Or you can save the info on a usb flash drive or to a windows hard disk partition.

   If you create a USB flash drive to boot Knoppix or ubunto (directions on the net), create a small FAT32 partition on the flash drive so windows can easily see it.


usbview


usbview should not be mistaken for the similarly named utility on windows, although the names are the same and their purpose is similar.  Usbview is a GUI application.   It does not provide as much detail as lsusb -v but it provides it in a nice tree format.

Incidently, usbview also give you hints as to whether your device is plugged into a slow USB full speed port or a fast USB 2.0 high speed port.  Some devices don't work reliably or run slower when not plugged into a high speed port.  On my system the same device shows up under EHCI Host controller on a slow port but under USB 2.0 Hub Controller under EHCI host controller on a fast port.   If it shows up under an OHCI Host Controller or UHCI Host Controller, it is connected to a slow port.  Oddly, when plugged into the same port a webcam showed up under the EHCI Host Controller/USB2.0 Hub Controller but the keyboard shows up under OHCI Host Controller; this probably has something to do with emulation as the keyboard and mouse are used prior to booting.

usbview also reports the driver associated with each device, using the less than clear format "Name: uvcvideo"


 # sudo usbview &


/proc/bus/usb/devices

   cat /proc/bus/usb/devices will give a listing for all usb devices.     It is more detailed than a plain lsusb and more succinct than a lsusb -v.    You have to pick the approprate block of information (separated by blank lines) from the output.   This is the form that it submitted to www.linux-usb.org and is suitable for posting where you can't post the full lsusb -v output.    For a USB Video Class Device, it doesn't list supported resolutions, bitrates, encoding formats, or user controls which the lsusb -v listing does.


T:  Bus=02 Lev=02 Prnt=03 Port=01 Cnt=02 Dev#= 12 Spd=480 MxCh= 0

D:  Ver= 2.00 Cls=ef(unk. ) Sub=02 Prot=01 MxPS=64 #Cfgs=  1

P:  Vendor=eb1a ProdID=1760 Rev= 6.08

S:  Manufacturer=Infoxelle

S:  Product=Digital Microscope

S:  SerialNumber=VT1760

C:* #Ifs= 2 Cfg#= 1 Atr=80 MxPwr=500mA

A:  FirstIf#= 0 IfCount= 2 Cls=0e(video) Sub=03 Prot=00

I:* If#= 0 Alt= 0 #EPs= 1 Cls=0e(video) Sub=01 Prot=00 Driver=uvcvideo

E:  Ad=81(I) Atr=03(Int.) MxPS=   8 Ivl=32ms

I:* If#= 1 Alt= 0 #EPs= 1 Cls=0e(video) Sub=02 Prot=00 Driver=uvcvideo

E:  Ad=82(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms



lshw



   If you run lshw with the -numeric option, it will show the vendor device ID t the end of the product: line.   Leading zeros are supressed rather than printing as 4 digit hex.



/var/log/messages





    The file /var/log/messages contains syslog information including messages printed by device drivers when they recognize a device.    To use, unplug the device.   Then run:

  



       $ sudo tail -n 0 -f /var/log/messages

           or

       $  sudo tail -n 0 -f /var/log/messages | tee /tmp/logmessages


Wait ten seconds or so after you plug in the device and then hit control-C to stop the program.   The tail program with these options will just show you the new information as it is added to the file.    The tee program saves the output of the tail program in a file (/tmp/logmessages) while simultaneously showing the output to you.


Here is some sample output:


Apr 15 22:11:48 cervantes kernel: [1380806.451378] usb 2-8.2: USB disconnect, address 67

Apr 15 22:11:52 cervantes kernel: [1380812.296497] usb 2-8.2: new high speed USB device using ehci_hcd and address 68

Apr 15 22:11:52 cervantes kernel: [1380812.982274] usb 2-8.2: configuration #1 chosen from 1 choice

Apr 15 22:11:53 cervantes kernel: [1380812.982891] uvcvideo: Found UVC 1.00 device Digital Microscope (eb1a:1760)

Apr 15 22:11:53 cervantes kernel: [1380813.490404] input: Digital Microscope as /class/input/input1430

Apr 15 22:11:53 cervantes kernel: [1380813.490666] usb 2-8.2: New USB device found, idVendor=eb1a, idProduct=1760

Apr 15 22:11:53 cervantes kernel: [1380813.490673] usb 2-8.2: New USB device strings: Mfr=2, Product=1, SerialNumber=3

Apr 15 22:11:53 cervantes kernel: [1380813.490676] usb 2-8.2: Product: Digital Microscope

Apr 15 22:11:53 cervantes kernel: [1380813.490679] usb 2-8.2: Manufacturer: Infoxelle

Apr 15 22:11:53 cervantes kernel: [1380813.490681] usb 2-8.2: SerialNumber: VT1760

0

How To Tar Files And Folders Easy

0

DD comand examples

THE DD COMMAND


The dd command copies an amount of data block by block. The most basic syntax is:

Format
# dd if=xxxxx of=yyyyy bs=zzzzzz
( Where if=xxxxx is the source, of=yyyyy is the target and bs= both read and write zzzzz bytes at a time )


Examples:

Copy a hard disk partition to another hard disk:
# dd if=/dev/hda2 of=/dev/hdb2 bs=4096 conv=notrunc,noerror

If hdb2 doesn't exist, dd will start at the beginning of the disk, and create it. Be careful with order of if and of. You can write a blank disk to a good disk if you get confused. If you duplicate a smaller partition to a larger one, using dd, the larger one will now be formatted the same as the smaller one. And there will be no space left on the drive. The way around this is to use

Code:
rsync
, as described below.

To make an iso image of a CD: This duplicates sector for sector. MyCD.iso will be a hard disk image file of the CD.
Code:
dd if=/dev/hdc of=/home/sam/myCD.iso bs=2048 conv=sync,notrunc
You can mount the image like this:
Code:
mkdir /mnt/myCD
mount -o loop /home/sam/myCD.iso /mnt/myCD
Cloning an entire hard disk:
# dd if=/dev/hda of=/dev/hdb conv=notrunc,noerror


Copy a disk partition to a file on a different partition. (Do not copy a partition to the same partition !)
# dd if=/dev/hdb2 of=/home/test/partition.image bs=4096 conv=notrunc,noerror




Restore a disk partition from an image file:
# dd if=/home/test/partition.image of=/dev/hdb2 bs=4096 conv=notrunc,noerror



Mount a existing dd image:
# mount -o loop /path/your-dd-image /mnt/test


Copy MBR only of a hard drive:
# dd if=/dev/hda of=/home/test/MBR.image bs=446 count=1


Reverse:
# dd if=/home/test/MBR.image of=/dev/hda bs=446 count=1


Wipe a hard drive of all data ( you would want to boot from a cd to do this ):
# dd if=/dev/zero of=/dev/hda conv=notrunc


Make an iso image of a CD:
# dd if=/dev/hdc of=/home/test/TEST.iso bs=2048 conv=notrunc
( CD sectors are 2048 bytes, so this copies sector for sector. )

Copy a floppy disk:
# dd if=/dev/fd0 of=/home/test/floppy.image conv=notrunc

You can back up your MBR ( including partition table ):
# dd if=/dev/hda of=mbr.bin count=1


Put this on a floppy you make with:
# dd if=boot.img of=/dev/fd0


Boot from the floppy and restore the MBR:
# dd if=mbr.bin of=/dev/hda count=1


How to check dd progress
===================

By the way, if you need to restore a large image file and want to see what the progress is, you can use the following command from a new terminal session:

kill -USR1 $pid

You can find dd command's pid by using ps and grep commands like:

ps -A | grep dd

If you want to check an automatic progress, use "watch" command:
watch kill -USR1 $pid

0

Joining a Windows 7/ Windows 2008 R2 system to a Samba domain

This article suits for both Windows 7 and Windows 2008 R2(tested on 17/10/2010):

To join the domain for Windows 7 make sure you do the following steps:

  1. First you need to be running Samba v3.3.4 or later. Earlier versions have been reported to work, but there are some issues. 
  2. Next the Windows 7 client needs to have two registry keys added.

    HKLM\System\CurrentControlSet\Services\LanmanWorkstation\Parameters
    DWORD DomainCompatibilityMode   = 00000001
    DWORD DNSNameResolutionRequired = 00000000
  3. The following key needs to be changed or you will receive an error when trying to login using a domain accout of “The trust relationship between this workstation and the primary domain failed.”

    HKLM\SYSTEM\CurrentControlSet\services\Netlogon\Parameters
    DWORD RequireStrongKey  = 00000001
  4. DWORD RequireSignOrSeal = 00000001
Once these changes were made I was able to join the domain. I did receive an error on the join as shown in the following image, but the system seems to be working fine.

0

Linux permissions help

Linux permissions help

  • 1. What are file permissions
  • 2. File permissions notation
    • 2.1. Textual representation like "-rwxr--r--"
      • 2.1.1. Examples
    • 2.2. Numeric (octal) representation like "644"
      • 2.2.1. Examples
      • 2.2.2. Why there is a leading zero?
      • 2.2.3. Four meaningful digits like "4755"
  • 3. Difference in access permissions for files and folders
  • 4. Permissions required for web server
  • 5. Permissions set for FTP-uploaded files
  • 6. Set user ID, set group ID, sticky bit
    • 6.1. Numeric representation
    • 6.2. Textual representation
  • 7. Links

1. What are file permissions

Every file or folder in Linux has access permissions. There are three types of permissions (what allowed to do with a file):
  • read access
  • write access
  • execute access
Permissions are defined for three types of users:
  • the owner of the file
  • the group that the owner belongs to
  • other users
Thus, Linux file permissions are nine bits of information (3 types x 3 type of users), each of them may have just one of two values: allowed or denied.
Simply put, for each file it can be specified who can read or write from/to the file. For programs or scripts it also can be set if they are allowed to be executed.

2. File permissions notation

2.1. Textual representation like "-rwxr--r--"

It is used in Linux long directory listings. It consists of 10 characters. The first character shows the file type. Next 9 characters are permissions, consisting of three groups: owner, group, others. Each group consists of three symbols: rwx (in this order), if some permission is denied, then a dash "-" is used instead. Example:
-rwxr--r--
0123456789
  • Symbol in the position 0 ("-")is the type of the file. It is either "d" if the item is a directory, or "l" if it is a link, or "-" if the item is a regular file.
  • Symbols in positions 1 to 3 ("rwx") are permissions for the owner of the file.
  • Symbols in positions 4 to 6 ("r--") are permissions for the group.
  • Symbols in positions 7 to 9 ("r--") are permissions for others.
r Read access is allowed
w Write access is allowed
x Execute access is allowed
- Replaces "r", "w" or "x" if according access type is denied

2.1.1. Examples

-rwxr-xr-x File,
owner has read, write, execute permissions,
group: only read and execute permissions,
others: only read and execute permissions. 
dr-x------ Directory,
owner has read and execute access,
group and others have no access

To change the mode of a file, use the chmod command. The general form is
chmod X@Y file1 file2 ...
where: X is any combination of the letters `u' (for       owner), `g' (for group), `o' (for others), `a' (for all;       that is, for `ugo'); @ is either `+' to add permissions,       `-' to remove permissions, or `=' to assign permissions       absolutely; and Y is any combination of `r', `w', `x'.       Following are some examples:
chmod u=rx file        (Give the owner rx permissions, not w)
     chmod go-rwx file      (Deny rwx permission for group, others)
     chmod g+w file         (Give write permission to the group)
     chmod a+x file1 file2  (Give execute permission to everybody)
     chmod g+rx,o+x file    (OK to combine like this with a comma)

2.2. Numeric (octal) representation like "644"

If a numeric representation is used (like in chmod command, for example), then it is in the octal format (with the base of 8), and digits involved are 0 to 7. Octal format is used for the simplicity of understanding: every octal digit combines read, write and execute permissions together. Respective access rights for owner, group and others (in this order) are the last three digits of the numeric file permissions representation. Example: "0644". Here the second digit ("6" in the example) stands for rights of the owner, the third digit ("4" in the example) stands for rights of the group, the fourth digit ("4" in the example) stands for rights of others.
This table shows what numeric values mean:
Octal digit Text equivalent Binary value Meaning
0 --- 000 All types of access are denied
1 --x 001 Execute access is allowed only
2 -w- 010 Write access is allowed only
3 -wx 011 Write and execute access are allowed
4 r-- 100 Read access is allowed only
5 r-x 101 Read and execute access are allowed
6 rw- 110 Read and write access are allowed
7 rwx 111 Everything is allowed
We see that "1" stands for execute only, "2" stands for write only, "4" stands for read only. To combine the permissions you can simply add 1, 2 and 4 to get a needed combination. For instance, to get read and write permissions, you add 4 (read) and 2 (write), thus getting 6 (read and write). To get read and execute permissions, you add  4 (read) and 1 (execute), thus getting 5 (read and execute).

2.2.1. Examples

644 owner: read and write permissions,
group: only read permissions,
others: only read permissions. 
755 owner: read, write and execute permissions,
group: read and execute permissions,
others: read and execute permissions. 

2.2.2. Why there is a leading zero?

In programming, for instance, in C language, leading zero means that the value is in the octal format. Basically, it can be omitted. Owner, group and others rights are the last three digits of the permissions.

2.2.3. Four meaningful digits like "4755"

There are cases when you may come across four non-zero digits, in this case the first meaningful (non-zero) digit combines the following bits (in this order, high to low): SUID, SGID, sticky bit. We also know  that the last three are for owner, group and others.

3. Difference in access permissions for files and folders

Access permissions for files and folders mean different things from the user standpoint. The table below shows the difference.
Access type File Folder
Read If the file contents can be read If the directory listing can be obtained
Write If user or process can write to the file (change its contents) If user or process can change directory contents somehow: create new or delete existing files in the directory or rename files.
Execute If the file can be executed If user or process can access the directory, that is, go to it (make it to be the current working directory)

4. Permissions required for web server

Web server assigns the rights of the web-server-specific user, typically user "nobody", to the connected web client, as if "nobody" is connected to the web server. "Nobody" doesn't belong to your group and thus it inherits permissions that "others" have to your files.
  • For generic files such as html or images, etc you usually need to set 644 permissions. It is because "nobody" needs to read the file, and thus the file should be readable by others, hence 4 (read only) permissions for both group and others. For yourself you need a right to read and write (hence 6) to the file.
  • For scripts you need 755 rights. The script should be executable by "nobody". The script file should also be readable by "nobody", as the file is interpreted by an interpreter such as Perl and therefore must be readable. Thus it must combine read and execute permissions for "others", as "nobody" belongs to "others" group. For yourself you need to have also write access, getting 755 as a result.

5. Permissions set for FTP-uploaded files

When you upload files to your web hosting accounts, you become the owner of the files. Usually, by default files get 644 permissions, and depending on provider's FTP server configuration they may get different permissions in different situations. You also can change the file permissions with FTP client or by executing a chmod command in telnet.

6. Set user ID, set group ID, sticky bit

In addition to the basic permissions discussed above, there are also three bits of information defined for files in Linux:
  • SUID or setuid: change user ID on execution. If setuid bit is set, when the file will be executed by a user, the process will have the same rights as the owner of the file being executed.
  • SGID or setgid: change group ID on execution. Same as above, but inherits rights of the group of the owner of the file on execution. For directories it also may mean that when a new file is created in the directory it will inherit the group of the directory (and not of the user who created the file).
  • Sticky bit. It was used to trigger process to "stick" in memory after it is finished, now this usage is obsolete. Currently its use is system dependant and it is mostly used to suppress deletion of the files that belong to other users in the folder where you have "write" access to.

6.1. Numeric representation

Octal digit Binary value Meaning
0 000 setuid, setgid, sticky bits are cleared
1 001 sticky bit is set
2 010 setgid bit is set
3 011 setgid and sticky bits are set
4 100 setuid bit is set
5 101 setuid and sticky bits are set
6 110 setuid and setgid bits are set
7 111 setuid, setgid, sticky bits are set

6.2. Textual representation

SUID If set, then replaces "x" in the owner permissions to "s", if owner has execute permissions, or to "S" otherwise. Examples:
-rws------ both owner execute and SUID are set
-r-S------ SUID is set, but owner execute is not set
SGID If set, then replaces "x" in the group permissions to "s", if group has execute permissions, or to "S" otherwise. Examples:
-rwxrws--- both group execute and SGID are set
-rwxr-S--- SGID is set, but group execute is not set
Sticky If set, then replaces "x" in the others permissions to "t", if others have execute permissions, or to "T" otherwise. Examples:
-rwxrwxrwt both others execute and sticky bit are set
-rwxrwxr-T sticky bit is set, but others execute is not set

7. Links