diff options
Diffstat (limited to 'drivers/usb/misc/usbled.c')
-rw-r--r-- | drivers/usb/misc/usbled.c | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/drivers/usb/misc/usbled.c b/drivers/usb/misc/usbled.c index 78eb4ff33269..bdef0d6eb91d 100644 --- a/drivers/usb/misc/usbled.c +++ b/drivers/usb/misc/usbled.c | |||
@@ -22,8 +22,27 @@ | |||
22 | enum led_type { | 22 | enum led_type { |
23 | DELCOM_VISUAL_SIGNAL_INDICATOR, | 23 | DELCOM_VISUAL_SIGNAL_INDICATOR, |
24 | DREAM_CHEEKY_WEBMAIL_NOTIFIER, | 24 | DREAM_CHEEKY_WEBMAIL_NOTIFIER, |
25 | RISO_KAGAKU_LED | ||
25 | }; | 26 | }; |
26 | 27 | ||
28 | /* the Webmail LED made by RISO KAGAKU CORP. decodes a color index | ||
29 | internally, we want to keep the red+green+blue sysfs api, so we decode | ||
30 | from 1-bit RGB to the riso kagaku color index according to this table... */ | ||
31 | |||
32 | static unsigned const char riso_kagaku_tbl[] = { | ||
33 | /* R+2G+4B -> riso kagaku color index */ | ||
34 | [0] = 0, /* black */ | ||
35 | [1] = 2, /* red */ | ||
36 | [2] = 1, /* green */ | ||
37 | [3] = 5, /* yellow */ | ||
38 | [4] = 3, /* blue */ | ||
39 | [5] = 6, /* magenta */ | ||
40 | [6] = 4, /* cyan */ | ||
41 | [7] = 7 /* white */ | ||
42 | }; | ||
43 | |||
44 | #define RISO_KAGAKU_IX(r,g,b) riso_kagaku_tbl[((r)?1:0)+((g)?2:0)+((b)?4:0)] | ||
45 | |||
27 | /* table of devices that work with this driver */ | 46 | /* table of devices that work with this driver */ |
28 | static const struct usb_device_id id_table[] = { | 47 | static const struct usb_device_id id_table[] = { |
29 | { USB_DEVICE(0x0fc5, 0x1223), | 48 | { USB_DEVICE(0x0fc5, 0x1223), |
@@ -32,6 +51,8 @@ static const struct usb_device_id id_table[] = { | |||
32 | .driver_info = DREAM_CHEEKY_WEBMAIL_NOTIFIER }, | 51 | .driver_info = DREAM_CHEEKY_WEBMAIL_NOTIFIER }, |
33 | { USB_DEVICE(0x1d34, 0x000a), | 52 | { USB_DEVICE(0x1d34, 0x000a), |
34 | .driver_info = DREAM_CHEEKY_WEBMAIL_NOTIFIER }, | 53 | .driver_info = DREAM_CHEEKY_WEBMAIL_NOTIFIER }, |
54 | { USB_DEVICE(0x1294, 0x1320), | ||
55 | .driver_info = RISO_KAGAKU_LED }, | ||
35 | { }, | 56 | { }, |
36 | }; | 57 | }; |
37 | MODULE_DEVICE_TABLE(usb, id_table); | 58 | MODULE_DEVICE_TABLE(usb, id_table); |
@@ -48,6 +69,7 @@ static void change_color(struct usb_led *led) | |||
48 | { | 69 | { |
49 | int retval = 0; | 70 | int retval = 0; |
50 | unsigned char *buffer; | 71 | unsigned char *buffer; |
72 | int actlength; | ||
51 | 73 | ||
52 | buffer = kmalloc(8, GFP_KERNEL); | 74 | buffer = kmalloc(8, GFP_KERNEL); |
53 | if (!buffer) { | 75 | if (!buffer) { |
@@ -104,6 +126,18 @@ static void change_color(struct usb_led *led) | |||
104 | 2000); | 126 | 2000); |
105 | break; | 127 | break; |
106 | 128 | ||
129 | case RISO_KAGAKU_LED: | ||
130 | buffer[0] = RISO_KAGAKU_IX(led->red, led->green, led->blue); | ||
131 | buffer[1] = 0; | ||
132 | buffer[2] = 0; | ||
133 | buffer[3] = 0; | ||
134 | buffer[4] = 0; | ||
135 | |||
136 | retval = usb_interrupt_msg(led->udev, | ||
137 | usb_sndctrlpipe(led->udev, 2), | ||
138 | buffer, 5, &actlength, 1000 /*ms timeout*/); | ||
139 | break; | ||
140 | |||
107 | default: | 141 | default: |
108 | dev_err(&led->udev->dev, "unknown device type %d\n", led->type); | 142 | dev_err(&led->udev->dev, "unknown device type %d\n", led->type); |
109 | } | 143 | } |