diff options
author | Paul Walmsley <paul@booyaka.com> | 2007-04-19 08:56:12 -0400 |
---|---|---|
committer | Jiri Kosina <jkosina@suse.cz> | 2007-04-19 08:56:12 -0400 |
commit | 876b9276b993723f7a74d55b3b49b9186f05d09d (patch) | |
tree | c63653a1a13206f3f37007e334cb9054c05c4807 /drivers/hid/usbhid/hid-quirks.c | |
parent | 8cef908235bcac898a4f4ccc50c781e08022a579 (diff) |
USB HID: add 'quirks' module parameter
Add a 'quirks' module parameter for the usbhid module, so users can
add or modify quirks at module load time.
Signed-off-by: Paul Walmsley <paul@booyaka.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Diffstat (limited to 'drivers/hid/usbhid/hid-quirks.c')
-rw-r--r-- | drivers/hid/usbhid/hid-quirks.c | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/drivers/hid/usbhid/hid-quirks.c b/drivers/hid/usbhid/hid-quirks.c index a5fc8b5144ef..27188bd1e851 100644 --- a/drivers/hid/usbhid/hid-quirks.c +++ b/drivers/hid/usbhid/hid-quirks.c | |||
@@ -576,6 +576,44 @@ static void usbhid_remove_all_dquirks(void) | |||
576 | 576 | ||
577 | } | 577 | } |
578 | 578 | ||
579 | /** | ||
580 | * usbhid_quirks_init: apply USB HID quirks specified at module load time | ||
581 | */ | ||
582 | int usbhid_quirks_init(char **quirks_param) | ||
583 | { | ||
584 | u16 idVendor, idProduct; | ||
585 | u32 quirks; | ||
586 | int n = 0, m; | ||
587 | |||
588 | for (; quirks_param[n] && n < MAX_USBHID_BOOT_QUIRKS; n++) { | ||
589 | |||
590 | m = sscanf(quirks_param[n], "0x%hx:0x%hx:0x%x", | ||
591 | &idVendor, &idProduct, &quirks); | ||
592 | |||
593 | if (m != 3 || | ||
594 | usbhid_modify_dquirk(idVendor, idProduct, quirks) != 0) { | ||
595 | printk(KERN_WARNING | ||
596 | "Could not parse HID quirk module param %s\n", | ||
597 | quirks_param[n]); | ||
598 | } | ||
599 | } | ||
600 | |||
601 | return 0; | ||
602 | } | ||
603 | |||
604 | /** | ||
605 | * usbhid_quirks_exit: release memory associated with dynamic_quirks | ||
606 | * | ||
607 | * Description: | ||
608 | * Release all memory associated with dynamic quirks. Called upon | ||
609 | * module unload. | ||
610 | * | ||
611 | * Returns: nothing | ||
612 | */ | ||
613 | void usbhid_quirks_exit(void) | ||
614 | { | ||
615 | usbhid_remove_all_dquirks(); | ||
616 | } | ||
579 | 617 | ||
580 | /** | 618 | /** |
581 | * usbhid_exists_squirk: return any static quirks for a USB HID device | 619 | * usbhid_exists_squirk: return any static quirks for a USB HID device |