diff options
author | Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net> | 2011-05-31 23:31:08 +0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2011-06-07 03:41:47 +0400 |
commit | c4fc2342cb611f945fa468e742759e25984005ad (patch) | |
tree | 133ec26407179938857d323f0aa51e75149f19c7 /drivers/usb/core/hcd.c | |
parent | 680681747ff933fdedfbf11bd03c369e5b14085c (diff) | |
download | linux-c4fc2342cb611f945fa468e742759e25984005ad.tar.xz |
USB: Add "authorized_default" parameter to the usbcore module
The "authorized_default" module parameter of usbcore controls the default
for the authorized_default variable of each USB host controller.
-1 is authorized for all devices except wireless (default, old behaviour)
0 is unauthorized for all devices
1 is authorized for all devices
Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/usb/core/hcd.c')
-rw-r--r-- | drivers/usb/core/hcd.c | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/drivers/usb/core/hcd.c b/drivers/usb/core/hcd.c index ace9f8442e5d..8669ba3fe794 100644 --- a/drivers/usb/core/hcd.c +++ b/drivers/usb/core/hcd.c @@ -337,6 +337,17 @@ static const u8 ss_rh_config_descriptor[] = { 0x02, 0x00 /* __le16 ss_wBytesPerInterval; 15 bits for max 15 ports */ }; +/* authorized_default behaviour: + * -1 is authorized for all devices except wireless (old behaviour) + * 0 is unauthorized for all devices + * 1 is authorized for all devices + */ +static int authorized_default = -1; +module_param(authorized_default, int, S_IRUGO|S_IWUSR); +MODULE_PARM_DESC(authorized_default, + "Default USB device authorization: 0 is not authorized, 1 is " + "authorized, -1 is authorized except for wireless USB (default, " + "old behaviour"); /*-------------------------------------------------------------------------*/ /** @@ -2371,7 +2382,11 @@ int usb_add_hcd(struct usb_hcd *hcd, dev_info(hcd->self.controller, "%s\n", hcd->product_desc); - hcd->authorized_default = hcd->wireless? 0 : 1; + /* Keep old behaviour if authorized_default is not in [0, 1]. */ + if (authorized_default < 0 || authorized_default > 1) + hcd->authorized_default = hcd->wireless? 0 : 1; + else + hcd->authorized_default = authorized_default; set_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags); /* HC is in reset state, but accessible. Now do the one-time init, |