linux-hotplug.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Marcel Holtmann <marcel@holtmann.org>
To: linux-hotplug@vger.kernel.org
Subject: Re: [PATCH] libudev: device - add devtype support
Date: Fri, 02 Jan 2009 17:57:52 +0000	[thread overview]
Message-ID: <1230919072.26730.25.camel@californication> (raw)
In-Reply-To: <1230866522.14544.4.camel@californication>

Hi David,

> > > > I was playing a little bit with libudev and I actually need the DEVTYPE
> > > > from uevent for various tasks. Especially with USB and Bluetooth, the
> > > > subsystem value is too generic.
> > > >
> > > > Attached is a patch that implements udev_device_get_devtype() and also
> > > > udev_device_get_parent_with_devtype(). Please double check that I did it
> > > > the right way.
> > > 
> > > Looks good. Applied.
> > 
> > one minor thing that came to my mind is that DEVTYPE and subsystem are
> > actually kinda coupled. So a DEVTYPE="host" has a different semantic for
> > USB than for Bluetooth subsystem for example. Not sure if we actually
> > care or just add a udev_device_get_parent_with_subsystem_devtype()
> > function to give applications a choice if they wanna care.
> 
> Isn't DEVTYPE in the environment already? If so, just use the new API
> added here
> 
> http://git.kernel.org/?p=linux/hotplug/udev.git;a=commit;hð89350234e39b868a5e3df71a8f8c036aaae4fd
> 
> instead of Marcel's patch?

the use case here is different. You need udev_device_get_parent... ones
if you are receiving your device via a monitor. Using the enumeration
API only produces overhead.

The other main issue was that DEVTYPE has to be read from the uevent
sysfs file like MAJOR and MINOR in some cases.

An example where this is useful is for all the USB and SDIO composite
devices where you have to apply different policies if they share the
same parent. One example is a WiFi/WiMAX combo where the actual physical
radio is shared and thus only one can be active at a time. For the
kernel these two look like independent device, but in userspace we have
to apply certain policies. Otherwise nothing will work.

Also the problem with USB is that the parent is most times from DEVTYPE
usb_interface and that doesn't help. You have to go all up to usb_device
before you know that it is actually the same physical device.

Regards

Marcel



  parent reply	other threads:[~2009-01-02 17:57 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-01-02  3:22 [PATCH] libudev: device - add devtype support Marcel Holtmann
2009-01-02  3:42 ` Kay Sievers
2009-01-02  8:22 ` Marcel Holtmann
2009-01-02 11:25 ` Kay Sievers
2009-01-02 13:46 ` Marcel Holtmann
2009-01-02 14:03 ` Kay Sievers
2009-01-02 16:17 ` David Zeuthen
2009-01-02 16:27 ` Kay Sievers
2009-01-02 17:57 ` Marcel Holtmann [this message]
2009-01-03  4:26 ` Kay Sievers
2009-01-03 10:19 ` Marcel Holtmann
2009-01-03 15:34 ` Kay Sievers
2009-01-03 18:28 ` Marcel Holtmann

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=1230919072.26730.25.camel@californication \
    --to=marcel@holtmann.org \
    --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).