On 06/12/2015 02:33 PM, Stefan Koch wrote:
To allow (1) or deny (0) interfaces it is needed to write to the mask. As default each bit has the initial value of the default authorization bit. The value would showed or have to be written in hexadecimal format. Entry: /sys/bus/usb/devices/*-*/interface_authorization_mask Example: Only the interfaces 0 and 2 from device at 3-2 should allowed, the others should be denied. echo 5 > /sys/bus/usb/devices/3-2/interface_authorization_mask Signed-off-by: Stefan Koch <skoch@xxxxxxx> --- drivers/usb/core/sysfs.c | 71 +++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 70 insertions(+), 1 deletion(-) diff --git a/drivers/usb/core/sysfs.c b/drivers/usb/core/sysfs.c index d269738..afa0799e 100644 --- a/drivers/usb/core/sysfs.c +++ b/drivers/usb/core/sysfs.c @@ -622,7 +622,6 @@ usb_descriptor_attr(bDeviceProtocol, "%02x\n"); usb_descriptor_attr(bNumConfigurations, "%d\n"); usb_descriptor_attr(bMaxPacketSize0, "%d\n"); - /* show if the device is authorized (1) or not (0) */ static ssize_t authorized_show(struct device *dev, struct device_attribute *attr, char *buf) @@ -655,6 +654,74 @@ static ssize_t authorized_store(struct device *dev, static DEVICE_ATTR_IGNORE_LOCKDEP(authorized, S_IRUGO | S_IWUSR, authorized_show, authorized_store); +/* + * show authorization status of usb interface as bitmask + * 1 is authorized, 0 is not authorized + * + * example: 0b00000101 interfaces 0 and 2 are authorized + * the others are not authorized + */
Why do you need so complicated bit mask attribute in device dir instead of just a simple "authorized" attribute in interface directory?
Best regards, -- Krzysztof Opasiak Samsung R&D Institute Poland Samsung Electronics -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html