* sysfs content varies among instances
@ 2005-11-04 13:17 Matteo Semplice
2005-11-04 17:15 ` Greg KH
0 siblings, 1 reply; 2+ messages in thread
From: Matteo Semplice @ 2005-11-04 13:17 UTC (permalink / raw)
To: linux-hotplug
Hi everybody. I'm no developer, but am trying to figure out a proper udev rule for my (el-cheapo) usb pen drive (in particular to SYMLINK it to /media/myusbpen). Much investigation, doc reading, attempts, lead me to find out an odd behaviour in the creation of the /sys filesystem.
The problem is that each time I plug in the pen drive, I get different "vendor" and "product" fields in the /sys filesystem...
I run a 2.6.13.3 custom-built kernel plus the udev and hal packages from the Debian sarge distribution.
First of all, the correct vendor and product info for my card are in the directory /sys/devices/pci0000:00/0000:00:10.1/usb2/2-2/
but /sys/block/sda/device points to a subdirectory of that one, which does not contain the correct vendor/product files (precisely to /sys/devices/pci0000:00/0000:00:10.1/usb2/2-2/2-2:1.0/host1/target1:0:0/1:0:0:0)
Is this correct?
Further, after plugging the usb pen in a usb port,
udevinfo -a -p $(udevinfo -q path -n /dev/sda)
tells me:
matteo@roccia:/etc/hotplug$ udevinfo -a -p $(udevinfo -q path -n /dev/sda)
udevinfo starts with the device the node belongs to and then walks up the
device chain, to print for every device found, all possibly useful attributes
in the udev key format.
Only attributes within one device section may be used together in one rule,
to match the device for which the node will be created.
device '/sys/block/sda' has major:minor 8:0
looking at class device '/sys/block/sda':
SUBSYSTEM="block"
SYSFS{dev}="8:0"
SYSFS{range}="16"
SYSFS{removable}="1"
SYSFS{size}="1019617"
SYSFS{stat}=" 6 234 240 204 0 0 0 0 0 134 204"
follow the class device's "device"
looking at the device chain at '/sys/devices/pci0000:00/0000:00:10.1/usb2/2-2/2-2:1.0/host1/target1:0:0/1:0:0:0':
BUS="scsi"
ID="1:0:0:0"
DRIVER="sd"
SYSFS{device_blocked}="0"
SYSFS{iocounterbits}="32"
SYSFS{iodone_cnt}="0xc9a"
SYSFS{ioerr_cnt}="0x0"
SYSFS{iorequest_cnt}="0xc9a"
SYSFS{max_sectors}="240"
SYSFS{model}=".2"
SYSFS{queue_depth}="1"
SYSFS{queue_type}="none"
SYSFS{rev}=""
SYSFS{scsi_level}="3"
SYSFS{state}="running"
SYSFS{timeout}="30"
SYSFS{type}="0"
SYSFS{vendor}="linux.so"
but I can also get (plugging it in the very same port)
[...]
follow the class device's "device"
looking at the device chain at '/sys/devices/pci0000:00/0000:00:10.1/usb2/2-2/2-2:1.0/host8/target8:0:0/8:0:0:0':
BUS="scsi"
ID="8:0:0:0"
DRIVER="sd"
SYSFS{device_blocked}="0"
SYSFS{iocounterbits}="32"
SYSFS{iodone_cnt}="0xb2"
SYSFS{ioerr_cnt}="0x0"
SYSFS{iorequest_cnt}="0xb2"
SYSFS{max_sectors}="240"
SYSFS{model}="ric/sg1"
SYSFS{queue_depth}="1"
SYSFS{queue_type}="none"
SYSFS{rev}=""
SYSFS{scsi_level}="3"
SYSFS{state}="running"
SYSFS{timeout}="30"
SYSFS{type}="0"
SYSFS{vendor}="csi_gene"
or even
[...]
follow the class device's "device"
looking at the device chain at '/sys/devices/pci0000:00/0000:00:10.1/usb2/2-2/2-2:1.0/host9/target9:0:0/9:0:0:0':
BUS="scsi"
ID="9:0:0:0"
DRIVER="sd"
SYSFS{device_blocked}="0"
SYSFS{iocounterbits}="32"
SYSFS{iodone_cnt}="0x8e"
SYSFS{ioerr_cnt}="0x0"
SYSFS{iorequest_cnt}="0x8e"
SYSFS{max_sectors}="240"
SYSFS{model}=""
SYSFS{queue_depth}="1"
SYSFS{queue_type}="none"
SYSFS{scsi_level}="3"
SYSFS{state}="running"
SYSFS{timeout}="30"
SYSFS{type}="0"
SYSFS{vendor}=""
Note in particular that the vendor and model names keep changing. (And I seem to be cycling through these 3 results)
Isn't this odd? Any clues?
I am more than willing to provide more info or run more tests...
Thanks in advance for your time and for any tip you might have for me.
Matteo
-------------------------------------------------------
SF.Net email is sponsored by:
Tame your development challenges with Apache's Geronimo App Server. Download
it for free - -and be entered to win a 42" plasma tv or your very own
Sony(tm)PSP. Click here to play: http://sourceforge.net/geronimo.php
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
Linux-hotplug-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: sysfs content varies among instances
2005-11-04 13:17 sysfs content varies among instances Matteo Semplice
@ 2005-11-04 17:15 ` Greg KH
0 siblings, 0 replies; 2+ messages in thread
From: Greg KH @ 2005-11-04 17:15 UTC (permalink / raw)
To: linux-hotplug
On Fri, Nov 04, 2005 at 02:17:30PM +0100, Matteo Semplice wrote:
> Hi everybody. I'm no developer, but am trying to figure out a proper
> udev rule for my (el-cheapo) usb pen drive (in particular to SYMLINK
> it to /media/myusbpen). Much investigation, doc reading, attempts,
> lead me to find out an odd behaviour in the creation of the /sys
> filesystem.
>
> The problem is that each time I plug in the pen drive, I get different
> "vendor" and "product" fields in the /sys filesystem...
Then you have a very strange usb device :)
> I run a 2.6.13.3 custom-built kernel plus the udev and hal packages
> from the Debian sarge distribution.
>
> First of all, the correct vendor and product info for my card are in
> the directory /sys/devices/pci0000:00/0000:00:10.1/usb2/2-2/
> but /sys/block/sda/device points to a subdirectory of that one, which
> does not contain the correct vendor/product files (precisely to
> /sys/devices/pci0000:00/0000:00:10.1/usb2/2-2/2-2:1.0/host1/target1:0:0/1:0:0:0)
>
> Is this correct?
Yes, the vendor/product files are for the usb _device_ not the usb
_interface_ which is what the usb-storage driver binds to, and the sda
device is created for.
> Further, after plugging the usb pen in a usb port,
> udevinfo -a -p $(udevinfo -q path -n /dev/sda)
> tells me:
> matteo@roccia:/etc/hotplug$ udevinfo -a -p $(udevinfo -q path -n /dev/sda)
>
> udevinfo starts with the device the node belongs to and then walks up the
> device chain, to print for every device found, all possibly useful attributes
> in the udev key format.
> Only attributes within one device section may be used together in one rule,
> to match the device for which the node will be created.
>
> device '/sys/block/sda' has major:minor 8:0
> looking at class device '/sys/block/sda':
> SUBSYSTEM="block"
> SYSFS{dev}="8:0"
> SYSFS{range}="16"
> SYSFS{removable}="1"
> SYSFS{size}="1019617"
> SYSFS{stat}=" 6 234 240 204 0 0 0 0 0 134 204"
>
> follow the class device's "device"
> looking at the device chain at '/sys/devices/pci0000:00/0000:00:10.1/usb2/2-2/2-2:1.0/host1/target1:0:0/1:0:0:0':
> BUS="scsi"
> ID="1:0:0:0"
> DRIVER="sd"
> SYSFS{device_blocked}="0"
> SYSFS{iocounterbits}="32"
> SYSFS{iodone_cnt}="0xc9a"
> SYSFS{ioerr_cnt}="0x0"
> SYSFS{iorequest_cnt}="0xc9a"
> SYSFS{max_sectors}="240"
> SYSFS{model}=".2"
> SYSFS{queue_depth}="1"
> SYSFS{queue_type}="none"
> SYSFS{rev}=""
> SYSFS{scsi_level}="3"
> SYSFS{state}="running"
> SYSFS{timeout}="30"
> SYSFS{type}="0"
> SYSFS{vendor}="linux.so"
>
> but I can also get (plugging it in the very same port)
> [...]
> follow the class device's "device"
> looking at the device chain at '/sys/devices/pci0000:00/0000:00:10.1/usb2/2-2/2-2:1.0/host8/target8:0:0/8:0:0:0':
> BUS="scsi"
> ID="8:0:0:0"
> DRIVER="sd"
> SYSFS{device_blocked}="0"
> SYSFS{iocounterbits}="32"
> SYSFS{iodone_cnt}="0xb2"
> SYSFS{ioerr_cnt}="0x0"
> SYSFS{iorequest_cnt}="0xb2"
> SYSFS{max_sectors}="240"
> SYSFS{model}="ric/sg1"
> SYSFS{queue_depth}="1"
> SYSFS{queue_type}="none"
> SYSFS{rev}=""
> SYSFS{scsi_level}="3"
> SYSFS{state}="running"
> SYSFS{timeout}="30"
> SYSFS{type}="0"
> SYSFS{vendor}="csi_gene"
>
> or even
> [...]
> follow the class device's "device"
> looking at the device chain at '/sys/devices/pci0000:00/0000:00:10.1/usb2/2-2/2-2:1.0/host9/target9:0:0/9:0:0:0':
> BUS="scsi"
> ID="9:0:0:0"
> DRIVER="sd"
> SYSFS{device_blocked}="0"
> SYSFS{iocounterbits}="32"
> SYSFS{iodone_cnt}="0x8e"
> SYSFS{ioerr_cnt}="0x0"
> SYSFS{iorequest_cnt}="0x8e"
> SYSFS{max_sectors}="240"
> SYSFS{model}=""
> SYSFS{queue_depth}="1"
> SYSFS{queue_type}="none"
> SYSFS{scsi_level}="3"
> SYSFS{state}="running"
> SYSFS{timeout}="30"
> SYSFS{type}="0"
> SYSFS{vendor}=""
>
> Note in particular that the vendor and model names keep changing. (And
> I seem to be cycling through these 3 results)
These are the scsi vendor and model names, not the USB names. Try
looking up the chain a few levels to see the USB one (where BUS="usb").
Hope this helps,
greg k-h
-------------------------------------------------------
SF.Net email is sponsored by:
Tame your development challenges with Apache's Geronimo App Server. Download
it for free - -and be entered to win a 42" plasma tv or your very own
Sony(tm)PSP. Click here to play: http://sourceforge.net/geronimo.php
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
Linux-hotplug-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2005-11-04 17:15 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-11-04 13:17 sysfs content varies among instances Matteo Semplice
2005-11-04 17:15 ` Greg KH
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).