From 5234ce1b02ae2574098ebe9839dcf241076a9367 Mon Sep 17 00:00:00 2001 From: Inaky Perez-Gonzalez Date: Tue, 31 Jul 2007 20:33:58 -0700 Subject: usb: add the concept of default authorization to USB hosts This introduces /sys/bus/devices/usb*/authorized_default; it dictates what is going to be the default authorization state for devices connected to the host. User space can set that using the sysfs file. We hook to the root hub instead of to the device controller as it is quite easy to get to it in sysfs from the device structure (device 5-4.3 is usb5) vs. backtracking to the controller device. By default it is set to be 'authorized' (!0) for normal, wired USB devices and 'unauthorized' (0) for Wireless USB devices. As suggested by Adrian Bunk, make authorized_default static Signed-off-by: Inaky Perez-Gonzalez Signed-off-by: Greg Kroah-Hartman --- drivers/usb/core/hcd.h | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'drivers/usb/core/hcd.h') diff --git a/drivers/usb/core/hcd.h b/drivers/usb/core/hcd.h index b5ebb73c233..8683142e70e 100644 --- a/drivers/usb/core/hcd.h +++ b/drivers/usb/core/hcd.h @@ -51,6 +51,12 @@ * * Since "struct usb_bus" is so thin, you can't share much code in it. * This framework is a layer over that, and should be more sharable. + * + * @authorized_default: Specifies if new devices are authorized to + * connect by default or they require explicit + * user space authorization; this bit is settable + * through /sys/class/usb_host/X/authorized_default. + * For the rest is RO, so we don't lock to r/w it. */ /*-------------------------------------------------------------------------*/ @@ -90,6 +96,7 @@ struct usb_hcd { unsigned poll_rh:1; /* poll for rh status? */ unsigned poll_pending:1; /* status has changed? */ unsigned wireless:1; /* Wireless USB HCD */ + unsigned authorized_default:1; int irq; /* irq allocated */ void __iomem *regs; /* device memory/io */ -- cgit v1.2.3