linux-hotplug.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* udev devname events have less environment
@ 2006-03-19 21:37 Andreas Jellinghaus
  2006-03-20  1:14 ` Kay Sievers
  0 siblings, 1 reply; 2+ messages in thread
From: Andreas Jellinghaus @ 2006-03-19 21:37 UTC (permalink / raw)
  To: linux-hotplug

maybe other people will run into this problem too, so I'm posting
it here:

for the old /proc/bus/usb filesystem I see events resulting
in environment like this (even if there is no usbfs mounted):
export ACTION="add"
export DEVICE="/proc/bus/usb/002/015"
export DEVPATH="/devices/pci0000:00/0000:00:13.0/usb2/2-1/2-1:1.0"
export INTERFACE="0/0/0"
export MODALIAS="usb:v0973p0001d0100dcFFdsc00dp00ic00isc00ip00"
export OLDPWD
export PHYSDEVBUS="usb"
export PRODUCT="973/1/100"
export PWD="/"
export SEQNUM="757"
export SHLVL="1"
export SUBSYSTEM="usb"
export TYPE="255/0/0"
export UDEVD_EVENT="1"
export UDEV_LOG="3"

now for /dev/bus/usb/... devices I see events coming from udev
too, bug with different environment:
export ACTION="add"
export DEVNAME="/dev/bus/usb/002/015"
export DEVPATH="/class/usb_device/usbdev2.15"
export MAJOR="189"
export MINOR="142"
export OLDPWD
export PHYSDEVBUS="usb"
export PHYSDEVDRIVER="usb"
export PHYSDEVPATH="/devices/pci0000:00/0000:00:13.0/usb2/2-1"
export PWD="/"
export SEQNUM="758"
export SHLVL="1"
export SUBSYSTEM="usb_device"
export UDEVD_EVENT="1"
export UDEV_LOG="3"
export USB_BUS="002"
export USB_DEV="015"

ok, it is not DEVICE but DEVNAME, I can check for both. but PRODUCT is not
set, and so far I depend on that setting. I wonder why it was designed this
way?

I changed my code to
        V="`cat /sys/$DEVPATH/device/idVendor |sed -e "s/^0*//"`"
        P="`cat /sys/$DEVPATH/device/idProduct|sed -e "s/^0*//"`"
        D="`cat /sys/$DEVPATH/device/bcdDevice |sed -e "s/^0*//"`"
        PRODUCT="$V/$P/$D"
so I can get $PRODUCT in that case too. not pretty, but works for me.

Regards, Andreas



-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid\x110944&bid$1720&dat\x121642
_______________________________________________
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: udev devname events have less environment
  2006-03-19 21:37 udev devname events have less environment Andreas Jellinghaus
@ 2006-03-20  1:14 ` Kay Sievers
  0 siblings, 0 replies; 2+ messages in thread
From: Kay Sievers @ 2006-03-20  1:14 UTC (permalink / raw)
  To: linux-hotplug

On Sun, Mar 19, 2006 at 10:37:31PM +0100, Andreas Jellinghaus wrote:
> maybe other people will run into this problem too, so I'm posting
> it here:
> 
> for the old /proc/bus/usb filesystem I see events resulting
> in environment like this (even if there is no usbfs mounted):
> export ACTION="add"
> export DEVICE="/proc/bus/usb/002/015"
> export DEVPATH="/devices/pci0000:00/0000:00:13.0/usb2/2-1/2-1:1.0"
> export INTERFACE="0/0/0"
> export MODALIAS="usb:v0973p0001d0100dcFFdsc00dp00ic00isc00ip00"
> export OLDPWD
> export PHYSDEVBUS="usb"
> export PRODUCT="973/1/100"
> export PWD="/"
> export SEQNUM="757"
> export SHLVL="1"
> export SUBSYSTEM="usb"
> export TYPE="255/0/0"
> export UDEVD_EVENT="1"
> export UDEV_LOG="3"
> 
> now for /dev/bus/usb/... devices I see events coming from udev
> too, bug with different environment:
> export ACTION="add"
> export DEVNAME="/dev/bus/usb/002/015"
> export DEVPATH="/class/usb_device/usbdev2.15"
> export MAJOR="189"
> export MINOR="142"
> export OLDPWD
> export PHYSDEVBUS="usb"
> export PHYSDEVDRIVER="usb"
> export PHYSDEVPATH="/devices/pci0000:00/0000:00:13.0/usb2/2-1"
> export PWD="/"
> export SEQNUM="758"
> export SHLVL="1"
> export SUBSYSTEM="usb_device"
> export UDEVD_EVENT="1"
> export UDEV_LOG="3"
> export USB_BUS="002"
> export USB_DEV="015"
> 
> ok, it is not DEVICE but DEVNAME, I can check for both. but PRODUCT is not
> set, and so far I depend on that setting. I wonder why it was designed this
> way?

It depends on what event you want to plug in. The event with the $DEVNAME
is a different one from the one with the $DEVICE. This is cause the
current driver core requires a "class device" to export a device node.
This will be solved in the future and the next version of userspace
usb device access, Greg is currently working on, is expected to have the
device node created by the "real" device instead of the mess we need to
do today.

> I changed my code to
>         V="`cat /sys/$DEVPATH/device/idVendor |sed -e "s/^0*//"`"
>         P="`cat /sys/$DEVPATH/device/idProduct|sed -e "s/^0*//"`"
>         D="`cat /sys/$DEVPATH/device/bcdDevice |sed -e "s/^0*//"`"
>         PRODUCT="$V/$P/$D"
> so I can get $PRODUCT in that case too. not pretty, but works for me.

For any new code, better stay away from all the old variables and use
the sysfs values. Even the use of the "device" link is not recommended,
cause that may go away some day in the future, just follow the chain of
devices upwards the $DEVPATH until you find the device you expect.

Kay


-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid\x110944&bid$1720&dat\x121642
_______________________________________________
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:[~2006-03-20  1:14 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-03-19 21:37 udev devname events have less environment Andreas Jellinghaus
2006-03-20  1:14 ` Kay Sievers

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).