From: Roman Kagan <rkagan@mail.ru>
To: linux-hotplug@vger.kernel.org
Subject: Re: [ANNOUNCE] hotplug-ng 001 release
Date: Thu, 24 Feb 2005 06:27:11 +0000 [thread overview]
Message-ID: <20050224062710.GA2361@katya> (raw)
In-Reply-To: <20050211004033.GA26624@suse.de>
On Wed, Feb 23, 2005 at 02:04:47PM +0100, Erik van Konijnenburg wrote:
> That suggests they want locale dictionary order, not hex.
OK, here's a different version which lists explicitly the allowed
charactes in the range, e.g. for a range between 0x0001 0xa345 it gives
000[123456789ABCDEF]*
00[123456789ABCDEF]*
0[123456789ABCDEF]*
[123456789]*
A[012]*
A3[0123]*
A34[012345]*
Also I tried to improve the comprehensibility of the code a bit.
Comments?
Cheers,
Roman.
--- linux-2.6.11-rc4/scripts/mod/file2alias.c.orig 2005-02-13 06:06:23.000000000 +0300
+++ linux-2.6.11-rc4/scripts/mod/file2alias.c 2005-02-24 09:11:53.945050552 +0300
@@ -47,32 +47,34 @@
sprintf(str + strlen(str), "*"); \
} while(0)
-/* Looks like "usb:vNpNdlNdhNdcNdscNdpNicNiscNipN" */
-static int do_usb_entry(const char *filename,
- struct usb_device_id *id, char *alias)
+/* USB is special because the bcdDevice can be matched against a numeric range */
+/* Looks like "usb:vNpNdNdcNdscNdpNicNiscNipN" */
+static void do_usb_entry(struct usb_device_id *id,
+ unsigned int bcdDevice_initial, int bcdDevice_initial_digits,
+ unsigned char range_lo, unsigned char range_hi,
+ struct module *mod)
{
- id->match_flags = TO_NATIVE(id->match_flags);
- id->idVendor = TO_NATIVE(id->idVendor);
- id->idProduct = TO_NATIVE(id->idProduct);
- id->bcdDevice_lo = TO_NATIVE(id->bcdDevice_lo);
- id->bcdDevice_hi = TO_NATIVE(id->bcdDevice_hi);
-
- /*
- * Some modules (visor) have empty slots as placeholder for
- * run-time specification that results in catch-all alias
- */
- if (!(id->idVendor | id->bDeviceClass | id->bInterfaceClass))
- return 1;
-
+ static const char hexdigits[] = "0123456789ABCDEF";
+ char alias[500];
strcpy(alias, "usb:");
ADD(alias, "v", id->match_flags&USB_DEVICE_ID_MATCH_VENDOR,
id->idVendor);
ADD(alias, "p", id->match_flags&USB_DEVICE_ID_MATCH_PRODUCT,
id->idProduct);
- ADD(alias, "dl", id->match_flags&USB_DEVICE_ID_MATCH_DEV_LO,
- id->bcdDevice_lo);
- ADD(alias, "dh", id->match_flags&USB_DEVICE_ID_MATCH_DEV_HI,
- id->bcdDevice_hi);
+
+ strcat(alias, "d");
+ if (bcdDevice_initial_digits)
+ sprintf(alias + strlen(alias), "%0*X",
+ bcdDevice_initial_digits, bcdDevice_initial);
+ if (range_lo = range_hi)
+ strncat(alias, hexdigits + range_lo, 1);
+ else if (range_lo > 0x0 || range_hi < 0xf) {
+ strcat(alias, "[");
+ strncat(alias, hexdigits + range_lo, range_hi - range_lo + 1);
+ strcat(alias, "]");
+ }
+ strcat(alias, "*");
+
ADD(alias, "dc", id->match_flags&USB_DEVICE_ID_MATCH_DEV_CLASS,
id->bDeviceClass);
ADD(alias, "dsc",
@@ -90,7 +92,75 @@
ADD(alias, "ip",
id->match_flags&USB_DEVICE_ID_MATCH_INT_PROTOCOL,
id->bInterfaceProtocol);
- return 1;
+
+ /* Always end in a wildcard, for future extension */
+ if (alias[strlen(alias)-1] != '*')
+ strcat(alias, "*");
+ buf_printf(&mod->dev_table_buf,
+ "MODULE_ALIAS(\"%s\");\n", alias);
+}
+
+static void do_usb_entry_multi(struct usb_device_id *id, struct module *mod)
+{
+ unsigned int devlo, devhi;
+ unsigned char chi, clo;
+ int ndigits;
+
+ id->match_flags = TO_NATIVE(id->match_flags);
+ id->idVendor = TO_NATIVE(id->idVendor);
+ id->idProduct = TO_NATIVE(id->idProduct);
+
+ devlo = id->match_flags & USB_DEVICE_ID_MATCH_DEV_LO ?
+ TO_NATIVE(id->bcdDevice_lo) : 0x0U;
+ devhi = id->match_flags & USB_DEVICE_ID_MATCH_DEV_HI ?
+ TO_NATIVE(id->bcdDevice_hi) : ~0x0U;
+
+ /*
+ * Some modules (visor) have empty slots as placeholder for
+ * run-time specification that results in catch-all alias
+ */
+ if (!(id->idVendor | id->bDeviceClass | id->bInterfaceClass))
+ return;
+
+ /* Convert numeric bcdDevice range into fnmatch-able pattern(s) */
+ for (ndigits = sizeof(id->bcdDevice_lo) * 2 - 1; devlo <= devhi; ndigits--) {
+ clo = devlo & 0xf;
+ chi = devhi & 0xf;
+ devlo >>= 4;
+ devhi >>= 4;
+
+ if (devlo = devhi || !ndigits) {
+ do_usb_entry(id, devlo, ndigits, clo, chi, mod);
+ break;
+ }
+
+ if (clo != 0x0) {
+ do_usb_entry(id, devlo, ndigits, clo, 0xf, mod);
+ devlo++;
+ }
+
+ if (chi != 0xf) {
+ do_usb_entry(id, devhi, ndigits, 0x0, chi, mod);
+ devhi--;
+ }
+ }
+}
+
+static void do_usb_table(void *symval, unsigned long size,
+ struct module *mod)
+{
+ unsigned int i;
+ const unsigned long id_size = sizeof(struct usb_device_id);
+
+ if (size % id_size || size < id_size) {
+ fprintf(stderr, "*** Warning: %s ids %lu bad size "
+ "(each on %lu)\n", mod->name, size, id_size);
+ }
+ /* Leave last one: it's the terminator. */
+ size -= id_size;
+
+ for (i = 0; i < size; i += id_size)
+ do_usb_entry_multi(symval + i, mod);
}
/* Looks like: ieee1394:venNmoNspNverN */
@@ -262,8 +332,8 @@
do_table(symval, sym->st_size, sizeof(struct pci_device_id),
do_pci_entry, mod);
else if (sym_is(symname, "__mod_usb_device_table"))
- do_table(symval, sym->st_size, sizeof(struct usb_device_id),
- do_usb_entry, mod);
+ /* special case to handle bcdDevice ranges */
+ do_usb_table(symval, sym->st_size, mod);
else if (sym_is(symname, "__mod_ieee1394_device_table"))
do_table(symval, sym->st_size, sizeof(struct ieee1394_device_id),
do_ieee1394_entry, mod);
-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_ide95&alloc_id\x14396&op=click
_______________________________________________
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
next prev parent reply other threads:[~2005-02-24 6:27 UTC|newest]
Thread overview: 229+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-02-11 0:40 [ANNOUNCE] hotplug-ng 001 release Greg KH
2005-02-11 0:40 ` Greg KH
2005-02-11 0:52 ` Greg KH
2005-02-11 0:52 ` Greg KH
2005-02-11 1:30 ` Kasper Sandberg
2005-02-11 1:30 ` Kasper Sandberg
2005-02-11 6:41 ` Greg KH
2005-02-11 6:41 ` Greg KH
2005-02-11 11:47 ` Kasper Sandberg
2005-02-11 11:47 ` Kasper Sandberg
2005-02-11 17:06 ` Greg KH
2005-02-11 17:06 ` Greg KH
2005-02-12 0:02 ` Kasper Sandberg
2005-02-12 0:02 ` Kasper Sandberg
2005-02-11 1:07 ` Patrick McFarland
2005-02-11 1:07 ` Patrick McFarland
2005-02-11 1:16 ` Greg KH
2005-02-11 1:16 ` Greg KH
2005-02-11 20:40 ` Vojtech Pavlik
2005-02-11 20:40 ` Vojtech Pavlik
2005-02-14 4:06 ` Lee Revell
2005-02-14 4:06 ` Lee Revell
2005-02-14 8:32 ` Paolo Ciarrocchi
2005-02-14 8:32 ` Paolo Ciarrocchi
2005-02-14 8:51 ` Prakash Punnoor
2005-02-14 8:51 ` Prakash Punnoor
2005-02-14 23:04 ` Lee Revell
2005-02-14 23:04 ` Lee Revell
2005-02-14 23:16 ` Greg KH
2005-02-14 23:16 ` Greg KH
2005-02-14 23:28 ` Lee Revell
2005-02-14 23:28 ` Lee Revell
2005-02-15 15:15 ` Stefan Seyfried
2005-02-15 15:15 ` Stefan Seyfried
2005-02-15 20:12 ` kernel
2005-02-15 20:12 ` kernel
2005-02-14 23:21 ` Roland Dreier
2005-02-14 23:21 ` Roland Dreier
2005-02-14 23:45 ` [OT] speeding boot process (was Re: [ANNOUNCE] hotplug-ng 001 Lee Revell
2005-02-14 23:45 ` [OT] speeding boot process (was Re: [ANNOUNCE] hotplug-ng 001 release) Lee Revell
2005-02-15 0:16 ` [OT] speeding boot process (was Re: [ANNOUNCE] hotplug-ng 001 Tim Bird
2005-02-15 0:16 ` [OT] speeding boot process (was Re: [ANNOUNCE] hotplug-ng 001 release) Tim Bird
2005-02-15 1:17 ` [OT] speeding boot process (was Re: [ANNOUNCE] hotplug-ng 001 Lee Revell
2005-02-15 1:17 ` [OT] speeding boot process (was Re: [ANNOUNCE] hotplug-ng 001 release) Lee Revell
2005-02-15 1:45 ` Kyle Moffett
2005-02-15 1:45 ` Kyle Moffett
2005-02-15 7:32 ` Gábor Lénárt
2005-02-15 7:32 ` Gábor Lénárt
2005-02-15 8:34 ` Paolo Ciarrocchi
2005-02-15 8:34 ` Paolo Ciarrocchi
2005-02-15 9:27 ` [OT] speeding boot process Bernd Petrovitsch
2005-02-15 9:27 ` Bernd Petrovitsch
2005-02-15 8:55 ` [OT] speeding boot process (was Re: [ANNOUNCE] hotplug-ng 001 Helge Hafting
2005-02-15 8:55 ` [OT] speeding boot process (was Re: [ANNOUNCE] hotplug-ng 001 release) Helge Hafting
2005-02-15 9:33 ` [OT] speeding boot process (was Re: [ANNOUNCE] hotplug-ng 001 Bernd Petrovitsch
2005-02-15 9:33 ` [OT] speeding boot process (was Re: [ANNOUNCE] hotplug-ng 001 release) Bernd Petrovitsch
2005-02-15 13:20 ` [OT] speeding boot process (was Re: [ANNOUNCE] hotplug-ng 001 Helge Hafting
2005-02-15 13:20 ` [OT] speeding boot process (was Re: [ANNOUNCE] hotplug-ng 001 release) Helge Hafting
2005-02-15 13:28 ` [OT] speeding boot process (was Re: [ANNOUNCE] hotplug-ng 001 Paulo Marques
2005-02-15 13:28 ` [OT] speeding boot process (was Re: [ANNOUNCE] hotplug-ng 001 release) Paulo Marques
2005-02-15 13:50 ` [OT] speeding boot process (was Re: [ANNOUNCE] hotplug-ng 001 Bernd Petrovitsch
2005-02-15 13:50 ` [OT] speeding boot process (was Re: [ANNOUNCE] hotplug-ng 001 release) Bernd Petrovitsch
2005-02-16 1:54 ` Miquel van Smoorenburg
2005-02-15 3:38 ` [OT] speeding boot process (was Re: [ANNOUNCE] hotplug-ng 001 Jim Crilly
2005-02-15 3:38 ` [OT] speeding boot process (was Re: [ANNOUNCE] hotplug-ng 001 release) Jim Crilly
2005-02-15 5:52 ` [OT] speeding boot process (was Re: [ANNOUNCE] hotplug-ng 001 Nigel Cunningham
2005-02-15 5:52 ` [OT] speeding boot process (was Re: [ANNOUNCE] hotplug-ng 001 release) Nigel Cunningham
2005-02-15 6:15 ` [OT] speeding boot process (was Re: [ANNOUNCE] hotplug-ng 001 Jim Crilly
2005-02-15 6:15 ` [OT] speeding boot process (was Re: [ANNOUNCE] hotplug-ng 001 release) Jim Crilly
2005-02-15 6:39 ` [OT] speeding boot process (was Re: [ANNOUNCE] hotplug-ng 001 Nigel Cunningham
2005-02-15 6:39 ` [OT] speeding boot process (was Re: [ANNOUNCE] hotplug-ng 001 release) Nigel Cunningham
2005-02-15 19:32 ` [OT] speeding boot process (was Re: [ANNOUNCE] hotplug-ng 001 Lee Revell
2005-02-15 19:32 ` [OT] speeding boot process (was Re: [ANNOUNCE] hotplug-ng 001 release) Lee Revell
2005-02-17 18:37 ` jlnance
2005-02-17 18:37 ` jlnance
2005-02-17 19:18 ` Chris Larson
2005-02-17 19:18 ` Chris Larson
2005-02-19 5:53 ` [OT] speeding boot process (was Re: [ANNOUNCE] hotplug-ng 001 Jim Crilly
2005-02-19 5:53 ` [OT] speeding boot process (was Re: [ANNOUNCE] hotplug-ng 001 release) Jim Crilly
2005-02-17 19:58 ` Helge Hafting
2005-02-17 20:00 ` Helge Hafting
2005-02-19 5:56 ` [OT] speeding boot process (was Re: [ANNOUNCE] hotplug-ng 001 Jim Crilly
2005-02-19 5:56 ` [OT] speeding boot process (was Re: [ANNOUNCE] hotplug-ng 001 release) Jim Crilly
2005-02-19 22:47 ` Helge Hafting
2005-02-19 22:47 ` Helge Hafting
2005-02-20 2:09 ` [OT] speeding boot process (was Re: [ANNOUNCE] hotplug-ng 001 Jim Crilly
2005-02-20 2:09 ` [OT] speeding boot process (was Re: [ANNOUNCE] hotplug-ng 001 release) Jim Crilly
2005-02-15 8:33 ` Paolo Ciarrocchi
2005-02-15 8:33 ` Paolo Ciarrocchi
2005-02-14 23:43 ` [ANNOUNCE] hotplug-ng 001 release Diego Calleja
2005-02-14 23:43 ` Diego Calleja
2005-02-15 19:51 ` Lee Revell
2005-02-15 19:51 ` Lee Revell
2005-02-15 21:02 ` Diego Calleja
2005-02-15 21:02 ` Diego Calleja
2005-02-15 21:32 ` Chris Friesen
2005-02-15 21:32 ` Chris Friesen
2005-02-15 21:09 ` Valdis.Kletnieks
2005-02-15 21:09 ` Valdis.Kletnieks
2005-02-15 19:56 ` Optimizing disk-I/O [was Re: [ANNOUNCE] hotplug-ng 001 release] Linas Vepstas
2005-02-15 19:56 ` Linas Vepstas
2005-02-15 20:46 ` Adam Goode
2005-02-15 20:46 ` Adam Goode
2005-02-15 21:11 ` Diego Calleja
2005-02-15 21:11 ` Diego Calleja
2005-02-15 21:21 ` Valdis.Kletnieks
2005-02-15 21:21 ` Valdis.Kletnieks
2005-02-11 3:18 ` [ANNOUNCE] hotplug-ng 001 release Bill Nottingham
2005-02-11 3:18 ` Bill Nottingham
2005-02-11 6:46 ` Greg KH
2005-02-11 6:46 ` Greg KH
2005-02-11 16:19 ` Christian Bornträger
2005-02-11 16:19 ` Christian Bornträger
2005-02-11 17:01 ` Greg KH
2005-02-11 17:01 ` Greg KH
2005-02-11 19:01 ` Erik Andersen
2005-02-11 19:01 ` Erik Andersen
2005-02-11 19:23 ` Greg KH
2005-02-11 19:23 ` Greg KH
2005-02-11 21:37 ` Erik van Konijnenburg
2005-02-11 21:37 ` Erik van Konijnenburg
2005-02-11 21:49 ` Greg KH
2005-02-11 21:49 ` Greg KH
2005-02-11 22:06 ` Erik van Konijnenburg
2005-02-11 22:06 ` Erik van Konijnenburg
2005-02-11 22:13 ` Greg KH
2005-02-11 22:13 ` Greg KH
2005-02-12 0:48 ` Ingo Oeser
2005-02-12 0:48 ` Ingo Oeser
2005-02-14 22:43 ` Greg KH
2005-02-14 22:43 ` Greg KH
2005-02-11 8:10 ` Roman Kagan
2005-02-11 8:17 ` Greg KH
2005-02-11 9:52 ` Olivier Galibert
2005-02-11 9:52 ` Olivier Galibert
2005-02-11 17:08 ` Greg KH
2005-02-11 17:08 ` Greg KH
2005-02-11 10:53 ` Roman Kagan
2005-02-11 17:41 ` Christian Bornträger
2005-02-11 18:15 ` Greg KH
2005-02-11 18:47 ` Marco d'Itri
2005-02-11 19:33 ` Greg KH
2005-02-11 19:36 ` Greg KH
2005-02-11 19:40 ` Marco d'Itri
2005-02-11 19:57 ` Greg KH
2005-02-11 20:06 ` Harald Dunkel
2005-02-11 20:06 ` Harald Dunkel
2005-02-11 21:01 ` Greg KH
2005-02-11 21:01 ` Greg KH
2005-02-12 8:30 ` Harald Dunkel
2005-02-12 8:30 ` Harald Dunkel
2005-02-14 22:36 ` Greg KH
2005-02-14 22:36 ` Greg KH
2005-02-15 5:39 ` Harald Dunkel
2005-02-15 5:39 ` Harald Dunkel
2005-02-15 7:14 ` Greg KH
2005-02-15 7:14 ` Greg KH
2005-02-11 20:10 ` Marco d'Itri
2005-02-11 20:11 ` Roman Kagan
2005-02-11 20:20 ` Marco d'Itri
2005-02-11 20:44 ` Roman Kagan
2005-02-11 20:46 ` Roman Kagan
2005-02-11 20:56 ` Marco d'Itri
2005-02-11 21:01 ` Kay Sievers
2005-02-11 21:10 ` Greg KH
2005-02-17 6:46 ` Michael Tokarev
2005-02-17 6:46 ` Michael Tokarev
2005-02-11 21:21 ` Kay Sievers
2005-02-11 21:30 ` Greg KH
2005-02-11 21:33 ` Greg KH
2005-02-11 21:54 ` Marco d'Itri
2005-02-11 21:57 ` Greg KH
2005-02-11 22:05 ` Bill Nottingham
2005-02-11 22:12 ` Greg KH
2005-02-11 22:13 ` Roman Kagan
2005-02-11 22:16 ` Marco d'Itri
2005-02-11 22:18 ` Marco d'Itri
2005-02-11 22:45 ` Roman Kagan
2005-02-11 22:55 ` Roman Kagan
2005-02-11 23:05 ` Erik van Konijnenburg
2005-02-11 23:17 ` Marco d'Itri
2005-02-11 23:29 ` Roman Kagan
2005-02-11 23:35 ` Marco d'Itri
2005-02-12 0:10 ` Roman Kagan
2005-02-12 0:17 ` Marco d'Itri
2005-02-12 0:34 ` Roman Kagan
2005-02-12 11:43 ` Pozsár Balázs
2005-02-12 12:10 ` Roman Kagan
2005-02-12 16:27 ` Alexander E. Patrakov
2005-02-14 22:42 ` Greg KH
2005-02-15 7:34 ` Greg KH
2005-02-15 8:15 ` Christian Zoz
2005-02-15 10:25 ` Alexander E. Patrakov
2005-02-15 12:20 ` [sane-devel] " Julien BLACHE
2005-02-16 10:51 ` Roman Kagan
2005-02-16 11:07 ` Roman Kagan
2005-02-16 11:11 ` Marco d'Itri
2005-02-16 11:18 ` Roman Kagan
2005-02-16 11:27 ` Roman Kagan
2005-02-16 12:37 ` Kay Sievers
2005-02-16 15:17 ` Roman Kagan
2005-02-16 16:08 ` Kay Sievers
2005-02-16 23:02 ` Willem Riede
2005-02-16 23:17 ` Roman Kagan
2005-02-16 23:32 ` Willem Riede
2005-02-18 17:17 ` Patrick Mansfield
2005-02-18 17:17 ` Patrick Mansfield
2005-02-18 18:11 ` Roman Kagan
2005-02-18 18:11 ` Roman Kagan
2005-02-18 18:33 ` Patrick Mansfield
2005-02-18 18:33 ` Patrick Mansfield
2005-02-18 19:41 ` Roman Kagan
2005-02-18 19:41 ` Roman Kagan
2005-02-18 20:17 ` Patrick Mansfield
2005-02-18 20:17 ` Patrick Mansfield
2005-02-17 9:12 ` Roman Kagan
2005-02-21 20:40 ` Erik van Konijnenburg
2005-02-22 10:35 ` Roman Kagan
2005-02-23 0:44 ` Erik van Konijnenburg
2005-02-23 11:40 ` Roman Kagan
2005-02-23 13:04 ` Erik van Konijnenburg
2005-02-24 6:27 ` Roman Kagan [this message]
2005-02-24 19:28 ` Erik van Konijnenburg
2005-02-25 22:07 ` Greg KH
2005-02-25 22:07 ` Greg KH
2005-02-25 22:11 ` Greg KH
2005-02-25 22:12 ` Greg KH
2005-02-26 17:13 ` Roman Kagan
-- strict thread matches above, loose matches on Subject: below --
2005-02-14 10:29 Michal Rokos
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=20050224062710.GA2361@katya \
--to=rkagan@mail.ru \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.