Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 227042
b: refs/heads/master
c: 73bc7d3
h: refs/heads/master
v: v3
  • Loading branch information
Melchior FRANZ authored and Greg Kroah-Hartman committed Dec 22, 2010
1 parent 58d8ef9 commit b4966e8
Show file tree
Hide file tree
Showing 4 changed files with 94 additions and 29 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: c466cd2bb9cee2e576fc9663b828f51e322d7b4b
refs/heads/master: 73bc7d315f56e260071bdb5f15e25b53bddc1402
1 change: 1 addition & 0 deletions trunk/drivers/hid/hid-core.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) },
Expand Down
2 changes: 2 additions & 0 deletions trunk/drivers/hid/hid-ids.h
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
118 changes: 90 additions & 28 deletions trunk/drivers/usb/misc/usbled.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* USB LED driver - 1.1
* USB LED driver
*
* Copyright (C) 2004 Greg Kroah-Hartman (greg@kroah.com)
*
Expand All @@ -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);
Expand All @@ -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);
Expand All @@ -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);
Expand Down Expand Up @@ -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);

Expand All @@ -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;

Expand Down

0 comments on commit b4966e8

Please sign in to comment.