From: Per Svennerbrandt <per.svennerbrandt@lbi.se>
To: Greg KH <greg@kroah.com>
Cc: linux-hotplug-devel@lists.sourceforge.com, linux-kernel@vger.kernel.org
Subject: Re: [ANNOUNCE] hotplug-ng 002 release
Date: Mon, 16 May 2005 00:37:32 +0200 [thread overview]
Message-ID: <20050515223731.GA1101@tsiryulnik> (raw)
In-Reply-To: <20050514055916.GA19188@kroah.com>
* Greg KH (greg@kroah.com) wrote:
> On Sat, May 14, 2005 at 01:21:33AM +0200, Per Svennerbrandt wrote:
> > * On Fri, 13 May 2005, Greg KH (greg@kroah.com) wrote:
> > > Ok, as you never posted your patch, I had to do it myself :)
> >
> > Oh, crap! Seems like I'm forever doomed to be sitting on my patches for
> > six months thinking they arn't good enough, only to then repeatedly
> > getting beaten by couple of hours when finally deciding on submitting
> > them then... ;) ;)
> >
> > I guess I'l just have to dedicate more time if I'm ever going to get any
> > code into the kernel.
>
> Or just send those patches earlier :)
Well, it's not sending the patches that's the hard part. :) It's getting to
the point where you're feeling a 100% confident that the code is a 100%
correct and without side effects that is. And since I'm so inexperienced in
kernel programming getting to that point simply involves reading just
lots and lots of code, and hence ends up taking a lot of time...
But enough about that. :)
Personal TODO list:
# prt-get install aspell
$ code++
$ talk--
> > > +static ssize_t show_modalias(struct device *dev, char *buf)
> > > +{
> > > + struct usb_interface *intf;
> > > + struct usb_device *udev;
> > > +
> > > + intf = to_usb_interface(dev);
> > > + udev = interface_to_usbdev(intf);
> > > + if (udev->descriptor.bDeviceClass == 0) {
> > > + struct usb_host_interface *alt = intf->cur_altsetting;
> > > +
> > > + return sprintf(buf, "usb:v%04Xp%04Xd%04Xdc%02Xdsc%02Xdp%02Xic%02Xisc%02Xip%02X\n",
> > > + le16_to_cpu(udev->descriptor.idVendor),
> > > + le16_to_cpu(udev->descriptor.idProduct),
> > > + le16_to_cpu(udev->descriptor.bcdDevice),
> > > + udev->descriptor.bDeviceClass,
> > > + udev->descriptor.bDeviceSubClass,
> > > + udev->descriptor.bDeviceProtocol,
> > > + alt->desc.bInterfaceClass,
> > > + alt->desc.bInterfaceSubClass,
> > > + alt->desc.bInterfaceProtocol);
> >
> > Are you sure this is correct?
>
> Works for me :)
>
> > I had problems with alt (intf->cur_altsetting) beeing null and actually
> > ended up ignoring the interface bits altogether. I'm bretty sure the
> > above will crash repeatedly on at least some of my machines.
>
> Please let me know if it does. Did you put the modalias on the
> usb_device or the interface? It belongs on the interface, as this patch
> does.
Here's what I did:
--- linux-2.6.12-rc2/drivers/usb/core/sysfs.c.orig 2005-04-12 14:25:44.000000000 +0200
+++ linux-2.6.12-rc2/drivers/usb/core/sysfs.c 2005-04-12 15:14:24.000000000 +0200
@@ -164,6 +164,22 @@ show_maxchild (struct device *dev, char
}
static DEVICE_ATTR(maxchild, S_IRUGO, show_maxchild, NULL);
+static ssize_t
+show_modalias (struct device *dev, char *buf)
+{
+ struct usb_device *udev = to_usb_device (dev);
+ /* FIXME: Add proper interface support */
+ return sprintf (buf, "usb:v%04Xp%04Xdl%04Xdh%04Xdc%02Xdsc%02Xdp%02Xic*isc*ip*\n",
+ le16_to_cpu(udev->descriptor.idVendor),
+ le16_to_cpu(udev->descriptor.idProduct),
+ le16_to_cpu(udev->descriptor.bcdDevice),
+ udev->descriptor.bcdDevice,
+ udev->descriptor.bDeviceClass,
+ udev->descriptor.bDeviceSubClass,
+ udev->descriptor.bDeviceProtocol);
+}
+static DEVICE_ATTR(modalias, S_IRUGO, show_modalias, NULL);
+
/* Descriptor fields */
#define usb_descriptor_attr_le16(field, format_string) \
static ssize_t \
@@ -211,6 +245,7 @@ static struct attribute *dev_attrs[] = {
&dev_attr_bDeviceSubClass.attr,
&dev_attr_bDeviceProtocol.attr,
&dev_attr_bNumConfigurations.attr,
+ &dev_attr_modalias.attr,
&dev_attr_speed.attr,
&dev_attr_devnum.attr,
&dev_attr_version.attr,
So, yeah, it was on the device and your version is obviously better. It
does, however, have one little "problem" in common with mine:
Plug in GPS.
$ grep MODALIAS /tmp/hotplug.log
MODALIAS=usb:v067Bp2303dl0202dh0202dc00dsc00dp00icFFisc00ip00
^^^^^^^^^^^^^
$ cat /sys/devices/pci0000\:00/0000\:00\:07.2/usb1/1-1/modalias
usb:v067Bp2303dl0202dh0202dc00dsc00dp00ic*isc*ip*
^^^^^^^^^^
> cur_altsetting could be NULL pretty early in the initialization phase of
> a USB device, but by the time these files are created, it should be fine
> (otherwise this same check in the hotplug call would also fail, right?)
> > So now that I'm not able to submit it toghether with a mixture of other,
> > at least slightly, related things that I actually *do believe* have a
> > small possibility of beeing accepted: How do I get my request_modalias
> > patch in? ;) ;)
>
> Send them on, let's see what you have, and we can take it from there.
I'll do that.
Pelle
next prev parent reply other threads:[~2005-05-15 22:41 UTC|newest]
Thread overview: 59+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-05-06 21:22 [ANNOUNCE] hotplug-ng 002 release Greg KH
2005-05-08 22:52 ` Per Liden
2005-05-09 21:13 ` Per Svennerbrandt
2005-05-10 22:17 ` Per Liden
2005-05-10 22:41 ` Greg KH
2005-05-10 23:56 ` Per Liden
2005-05-11 1:22 ` Brian Gerst
2005-05-11 5:33 ` Greg KH
2005-05-11 17:36 ` Per Liden
2005-05-11 17:41 ` Greg KH
2005-05-18 23:00 ` Per Svennerbrandt
2005-05-18 23:00 ` [PATCH][RFC] __request_module: fixed argument request_module with waitflag Per Svennerbrandt
2005-05-18 23:01 ` [PATCH][RFC] request_modalias: MODALIAS based module loading Per Svennerbrandt
2005-05-10 22:41 ` [ANNOUNCE] hotplug-ng 002 release Greg KH
2005-05-12 21:42 ` Greg KH
2005-05-13 8:19 ` Michael Tokarev
2005-05-13 16:02 ` Greg KH
2005-05-13 23:21 ` Per Svennerbrandt
2005-05-14 5:59 ` Greg KH
2005-05-15 22:37 ` Per Svennerbrandt [this message]
2005-05-18 9:27 ` David Weinehall
2005-05-09 23:22 ` Greg KH
2005-05-10 21:51 ` Per Liden
2005-05-11 5:36 ` Greg KH
2005-05-09 3:57 ` Rusty Russell
2005-05-09 23:21 ` Greg KH
2005-05-10 9:29 ` Rusty Russell
2005-05-10 9:43 ` Marco d'Itri
2005-05-10 12:58 ` Alexander E. Patrakov
2005-05-10 17:24 ` Marco d'Itri
2005-05-10 20:13 ` Greg KH
2005-05-10 20:28 ` Lee Revell
2005-05-10 20:59 ` Greg KH
2005-05-10 21:02 ` Marco d'Itri
2005-05-10 20:31 ` Marco d'Itri
2005-05-10 20:52 ` Greg KH
2005-05-10 20:59 ` Bill Nottingham
2005-05-10 21:08 ` Marco d'Itri
2005-05-10 21:22 ` Erik van Konijnenburg
2005-05-10 23:55 ` [PATCH] " Erik van Konijnenburg
2005-05-11 0:05 ` Marco d'Itri
2005-05-11 5:40 ` Greg KH
2005-05-11 0:08 ` [PATCH] " Rusty Russell
2005-05-11 1:11 ` Erik van Konijnenburg
2005-05-11 3:39 ` Rusty Russell
2005-05-11 9:59 ` Erik van Konijnenburg
2005-05-11 10:52 ` Rusty Russell
2005-05-11 10:58 ` Marco d'Itri
2005-05-11 13:06 ` Erik van Konijnenburg
2005-05-12 4:39 ` Rusty Russell
2005-05-12 7:47 ` Erik van Konijnenburg
2005-05-10 21:21 ` Giuseppe Bilotta
2005-05-11 0:01 ` Rusty Russell
2005-05-11 0:10 ` Marco d'Itri
2005-05-11 1:09 ` Rusty Russell
2005-05-14 23:02 ` Michael Tokarev
2005-05-16 19:11 ` Greg KH
[not found] <41iyE-8mI-11@gated-at.bofh.it>
[not found] ` <427KM-h4-9@gated-at.bofh.it>
[not found] ` <42pRx-75A-19@gated-at.bofh.it>
[not found] ` <42znJ-6x7-25@gated-at.bofh.it>
[not found] ` <42zQL-70r-25@gated-at.bofh.it>
[not found] ` <42CF0-YV-37@gated-at.bofh.it>
[not found] ` <42GIH-4u3-31@gated-at.bofh.it>
[not found] ` <42Jn3-6Qj-5@gated-at.bofh.it>
[not found] ` <42KsY-7KW-33@gated-at.bofh.it>
2005-05-11 2:04 ` Bodo Eggert <harvested.in.lkml@posting.7eggert.dyndns.org>
2005-05-18 7:23 ` Giuseppe Bilotta
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=20050515223731.GA1101@tsiryulnik \
--to=per.svennerbrandt@lbi.se \
--cc=greg@kroah.com \
--cc=linux-hotplug-devel@lists.sourceforge.com \
--cc=linux-kernel@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