summaryrefslogtreecommitdiffstats
path: root/usb.c
diff options
context:
space:
mode:
authorOlivier Blin <oblin@mandriva.com>2007-09-19 14:40:21 +0000
committerOlivier Blin <oblin@mandriva.com>2007-09-19 14:40:21 +0000
commit97e6b4d23e2e2b5ff5a43ebb42c014e656ecfacc (patch)
treedd2acfd9166c5b04908edafda6f78663937e566e /usb.c
parenteab52d25c6126a0b18250b27a8910a02ab32e057 (diff)
downloadldetect-97e6b4d23e2e2b5ff5a43ebb42c014e656ecfacc.tar
ldetect-97e6b4d23e2e2b5ff5a43ebb42c014e656ecfacc.tar.gz
ldetect-97e6b4d23e2e2b5ff5a43ebb42c014e656ecfacc.tar.bz2
ldetect-97e6b4d23e2e2b5ff5a43ebb42c014e656ecfacc.tar.xz
ldetect-97e6b4d23e2e2b5ff5a43ebb42c014e656ecfacc.zip
replace '-' characters from USB drivers with '_' to be compliant with modnames from modaliases
Diffstat (limited to 'usb.c')
-rw-r--r--usb.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/usb.c b/usb.c
index 0fec6f9..4a60909 100644
--- a/usb.c
+++ b/usb.c
@@ -61,8 +61,16 @@ extern struct pciusb_entries usb_probe(void) {
int class_id, sub, prot = 0;
if (sscanf(buf, "I:%*1c If#=%*2d Alt=%*2d #EPs=%*2d Cls=%02x(%*5c) Sub=%02x Prot=%02x Driver=%s", &class_id, &sub, &prot, driver) == 4) {
e->class_id = (class_id * 0x100 + sub) * 0x100 + prot;
- if (strncmp(driver, "(none)", 6))
+ if (strncmp(driver, "(none)", 6)) {
+ char *p;
e->module = strdup(driver);
+ /* replace '-' characters with '_' to be compliant with modnames from modaliases */
+ p = e->module;
+ while (p && *p) {
+ if (*p == '-') *p = '_';
+ p++;
+ }
+ }
/* see linux/sound/usb/usbaudio.c::usb_audio_ids */
if (e->class_id == (0x1*0x100+ 0x01)) /* USB_AUDIO_CLASS*0x100 + USB_SUBCLASS_AUDIO_CONTROL*/
e->module = strdup("snd-usb-audio");