diff options
-rw-r--r-- | drivers/hid/hid-core.c | 1 | ||||
-rw-r--r-- | drivers/hid/hid-ids.h | 2 | ||||
-rw-r--r-- | drivers/usb/misc/usbled.c | 118 |
3 files changed, 93 insertions, 28 deletions
diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c index 88cb04e..ed1adc2 100644 --- a/drivers/hid/hid-core.c +++ b/drivers/hid/hid-core.c @@ -1604,6 +1604,7 @@ static const struct hid_device_id hid_ignore_list[] = { { HID_USB_DEVICE(USB_VENDOR_ID_DEALEXTREAME, USB_DEVICE_ID_DEALEXTREAME_RADIO_SI4701) }, { HID_USB_DEVICE(USB_VENDOR_ID_DELORME, USB_DEVICE_ID_DELORME_EARTHMATE) }, { HID_USB_DEVICE(USB_VENDOR_ID_DELORME, USB_DEVICE_ID_DELORME_EM_LT20) }, + { HID_USB_DEVICE(USB_VENDOR_ID_DREAM_CHEEKY, 0x0004) }, { HID_USB_DEVICE(USB_VENDOR_ID_ESSENTIAL_REALITY, USB_DEVICE_ID_ESSENTIAL_REALITY_P5) }, { HID_USB_DEVICE(USB_VENDOR_ID_ETT, USB_DEVICE_ID_TC5UH) }, { HID_USB_DEVICE(USB_VENDOR_ID_ETT, USB_DEVICE_ID_TC4UM) }, diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h index 3341baa..5a559de 100644 --- a/drivers/hid/hid-ids.h +++ b/drivers/hid/hid-ids.h @@ -200,6 +200,8 @@ #define USB_VENDOR_ID_ELECOM 0x056e #define USB_DEVICE_ID_ELECOM_BM084 0x0061 +#define USB_VENDOR_ID_DREAM_CHEEKY 0x1d34 + #define USB_VENDOR_ID_ELO 0x04E7 #define USB_DEVICE_ID_ELO_TS2700 0x0020 diff --git a/drivers/usb/misc/usbled.c b/drivers/usb/misc/usbled.c index c96f51d..1732d9b 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); @@ -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; |