linux-hotplug.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andreas Jellinghaus <aj@leogic.com>
To: linux-hotplug@vger.kernel.org
Subject: Re: usb + sysfs + udev problems once more
Date: Wed, 27 Jun 2007 15:27:11 +0000	[thread overview]
Message-ID: <200706271727.11827.aj@leogic.com> (raw)
In-Reply-To: <200706271514.22408.aj@leogic.com>

Am Mittwoch, 27. Juni 2007 16:35 schrieb Kay Sievers:
> The usb-interfaces (2nd event) do not have a device node. Only the
> usb-device itself, but you match on interface properties. There is no
> sane way for udev to match on an interface property and get the device
> node name at the same time. You run into unsolvable timing problems,
> or need to use weird hacks.

if I remember correcty, with linux and hotplug this was possible, right?
so linux+sysfs+udev is a regression from linux+hotplug? an unfixable?

also with 2.6.21.2 plus udev 093 on ubuntu edgy it works for me.
is this a udev regression or kernel regression? why is there "no sane way"
if it works with older software? sorry, I'm puzzled.

> Also, usbfs proc device-nodes are not available on modern systems (can
> not support ACL's). Udev creates /dev/bus/usb/*/* nodes and libusb
> picks up the nodes from there, if the directory exists.

fine with me, how do I get udev to call me when a smart card reader is
plugged in and pass the device name in some variable? smart card reader
these days pretty much means CCID device, i.e. a device with 0b interface.
could be a combo device like a keyboard with an intergrated reader, I will
have a look at pick the right endpoint.

my last information was that there are no proper events for /dev/bus/usb 
nodes, such they are a regression, while they offer some new features, they 
also miss some older features.

> The kernel exports the devices nodes by the usb-device itself (2.6.22)
> or (for older kernels) by usb_device-class devices. But also with that
> setup, there is no convenient way to get interface properties to match
> against, and device node access at the same time with simple udev
> rules. There is support for all that in HAL, but not in udev.

I never found any useful information how to plug into hal. 
is there anyone who can convert 
https://www.opensc-project.org/openct/browser/trunk/etc/openct.udev
into a hal config file? not that I'm eager to move to a new software
which had no useful documentation the last time I looked at it. but maybe
that changed? still it would be an extra dependency some people don't want.

also I wonder: two years ago with linux + hotplug I was fine. when exactly
began this change that results in my application being broken? I thought
linux had very strict requirements not to change the kernel/userland interface 
without proper announcement, migration plans and all that. but for 
usb/udev/hotplug/sysfs I can't remember any announcement mentioning 
incompatible kernel/userland changes.

> The only reliable way for udev rules would be with kernel 2.6.22, not
> using usb_device class devices and not using proc usbfs. With such a
> setup, you could hook your RUN into the interface-event and the
> program/script can query the device-node name from the parent device
> of the interface.

you mean like this?

ls -d /sys/$DEVPATH/../usb_device* |xargs basename |
sed -e "s/usb_device:usbdev//g" |sed -e "s/\./ /g" |xargs 
printf /dev/bus/usb/%03d/%03d\\n

i.e. from the $DEVPATH ("interface"?) I go to .. then look for 
usb_device:usbdev* files, which should be only one, get that name,
strip "usb_device:usbdev" and split the remainder (e.g. 3.8)
first into two numbers (3 8) and then format them into
/dev/bus/usb/%03d/%03d (e.g. /dev/bus/usb/003/008).

is this ok? will it work on older kernel and future kernels as well?
will it work with different versions of udev? could you think of any
hardware where this would't work?

thanks for your help.

Regards, Andreas

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
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

  parent reply	other threads:[~2007-06-27 15:27 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-06-27 13:14 usb + sysfs + udev problems once more Andreas Jellinghaus
2007-06-27 14:35 ` Kay Sievers
2007-06-27 15:27 ` Andreas Jellinghaus [this message]
2007-06-27 16:02 ` Alexander E. Patrakov
2007-06-27 16:22 ` Andreas Jellinghaus
2007-06-27 16:36 ` Kay Sievers

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200706271727.11827.aj@leogic.com \
    --to=aj@leogic.com \
    --cc=linux-hotplug@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).