On Fri, Oct 28, 2005 at 07:51:36AM +0200, Shachar Shemesh wrote: > Lionel Elie Mamane wrote:
>>Try reading the "bus" entry in sysfs of the devices. For hard disks, >>it will point to an ide or scsi bus (as far as I guess, you don't need >>to differentiate between those) and for DoKs it will point to an USB >>bus. Ah no, there are USB-connected hard disks. I'm not sure the >>kernel can differentiate between USB DoKs and USB hard disks... > Let's forget USB connected HDs for a sec. They are not particularily > important to me. Your suggestion simply doesn't work. USB connected > devices have their "bus" entry pointing at the scsi bus. Damn, yes. I guess that then you have to rely on the SCSI host bus number in the device number. For example, I have two SATA disks and one DoK; their full device number (bus address is): [EMAIL PROTECTED]:/sys/block/sdc$ ls -l /sys/bus/scsi/devices/ total 0 lrwxrwxrwx 1 root root 0 2005-10-28 08:30 0:0:0:0 -> ../../../devices/pci0000:00/0000:00:0a.0/0000:01:08.0/host0/target0:0:0/0:0:0:0 lrwxrwxrwx 1 root root 0 2005-10-28 08:30 1:0:0:0 -> ../../../devices/pci0000:00/0000:00:0a.0/0000:01:08.0/host1/target1:0:0/1:0:0:0 lrwxrwxrwx 1 root root 0 2005-10-28 08:28 2:0:0:0 -> ../../../devices/pci0000:00/0000:00:02.1/usb2/2-1/2-1:1.0/host2/target2:0:0/2:0:0:0 1) The symlink there contains that "usb" thingy. Does it always? Can you rely on it? 2) The USB DoK is on host bus 2 (its full address is 2:0:0:0, that is host 2, channel 0, ID 0,LUN 0. If I look at /proc/scsi/usb_storage/, I see that the only SCSI host handled by usb_storage is number 2. Hence 2:0:0:0 is an USB-attached storage. On the other hand, the sata_promise driver handles host buses 0 and 1: [EMAIL PROTECTED]:~/T2$ ls -ld /sys/bus/pci/drivers/sata_promise/*/host* drwxr-xr-x 4 root root 0 2005-10-27 09:45 /sys/bus/pci/drivers/sata_promise/0000:01:08.0/host0 drwxr-xr-x 4 root root 0 2005-10-27 09:45 /sys/bus/pci/drivers/sata_promise/0000:01:08.0/host1 DoKs are also marked "removable"; maybe relying on the "removable" bit will suit your needs? -- Lionel ================================================================= To unsubscribe, send mail to [EMAIL PROTECTED] with the word "unsubscribe" in the message body, e.g., run the command echo unsubscribe | mail [EMAIL PROTECTED]
