Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

usb/misc/usbled: Add Riso Kagaku Webmail Notifier

Add support for the "Webmail Notifier" (USB powered LED for signaling
new emails) made by Riso Kagaku Corp. which displays 7 distinct colors.

USB Protocol initially reverse engineered by
https://code.google.com/p/usbmailnotifier/.

Signed-off-by: Christian Vogel <vogelchr@vogel.cx>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Christian Vogel and committed by
Greg Kroah-Hartman
e8fcbb61 ea17c7c6

+34
+34
drivers/usb/misc/usbled.c
··· 22 22 enum led_type { 23 23 DELCOM_VISUAL_SIGNAL_INDICATOR, 24 24 DREAM_CHEEKY_WEBMAIL_NOTIFIER, 25 + RISO_KAGAKU_LED 25 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)] 26 45 27 46 /* table of devices that work with this driver */ 28 47 static const struct usb_device_id id_table[] = { ··· 51 32 .driver_info = DREAM_CHEEKY_WEBMAIL_NOTIFIER }, 52 33 { USB_DEVICE(0x1d34, 0x000a), 53 34 .driver_info = DREAM_CHEEKY_WEBMAIL_NOTIFIER }, 35 + { USB_DEVICE(0x1294, 0x1320), 36 + .driver_info = RISO_KAGAKU_LED }, 54 37 { }, 55 38 }; 56 39 MODULE_DEVICE_TABLE(usb, id_table); ··· 69 48 { 70 49 int retval = 0; 71 50 unsigned char *buffer; 51 + int actlength; 72 52 73 53 buffer = kmalloc(8, GFP_KERNEL); 74 54 if (!buffer) { ··· 124 102 buffer, 125 103 8, 126 104 2000); 105 + break; 106 + 107 + case RISO_KAGAKU_LED: 108 + buffer[0] = RISO_KAGAKU_IX(led->red, led->green, led->blue); 109 + buffer[1] = 0; 110 + buffer[2] = 0; 111 + buffer[3] = 0; 112 + buffer[4] = 0; 113 + 114 + retval = usb_interrupt_msg(led->udev, 115 + usb_sndctrlpipe(led->udev, 2), 116 + buffer, 5, &actlength, 1000 /*ms timeout*/); 127 117 break; 128 118 129 119 default: