--- zzzz-none-000/linux-2.6.28.10/drivers/usb/core/sysfs.c 2009-05-02 18:54:43.000000000 +0000 +++ puma5-6360-529/linux-2.6.28.10/drivers/usb/core/sysfs.c 2011-10-18 13:17:13.000000000 +0000 @@ -509,6 +509,69 @@ usb_dev_authorized_show, usb_dev_authorized_store); +#if 1 /* == 20111018 AVM/WK Extension: prevent probing for a device */ + +/* show if probing is allowed (0) or not allowed (1) for the device */ +static ssize_t usb_dev_noprobe_show(struct device *dev, + struct device_attribute *attr, + char *buf) +{ + struct usb_device *usb_dev = to_usb_device(dev); + return snprintf(buf, PAGE_SIZE, "%u\n", usb_dev->noprobe); +} + +/* + * Prevent probing for a device + * (configures or deconfigures the device as a side effect) + * + * Writing a 0 allows probing and reconfigures the device + * writing a 1 prevents probing and unconfigures the device it + * + */ +static ssize_t usb_dev_noprobe_store(struct device *dev, + struct device_attribute *attr, + const char *buf, size_t size) +{ + ssize_t result; + struct usb_device *usb_dev = to_usb_device(dev); + unsigned val; + result = sscanf(buf, "%u\n", &val); + if (result != 1) + result = -EINVAL; + else { + usb_lock_device(usb_dev); + if (val == 0) { + int c,err; + usb_dev->noprobe = 0; + c = usb_choose_configuration(usb_dev); + if (c >= 0) { + err = usb_set_configuration(usb_dev, c); + if (err) { + dev_err(&usb_dev->dev, + "can't set config #%d, error %d\n", c, err); + /* This need not be fatal. The user can try to + * set other configurations. */ + } + } + } else { + if (val == 2) { + usb_dev->noprobe = 1; + usb_set_configuration(usb_dev, -1); + usb_reset_device(usb_dev); + } else { + usb_dev->noprobe = 1; + usb_set_configuration(usb_dev, -1); + } + } + usb_unlock_device(usb_dev); + } + return result < 0? result : size; +} + +static DEVICE_ATTR(noprobe, 0644, + usb_dev_noprobe_show, usb_dev_noprobe_store); +#endif + static struct attribute *dev_attrs[] = { /* current configuration's attributes */ &dev_attr_configuration.attr, @@ -533,6 +596,11 @@ &dev_attr_maxchild.attr, &dev_attr_quirks.attr, &dev_attr_authorized.attr, +#if 1 /* AVM/WK Extension */ + &dev_attr_noprobe.attr, + +#endif + NULL, }; static struct attribute_group dev_attr_grp = {