Discussion:
Why no USB id list in the kernel sources?
Michael Opdenacker
2013-07-05 21:34:05 UTC
Permalink
Hi,

I'm wondering why there is no include/linux/usb_ids.h (or
include/linux/usb/ids.h) file in the same way there is a
include/linux/pci_ids.h for PCI.

I don't expect all product ids to be listed (the
http://www.linux-usb.org/usb.ids list is pretty big), but if we could
have at least vendor ids, it would make device tables cleaner and easier
to read, as we have in most PCI drivers. Here would be an example:

diff --git a/drivers/media/usb/gspca/pac207.c
b/drivers/media/usb/gspca/pac207.c
index 83519be..ce8c975 100644
--- a/drivers/media/usb/gspca/pac207.c
+++ b/drivers/media/usb/gspca/pac207.c
@@ -449,19 +449,19 @@ static const struct sd_desc sd_desc = {

/* -- module initialisation -- */
static const struct usb_device_id device_table[] = {
- {USB_DEVICE(0x041e, 0x4028)},
- {USB_DEVICE(0x093a, 0x2460)},
- {USB_DEVICE(0x093a, 0x2461)},
- {USB_DEVICE(0x093a, 0x2463)},
- {USB_DEVICE(0x093a, 0x2464)},
- {USB_DEVICE(0x093a, 0x2468)},
- {USB_DEVICE(0x093a, 0x2470)},
- {USB_DEVICE(0x093a, 0x2471)},
- {USB_DEVICE(0x093a, 0x2472)},
- {USB_DEVICE(0x093a, 0x2474)},
- {USB_DEVICE(0x093a, 0x2476)},
- {USB_DEVICE(0x145f, 0x013a)},
- {USB_DEVICE(0x2001, 0xf115)},
+ {USB_DEVICE(USB_VENDOR_ID_CREATIVE, 0x4028)},
+ {USB_DEVICE(USB_VENDOR_ID_PIXART, 0x2460)},
+ {USB_DEVICE(USB_VENDOR_ID_PIXART, 0x2461)},
+ {USB_DEVICE(USB_VENDOR_ID_PIXART, 0x2463)},
+ {USB_DEVICE(USB_VENDOR_ID_PIXART, 0x2464)},
+ {USB_DEVICE(USB_VENDOR_ID_PIXART, 0x2468)},
+ {USB_DEVICE(USB_VENDOR_ID_PIXART, 0x2470)},
+ {USB_DEVICE(USB_VENDOR_ID_PIXART, 0x2471)},
+ {USB_DEVICE(USB_VENDOR_ID_PIXART, 0x2472)},
+ {USB_DEVICE(USB_VENDOR_ID_PIXART, 0x2474)},
+ {USB_DEVICE(USB_VENDOR_ID_PIXART, 0x2476)},
+ {USB_DEVICE(USB_VENDOR_ID_TRUST, 0x013a)},
+ {USB_DEVICE(USB_VENDOR_ID_DLINK, 0xf115)},
{}
};
MODULE_DEVICE_TABLE(usb, device_table);

Does this happen because nobody had the time to create and maintain such
a usb_ids.h file, or would there be any other reasons?

I'm asking because I don't like raw values in situations when a symbolic
name would be more self-explanatory ;)

Thanks,

Cheers,

Michael.
--
Michael Opdenacker, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
+33 484 258 098
Greg KH
2013-07-05 21:43:18 UTC
Permalink
Post by Michael Opdenacker
Hi,
I'm wondering why there is no include/linux/usb_ids.h (or
include/linux/usb/ids.h) file in the same way there is a
include/linux/pci_ids.h for PCI.
Because that way lies madness, we have learned from our mistakes and do
not want to repeat them again :)

It turns out that the pci_ids file isn't a good idea, it's a merge mess,
and only really works when you have ids that are shared across different
drivers. In the end, that is a very small number, and it's just not
worth the time and effort to do this in a centralized way.

Hope this helps explain things, if you want more details, dig into the
linux usb mailing list about 10-15 years ago when this decision was
made.

thanks,

greg k-h
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo-***@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Michael Opdenacker
2013-07-06 04:43:03 UTC
Permalink
Hi Greg,
Post by Greg KH
Post by Michael Opdenacker
Hi,
I'm wondering why there is no include/linux/usb_ids.h (or
include/linux/usb/ids.h) file in the same way there is a
include/linux/pci_ids.h for PCI.
Because that way lies madness, we have learned from our mistakes and do
not want to repeat them again :)
It turns out that the pci_ids file isn't a good idea, it's a merge mess,
and only really works when you have ids that are shared across different
drivers. In the end, that is a very small number, and it's just not
worth the time and effort to do this in a centralized way.
Hope this helps explain things, if you want more details, dig into the
linux usb mailing list about 10-15 years ago when this decision was
made.
I understand better now, thanks. It's true that the added value would
have been relatively small anyway.

Thanks for your time!

Cheers,

Michael.
Post by Greg KH
thanks,
greg k-h
--
Michael Opdenacker, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
+33 484 258 098

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo-***@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Continue reading on narkive:
Loading...