Though I've got quite a good basic understanding of sysfs
meanwhile, there are still things I cannot solve on my own.
For a starter, I'd like to figure out via sysfs
(later by scripting of course) which channel a block device (HDD, DVD...) is connected to.
The funny thing about it is that it is possible for me how to figure out master or slave! There is an internal ID deeply rooted in the sysfs
tree which gives this away: so 9:0:1
will mean that the device is connected to a (primary OR secondary) slave channel. (master when last digit 0; slave when last digit is 1)
OK, but this will still not tell me whether it's the primary or secondary channel.
While doing some research about this, I found a Linux 2.6-related post in LKML: https://lkml.org/lkml/2006/3/25/20 revealing a sample path like ../../../devices/pci0000:00/0000:00:04.0/ide0/0.0/
.
Well this is EXACTLY what I need!
Unfortunately though, the ideX
is nowhere to find in sysfs
as of Linux 3.x. Maybe it was removed for good in kernel version 3?