diff options
Diffstat (limited to 'drivers/usb/misc')
-rw-r--r-- | drivers/usb/misc/cypress_cy7c63.c | 6 | ||||
-rw-r--r-- | drivers/usb/misc/trancevibrator.c | 2 | ||||
-rw-r--r-- | drivers/usb/misc/usbled.c | 120 | ||||
-rw-r--r-- | drivers/usb/misc/usbsevseg.c | 10 | ||||
-rw-r--r-- | drivers/usb/misc/uss720.c | 4 | ||||
-rw-r--r-- | drivers/usb/misc/yurex.c | 1 |
6 files changed, 102 insertions, 41 deletions
diff --git a/drivers/usb/misc/cypress_cy7c63.c b/drivers/usb/misc/cypress_cy7c63.c index 2f43c57743c..9251773ecef 100644 --- a/drivers/usb/misc/cypress_cy7c63.c +++ b/drivers/usb/misc/cypress_cy7c63.c @@ -196,11 +196,9 @@ static ssize_t get_port1_handler(struct device *dev, return read_port(dev, attr, buf, 1, CYPRESS_READ_PORT_ID1); } -static DEVICE_ATTR(port0, S_IWUGO | S_IRUGO, - get_port0_handler, set_port0_handler); +static DEVICE_ATTR(port0, S_IRUGO | S_IWUSR, get_port0_handler, set_port0_handler); -static DEVICE_ATTR(port1, S_IWUGO | S_IRUGO, - get_port1_handler, set_port1_handler); +static DEVICE_ATTR(port1, S_IRUGO | S_IWUSR, get_port1_handler, set_port1_handler); static int cypress_probe(struct usb_interface *interface, diff --git a/drivers/usb/misc/trancevibrator.c b/drivers/usb/misc/trancevibrator.c index d77aba46ae8..f63776a48e2 100644 --- a/drivers/usb/misc/trancevibrator.c +++ b/drivers/usb/misc/trancevibrator.c @@ -86,7 +86,7 @@ static ssize_t set_speed(struct device *dev, struct device_attribute *attr, return count; } -static DEVICE_ATTR(speed, S_IWUGO | S_IRUGO, show_speed, set_speed); +static DEVICE_ATTR(speed, S_IRUGO | S_IWUSR, show_speed, set_speed); static int tv_probe(struct usb_interface *interface, const struct usb_device_id *id) diff --git a/drivers/usb/misc/usbled.c b/drivers/usb/misc/usbled.c index 63da2c3c838..1732d9bc097 100644 --- a/drivers/usb/misc/usbled.c +++ b/drivers/usb/misc/usbled.c @@ -1,5 +1,5 @@ /* - * USB LED driver - 1.1 + * USB LED driver * * Copyright (C) 2004 Greg Kroah-Hartman (greg@kroah.com) * @@ -20,12 +20,17 @@ #define DRIVER_AUTHOR "Greg Kroah-Hartman, greg@kroah.com" #define DRIVER_DESC "USB LED Driver" -#define VENDOR_ID 0x0fc5 -#define PRODUCT_ID 0x1223 +enum led_type { + DELCOM_VISUAL_SIGNAL_INDICATOR, + DREAM_CHEEKY_WEBMAIL_NOTIFIER, +}; /* table of devices that work with this driver */ static const struct usb_device_id id_table[] = { - { USB_DEVICE(VENDOR_ID, PRODUCT_ID) }, + { USB_DEVICE(0x0fc5, 0x1223), + .driver_info = DELCOM_VISUAL_SIGNAL_INDICATOR }, + { USB_DEVICE(0x1d34, 0x0004), + .driver_info = DREAM_CHEEKY_WEBMAIL_NOTIFIER }, { }, }; MODULE_DEVICE_TABLE (usb, id_table); @@ -35,15 +40,12 @@ struct usb_led { unsigned char blue; unsigned char red; unsigned char green; + enum led_type type; }; -#define BLUE 0x04 -#define RED 0x02 -#define GREEN 0x01 static void change_color(struct usb_led *led) { int retval; - unsigned char color = 0x07; unsigned char *buffer; buffer = kmalloc(8, GFP_KERNEL); @@ -52,25 +54,59 @@ static void change_color(struct usb_led *led) return; } - if (led->blue) - color &= ~(BLUE); - if (led->red) - color &= ~(RED); - if (led->green) - color &= ~(GREEN); - dev_dbg(&led->udev->dev, - "blue = %d, red = %d, green = %d, color = %.2x\n", - led->blue, led->red, led->green, color); - - retval = usb_control_msg(led->udev, - usb_sndctrlpipe(led->udev, 0), - 0x12, - 0xc8, - (0x02 * 0x100) + 0x0a, - (0x00 * 0x100) + color, - buffer, - 8, - 2000); + switch (led->type) { + case DELCOM_VISUAL_SIGNAL_INDICATOR: { + unsigned char color = 0x07; + + if (led->blue) + color &= ~0x04; + if (led->red) + color &= ~0x02; + if (led->green) + color &= ~0x01; + dev_dbg(&led->udev->dev, + "blue = %d, red = %d, green = %d, color = %.2x\n", + led->blue, led->red, led->green, color); + + retval = usb_control_msg(led->udev, + usb_sndctrlpipe(led->udev, 0), + 0x12, + 0xc8, + (0x02 * 0x100) + 0x0a, + (0x00 * 0x100) + color, + buffer, + 8, + 2000); + break; + } + + case DREAM_CHEEKY_WEBMAIL_NOTIFIER: + dev_dbg(&led->udev->dev, + "red = %d, green = %d, blue = %d\n", + led->red, led->green, led->blue); + + buffer[0] = led->red; + buffer[1] = led->green; + buffer[2] = led->blue; + buffer[3] = buffer[4] = buffer[5] = 0; + buffer[6] = 0x1a; + buffer[7] = 0x05; + + retval = usb_control_msg(led->udev, + usb_sndctrlpipe(led->udev, 0), + 0x09, + 0x21, + 0x200, + 0, + buffer, + 8, + 2000); + break; + + default: + dev_err(&led->udev->dev, "unknown device type %d\n", led->type); + } + if (retval) dev_dbg(&led->udev->dev, "retval = %d\n", retval); kfree(buffer); @@ -94,7 +130,7 @@ static ssize_t set_##value(struct device *dev, struct device_attribute *attr, co change_color(led); \ return count; \ } \ -static DEVICE_ATTR(value, S_IWUGO | S_IRUGO, show_##value, set_##value); +static DEVICE_ATTR(value, S_IRUGO | S_IWUSR, show_##value, set_##value); show_set(blue); show_set(red); show_set(green); @@ -107,11 +143,12 @@ static int led_probe(struct usb_interface *interface, const struct usb_device_id dev = kzalloc(sizeof(struct usb_led), GFP_KERNEL); if (dev == NULL) { - dev_err(&interface->dev, "Out of memory\n"); + dev_err(&interface->dev, "out of memory\n"); goto error_mem; } dev->udev = usb_get_dev(udev); + dev->type = id->driver_info; usb_set_intfdata (interface, dev); @@ -125,6 +162,31 @@ static int led_probe(struct usb_interface *interface, const struct usb_device_id if (retval) goto error; + if (dev->type == DREAM_CHEEKY_WEBMAIL_NOTIFIER) { + unsigned char *enable; + + enable = kmemdup("\x1f\x02\0\x5f\0\0\x1a\x03", 8, GFP_KERNEL); + if (!enable) { + dev_err(&interface->dev, "out of memory\n"); + retval = -ENOMEM; + goto error; + } + + retval = usb_control_msg(udev, + usb_sndctrlpipe(udev, 0), + 0x09, + 0x21, + 0x200, + 0, + enable, + 8, + 2000); + + kfree(enable); + if (retval != 8) + goto error; + } + dev_info(&interface->dev, "USB LED device now attached\n"); return 0; diff --git a/drivers/usb/misc/usbsevseg.c b/drivers/usb/misc/usbsevseg.c index de8ef945b53..417b8f207e8 100644 --- a/drivers/usb/misc/usbsevseg.c +++ b/drivers/usb/misc/usbsevseg.c @@ -192,7 +192,7 @@ static ssize_t set_attr_##name(struct device *dev, \ \ return count; \ } \ -static DEVICE_ATTR(name, S_IWUGO | S_IRUGO, show_attr_##name, set_attr_##name); +static DEVICE_ATTR(name, S_IRUGO | S_IWUSR, show_attr_##name, set_attr_##name); static ssize_t show_attr_text(struct device *dev, struct device_attribute *attr, char *buf) @@ -223,7 +223,7 @@ static ssize_t set_attr_text(struct device *dev, return count; } -static DEVICE_ATTR(text, S_IWUGO | S_IRUGO, show_attr_text, set_attr_text); +static DEVICE_ATTR(text, S_IRUGO | S_IWUSR, show_attr_text, set_attr_text); static ssize_t show_attr_decimals(struct device *dev, struct device_attribute *attr, char *buf) @@ -272,8 +272,7 @@ static ssize_t set_attr_decimals(struct device *dev, return count; } -static DEVICE_ATTR(decimals, S_IWUGO | S_IRUGO, - show_attr_decimals, set_attr_decimals); +static DEVICE_ATTR(decimals, S_IRUGO | S_IWUSR, show_attr_decimals, set_attr_decimals); static ssize_t show_attr_textmode(struct device *dev, struct device_attribute *attr, char *buf) @@ -319,8 +318,7 @@ static ssize_t set_attr_textmode(struct device *dev, return -EINVAL; } -static DEVICE_ATTR(textmode, S_IWUGO | S_IRUGO, - show_attr_textmode, set_attr_textmode); +static DEVICE_ATTR(textmode, S_IRUGO | S_IWUSR, show_attr_textmode, set_attr_textmode); MYDEV_ATTR_SIMPLE_UNSIGNED(powered, update_display_powered); diff --git a/drivers/usb/misc/uss720.c b/drivers/usb/misc/uss720.c index 796e2f68f74..4ff21587ab0 100644 --- a/drivers/usb/misc/uss720.c +++ b/drivers/usb/misc/uss720.c @@ -3,7 +3,7 @@ /* * uss720.c -- USS720 USB Parport Cable. * - * Copyright (C) 1999, 2005 + * Copyright (C) 1999, 2005, 2010 * Thomas Sailer (t.sailer@alumni.ethz.ch) * * This program is free software; you can redistribute it and/or modify @@ -776,6 +776,8 @@ static const struct usb_device_id uss720_table[] = { { USB_DEVICE(0x0557, 0x2001) }, { USB_DEVICE(0x0729, 0x1284) }, { USB_DEVICE(0x1293, 0x0002) }, + { USB_DEVICE(0x1293, 0x0002) }, + { USB_DEVICE(0x050d, 0x0002) }, { } /* Terminating entry */ }; diff --git a/drivers/usb/misc/yurex.c b/drivers/usb/misc/yurex.c index 719c6180b31..ac5bfd619e6 100644 --- a/drivers/usb/misc/yurex.c +++ b/drivers/usb/misc/yurex.c @@ -536,6 +536,7 @@ static const struct file_operations yurex_fops = { .open = yurex_open, .release = yurex_release, .fasync = yurex_fasync, + .llseek = default_llseek, }; |