Tuesday, October 28, 2008

 

Determining Filenames for Devices

In Linux each device is given a filename but it is not always obvious what filename goes with each device. One package which can help is sg3_utils. Download it and do the usual ./configure and make all. Once the package is installed do as root:

sg_scan -i

On my system the output is as follows:

/dev/sg0: scsi0 channel=0 id=0 lun=0 [em]
Generic USB SD Reader 1.00 [rmb=1 cmdq=0 pqual=0 pdev=0x0]
/dev/sg1: scsi0 channel=0 id=0 lun=1 [em]
Generic USB CF Reader 1.01 [rmb=1 cmdq=0 pqual=0 pdev=0x0]
/dev/sg2: scsi0 channel=0 id=0 lun=2 [em]
Generic USB SM Reader 1.02 [rmb=1 cmdq=0 pqual=0 pdev=0x0]
/dev/sg3: scsi0 channel=0 id=0 lun=3 [em]
Generic USB MS Reader 1.03 [rmb=1 cmdq=0 pqual=0 pdev=0x0]
/dev/sg4: scsi1 channel=0 id=0 lun=0 [em]
ST380211 0A 0000 [rmb=0 cmdq=0 pqual=0 pdev=0x0]
/dev/sg5: scsi2 channel=0 id=0 lun=0 [em]
SONY DVD RW DRU-190A 1.64 [rmb=1 cmdq=0 pqual=0 pdev=0x5]
/dev/sg6: scsi2 channel=0 id=1 lun=0 [em]
BENQ DVD DUAL DW1610 B8B9 [rmb=1 cmdq=0 pqual=0 pdev=0x5]

Now it's clear what the filenames are for each device but it's still rather hard to remember that one's second DVD burner is called /dev/sg6. So we use the sg_map command as root:

sg_map

The output on my system:

/dev/sg0 /dev/sda
/dev/sg1 /dev/sdb
/dev/sg2 /dev/sdc
/dev/sg3 /dev/sdd
/dev/sg4 /dev/sde
/dev/sg5 /dev/scd0
/dev/sg6 /dev/scd1

Now we have enough information to figure out what the names are for each of the sg devices. In my case it includes the multi-card reader (sda to sdd), the external usb hard drive (sde) and the two DVD writers (scd0 and scd1).

To mount an SD card:

mount /dev/sda1 /mnt/usb3

On my system I don't usually refer to /dev/scd0 when I'm accessing one of my DVD writers. Instead I link it do a more descriptive name:

ln -sf scd0 /dev/dvd1
ln -sf scd1 /dev/dvd2

This does not include everything, only those units the system considers sg devices. You may find that the device names are different on your version of Linux. Finally one can check out the filenames for their scanners via:

scanimage --list-devices

Which outputs on my system:

device `v4l:/dev/video0' is a Noname BT878(Hauppauge (bt878)) virtual device
device `hp:/dev/usb/scanner0' is a Hewlett-Packard ScanJet 5200C flatbed scanner

If I want to tell kooka to use the HP scanner I do:

kooka -d hp:/dev/usb/scanner0

Comments:

Post a Comment

Subscribe to Post Comments [Atom]





<< Home

This page is powered by Blogger. Isn't yours?

Subscribe to Posts [Atom]