2005-04-17 05:20:36 +07:00
|
|
|
/*
|
USB: add support for Dream Cheeky DL100B Webmail Notifier (1d34:0004)
So far the USBLED driver only supports Delcom's "USB Visual Signal
Indicator" (http://www.delcomproducts.com/products_USBLMP.asp). The
driver generates virtual files "red", "green", and "blue" under the
device's /sys/ directory, where color values can be read from and
written to.
This patch adds support for Dream Cheeky's "DL100B Webmail Notifier"
(http://www.dreamcheeky.com/webmail-notifier -- available from several
shops, such as http://www.conrad.at/ce/de/product/777048/USB-WEBMAIL).
This device isn't as pretty as Delcom's, but it's *far* cheaper, and
its 3 LEDs can be set in 32 brightness steps each. The grey envelope
contour can easily be removed, leaving a rather neutral white box (with
a few small holes), which is useful for generic signalling purposes.
Of course, the small circuit board can easily be put into a prettier
case.
The DL100B device pretends to be a HID, but the HID descriptor shows
that it's not overly useful as such (see below). The patch therefore
removes the "HID-ness" (hid-core.c, hid-ids.h), and adds the necessary
commands to usbled.c. The protocol info comes from the developer's
manual that Dream Cheeky kindly provided (815DeveloperManual.pdf).
HID descriptor:
0: 05 01 Usage Page 'Generic Desktop Controls'
2: 09 10 Usage 'Reserved'
4: a1 01 Collection 'Application (mouse, keyboard)'
6: 05 00 Usage Page 'Undefined'
8: 19 10 Usage Minimum = 16
10: 29 11 Usage Maximum = 17
12: 15 00 Logical Minimum = 0
14: 25 0f Logical Maximum = 15
16: 75 08 Report Size = 8
18: 95 08 Report Count = 8
20: 91 02 Output data *var abs lin pref-state null-pos non-vol bit-field
22: 19 10 Usage Minimum = 16
24: 29 11 Usage Maximum = 17
26: 15 00 Logical Minimum = 0
28: 25 0f Logical Maximum = 15
30: 75 08 Report Size = 8
32: 95 08 Report Count = 8
34: 81 00 Input data array abs lin pref-state null-pos non-vol bit-field
36: c0 End Collection
Signed-off-by: Melchior FRANZ <mfranz@aon.at>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2010-12-22 08:04:33 +07:00
|
|
|
* USB LED driver
|
2005-04-17 05:20:36 +07:00
|
|
|
*
|
|
|
|
* Copyright (C) 2004 Greg Kroah-Hartman (greg@kroah.com)
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License as
|
|
|
|
* published by the Free Software Foundation, version 2.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <linux/kernel.h>
|
|
|
|
#include <linux/errno.h>
|
|
|
|
#include <linux/init.h>
|
|
|
|
#include <linux/slab.h>
|
|
|
|
#include <linux/module.h>
|
|
|
|
#include <linux/usb.h>
|
|
|
|
|
|
|
|
|
|
|
|
#define DRIVER_AUTHOR "Greg Kroah-Hartman, greg@kroah.com"
|
|
|
|
#define DRIVER_DESC "USB LED Driver"
|
|
|
|
|
USB: add support for Dream Cheeky DL100B Webmail Notifier (1d34:0004)
So far the USBLED driver only supports Delcom's "USB Visual Signal
Indicator" (http://www.delcomproducts.com/products_USBLMP.asp). The
driver generates virtual files "red", "green", and "blue" under the
device's /sys/ directory, where color values can be read from and
written to.
This patch adds support for Dream Cheeky's "DL100B Webmail Notifier"
(http://www.dreamcheeky.com/webmail-notifier -- available from several
shops, such as http://www.conrad.at/ce/de/product/777048/USB-WEBMAIL).
This device isn't as pretty as Delcom's, but it's *far* cheaper, and
its 3 LEDs can be set in 32 brightness steps each. The grey envelope
contour can easily be removed, leaving a rather neutral white box (with
a few small holes), which is useful for generic signalling purposes.
Of course, the small circuit board can easily be put into a prettier
case.
The DL100B device pretends to be a HID, but the HID descriptor shows
that it's not overly useful as such (see below). The patch therefore
removes the "HID-ness" (hid-core.c, hid-ids.h), and adds the necessary
commands to usbled.c. The protocol info comes from the developer's
manual that Dream Cheeky kindly provided (815DeveloperManual.pdf).
HID descriptor:
0: 05 01 Usage Page 'Generic Desktop Controls'
2: 09 10 Usage 'Reserved'
4: a1 01 Collection 'Application (mouse, keyboard)'
6: 05 00 Usage Page 'Undefined'
8: 19 10 Usage Minimum = 16
10: 29 11 Usage Maximum = 17
12: 15 00 Logical Minimum = 0
14: 25 0f Logical Maximum = 15
16: 75 08 Report Size = 8
18: 95 08 Report Count = 8
20: 91 02 Output data *var abs lin pref-state null-pos non-vol bit-field
22: 19 10 Usage Minimum = 16
24: 29 11 Usage Maximum = 17
26: 15 00 Logical Minimum = 0
28: 25 0f Logical Maximum = 15
30: 75 08 Report Size = 8
32: 95 08 Report Count = 8
34: 81 00 Input data array abs lin pref-state null-pos non-vol bit-field
36: c0 End Collection
Signed-off-by: Melchior FRANZ <mfranz@aon.at>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2010-12-22 08:04:33 +07:00
|
|
|
enum led_type {
|
|
|
|
DELCOM_VISUAL_SIGNAL_INDICATOR,
|
|
|
|
DREAM_CHEEKY_WEBMAIL_NOTIFIER,
|
|
|
|
};
|
2005-04-17 05:20:36 +07:00
|
|
|
|
|
|
|
/* table of devices that work with this driver */
|
2010-01-10 21:34:45 +07:00
|
|
|
static const struct usb_device_id id_table[] = {
|
USB: add support for Dream Cheeky DL100B Webmail Notifier (1d34:0004)
So far the USBLED driver only supports Delcom's "USB Visual Signal
Indicator" (http://www.delcomproducts.com/products_USBLMP.asp). The
driver generates virtual files "red", "green", and "blue" under the
device's /sys/ directory, where color values can be read from and
written to.
This patch adds support for Dream Cheeky's "DL100B Webmail Notifier"
(http://www.dreamcheeky.com/webmail-notifier -- available from several
shops, such as http://www.conrad.at/ce/de/product/777048/USB-WEBMAIL).
This device isn't as pretty as Delcom's, but it's *far* cheaper, and
its 3 LEDs can be set in 32 brightness steps each. The grey envelope
contour can easily be removed, leaving a rather neutral white box (with
a few small holes), which is useful for generic signalling purposes.
Of course, the small circuit board can easily be put into a prettier
case.
The DL100B device pretends to be a HID, but the HID descriptor shows
that it's not overly useful as such (see below). The patch therefore
removes the "HID-ness" (hid-core.c, hid-ids.h), and adds the necessary
commands to usbled.c. The protocol info comes from the developer's
manual that Dream Cheeky kindly provided (815DeveloperManual.pdf).
HID descriptor:
0: 05 01 Usage Page 'Generic Desktop Controls'
2: 09 10 Usage 'Reserved'
4: a1 01 Collection 'Application (mouse, keyboard)'
6: 05 00 Usage Page 'Undefined'
8: 19 10 Usage Minimum = 16
10: 29 11 Usage Maximum = 17
12: 15 00 Logical Minimum = 0
14: 25 0f Logical Maximum = 15
16: 75 08 Report Size = 8
18: 95 08 Report Count = 8
20: 91 02 Output data *var abs lin pref-state null-pos non-vol bit-field
22: 19 10 Usage Minimum = 16
24: 29 11 Usage Maximum = 17
26: 15 00 Logical Minimum = 0
28: 25 0f Logical Maximum = 15
30: 75 08 Report Size = 8
32: 95 08 Report Count = 8
34: 81 00 Input data array abs lin pref-state null-pos non-vol bit-field
36: c0 End Collection
Signed-off-by: Melchior FRANZ <mfranz@aon.at>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2010-12-22 08:04:33 +07:00
|
|
|
{ USB_DEVICE(0x0fc5, 0x1223),
|
|
|
|
.driver_info = DELCOM_VISUAL_SIGNAL_INDICATOR },
|
|
|
|
{ USB_DEVICE(0x1d34, 0x0004),
|
|
|
|
.driver_info = DREAM_CHEEKY_WEBMAIL_NOTIFIER },
|
2011-11-20 16:21:30 +07:00
|
|
|
{ USB_DEVICE(0x1d34, 0x000a),
|
|
|
|
.driver_info = DREAM_CHEEKY_WEBMAIL_NOTIFIER },
|
2005-04-17 05:20:36 +07:00
|
|
|
{ },
|
|
|
|
};
|
2011-07-29 14:17:57 +07:00
|
|
|
MODULE_DEVICE_TABLE(usb, id_table);
|
2005-04-17 05:20:36 +07:00
|
|
|
|
|
|
|
struct usb_led {
|
2011-07-29 14:17:57 +07:00
|
|
|
struct usb_device *udev;
|
2005-04-17 05:20:36 +07:00
|
|
|
unsigned char blue;
|
|
|
|
unsigned char red;
|
|
|
|
unsigned char green;
|
USB: add support for Dream Cheeky DL100B Webmail Notifier (1d34:0004)
So far the USBLED driver only supports Delcom's "USB Visual Signal
Indicator" (http://www.delcomproducts.com/products_USBLMP.asp). The
driver generates virtual files "red", "green", and "blue" under the
device's /sys/ directory, where color values can be read from and
written to.
This patch adds support for Dream Cheeky's "DL100B Webmail Notifier"
(http://www.dreamcheeky.com/webmail-notifier -- available from several
shops, such as http://www.conrad.at/ce/de/product/777048/USB-WEBMAIL).
This device isn't as pretty as Delcom's, but it's *far* cheaper, and
its 3 LEDs can be set in 32 brightness steps each. The grey envelope
contour can easily be removed, leaving a rather neutral white box (with
a few small holes), which is useful for generic signalling purposes.
Of course, the small circuit board can easily be put into a prettier
case.
The DL100B device pretends to be a HID, but the HID descriptor shows
that it's not overly useful as such (see below). The patch therefore
removes the "HID-ness" (hid-core.c, hid-ids.h), and adds the necessary
commands to usbled.c. The protocol info comes from the developer's
manual that Dream Cheeky kindly provided (815DeveloperManual.pdf).
HID descriptor:
0: 05 01 Usage Page 'Generic Desktop Controls'
2: 09 10 Usage 'Reserved'
4: a1 01 Collection 'Application (mouse, keyboard)'
6: 05 00 Usage Page 'Undefined'
8: 19 10 Usage Minimum = 16
10: 29 11 Usage Maximum = 17
12: 15 00 Logical Minimum = 0
14: 25 0f Logical Maximum = 15
16: 75 08 Report Size = 8
18: 95 08 Report Count = 8
20: 91 02 Output data *var abs lin pref-state null-pos non-vol bit-field
22: 19 10 Usage Minimum = 16
24: 29 11 Usage Maximum = 17
26: 15 00 Logical Minimum = 0
28: 25 0f Logical Maximum = 15
30: 75 08 Report Size = 8
32: 95 08 Report Count = 8
34: 81 00 Input data array abs lin pref-state null-pos non-vol bit-field
36: c0 End Collection
Signed-off-by: Melchior FRANZ <mfranz@aon.at>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2010-12-22 08:04:33 +07:00
|
|
|
enum led_type type;
|
2005-04-17 05:20:36 +07:00
|
|
|
};
|
|
|
|
|
|
|
|
static void change_color(struct usb_led *led)
|
|
|
|
{
|
2010-12-22 19:55:24 +07:00
|
|
|
int retval = 0;
|
2005-04-17 05:20:36 +07:00
|
|
|
unsigned char *buffer;
|
|
|
|
|
|
|
|
buffer = kmalloc(8, GFP_KERNEL);
|
|
|
|
if (!buffer) {
|
|
|
|
dev_err(&led->udev->dev, "out of memory\n");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
USB: add support for Dream Cheeky DL100B Webmail Notifier (1d34:0004)
So far the USBLED driver only supports Delcom's "USB Visual Signal
Indicator" (http://www.delcomproducts.com/products_USBLMP.asp). The
driver generates virtual files "red", "green", and "blue" under the
device's /sys/ directory, where color values can be read from and
written to.
This patch adds support for Dream Cheeky's "DL100B Webmail Notifier"
(http://www.dreamcheeky.com/webmail-notifier -- available from several
shops, such as http://www.conrad.at/ce/de/product/777048/USB-WEBMAIL).
This device isn't as pretty as Delcom's, but it's *far* cheaper, and
its 3 LEDs can be set in 32 brightness steps each. The grey envelope
contour can easily be removed, leaving a rather neutral white box (with
a few small holes), which is useful for generic signalling purposes.
Of course, the small circuit board can easily be put into a prettier
case.
The DL100B device pretends to be a HID, but the HID descriptor shows
that it's not overly useful as such (see below). The patch therefore
removes the "HID-ness" (hid-core.c, hid-ids.h), and adds the necessary
commands to usbled.c. The protocol info comes from the developer's
manual that Dream Cheeky kindly provided (815DeveloperManual.pdf).
HID descriptor:
0: 05 01 Usage Page 'Generic Desktop Controls'
2: 09 10 Usage 'Reserved'
4: a1 01 Collection 'Application (mouse, keyboard)'
6: 05 00 Usage Page 'Undefined'
8: 19 10 Usage Minimum = 16
10: 29 11 Usage Maximum = 17
12: 15 00 Logical Minimum = 0
14: 25 0f Logical Maximum = 15
16: 75 08 Report Size = 8
18: 95 08 Report Count = 8
20: 91 02 Output data *var abs lin pref-state null-pos non-vol bit-field
22: 19 10 Usage Minimum = 16
24: 29 11 Usage Maximum = 17
26: 15 00 Logical Minimum = 0
28: 25 0f Logical Maximum = 15
30: 75 08 Report Size = 8
32: 95 08 Report Count = 8
34: 81 00 Input data array abs lin pref-state null-pos non-vol bit-field
36: c0 End Collection
Signed-off-by: Melchior FRANZ <mfranz@aon.at>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2010-12-22 08:04:33 +07:00
|
|
|
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);
|
|
|
|
}
|
|
|
|
|
2005-04-17 05:20:36 +07:00
|
|
|
if (retval)
|
|
|
|
dev_dbg(&led->udev->dev, "retval = %d\n", retval);
|
|
|
|
kfree(buffer);
|
|
|
|
}
|
|
|
|
|
|
|
|
#define show_set(value) \
|
2011-07-29 14:17:57 +07:00
|
|
|
static ssize_t show_##value(struct device *dev, struct device_attribute *attr,\
|
|
|
|
char *buf) \
|
2005-04-17 05:20:36 +07:00
|
|
|
{ \
|
|
|
|
struct usb_interface *intf = to_usb_interface(dev); \
|
|
|
|
struct usb_led *led = usb_get_intfdata(intf); \
|
|
|
|
\
|
|
|
|
return sprintf(buf, "%d\n", led->value); \
|
|
|
|
} \
|
2011-07-29 14:17:57 +07:00
|
|
|
static ssize_t set_##value(struct device *dev, struct device_attribute *attr,\
|
|
|
|
const char *buf, size_t count) \
|
2005-04-17 05:20:36 +07:00
|
|
|
{ \
|
|
|
|
struct usb_interface *intf = to_usb_interface(dev); \
|
|
|
|
struct usb_led *led = usb_get_intfdata(intf); \
|
|
|
|
int temp = simple_strtoul(buf, NULL, 10); \
|
|
|
|
\
|
|
|
|
led->value = temp; \
|
|
|
|
change_color(led); \
|
|
|
|
return count; \
|
|
|
|
} \
|
2010-11-16 02:35:49 +07:00
|
|
|
static DEVICE_ATTR(value, S_IRUGO | S_IWUSR, show_##value, set_##value);
|
2005-04-17 05:20:36 +07:00
|
|
|
show_set(blue);
|
|
|
|
show_set(red);
|
|
|
|
show_set(green);
|
|
|
|
|
2011-07-29 14:17:57 +07:00
|
|
|
static int led_probe(struct usb_interface *interface,
|
|
|
|
const struct usb_device_id *id)
|
2005-04-17 05:20:36 +07:00
|
|
|
{
|
|
|
|
struct usb_device *udev = interface_to_usbdev(interface);
|
|
|
|
struct usb_led *dev = NULL;
|
|
|
|
int retval = -ENOMEM;
|
|
|
|
|
2006-01-07 04:44:52 +07:00
|
|
|
dev = kzalloc(sizeof(struct usb_led), GFP_KERNEL);
|
2005-04-17 05:20:36 +07:00
|
|
|
if (dev == NULL) {
|
USB: add support for Dream Cheeky DL100B Webmail Notifier (1d34:0004)
So far the USBLED driver only supports Delcom's "USB Visual Signal
Indicator" (http://www.delcomproducts.com/products_USBLMP.asp). The
driver generates virtual files "red", "green", and "blue" under the
device's /sys/ directory, where color values can be read from and
written to.
This patch adds support for Dream Cheeky's "DL100B Webmail Notifier"
(http://www.dreamcheeky.com/webmail-notifier -- available from several
shops, such as http://www.conrad.at/ce/de/product/777048/USB-WEBMAIL).
This device isn't as pretty as Delcom's, but it's *far* cheaper, and
its 3 LEDs can be set in 32 brightness steps each. The grey envelope
contour can easily be removed, leaving a rather neutral white box (with
a few small holes), which is useful for generic signalling purposes.
Of course, the small circuit board can easily be put into a prettier
case.
The DL100B device pretends to be a HID, but the HID descriptor shows
that it's not overly useful as such (see below). The patch therefore
removes the "HID-ness" (hid-core.c, hid-ids.h), and adds the necessary
commands to usbled.c. The protocol info comes from the developer's
manual that Dream Cheeky kindly provided (815DeveloperManual.pdf).
HID descriptor:
0: 05 01 Usage Page 'Generic Desktop Controls'
2: 09 10 Usage 'Reserved'
4: a1 01 Collection 'Application (mouse, keyboard)'
6: 05 00 Usage Page 'Undefined'
8: 19 10 Usage Minimum = 16
10: 29 11 Usage Maximum = 17
12: 15 00 Logical Minimum = 0
14: 25 0f Logical Maximum = 15
16: 75 08 Report Size = 8
18: 95 08 Report Count = 8
20: 91 02 Output data *var abs lin pref-state null-pos non-vol bit-field
22: 19 10 Usage Minimum = 16
24: 29 11 Usage Maximum = 17
26: 15 00 Logical Minimum = 0
28: 25 0f Logical Maximum = 15
30: 75 08 Report Size = 8
32: 95 08 Report Count = 8
34: 81 00 Input data array abs lin pref-state null-pos non-vol bit-field
36: c0 End Collection
Signed-off-by: Melchior FRANZ <mfranz@aon.at>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2010-12-22 08:04:33 +07:00
|
|
|
dev_err(&interface->dev, "out of memory\n");
|
2006-08-29 01:43:25 +07:00
|
|
|
goto error_mem;
|
2005-04-17 05:20:36 +07:00
|
|
|
}
|
|
|
|
|
|
|
|
dev->udev = usb_get_dev(udev);
|
USB: add support for Dream Cheeky DL100B Webmail Notifier (1d34:0004)
So far the USBLED driver only supports Delcom's "USB Visual Signal
Indicator" (http://www.delcomproducts.com/products_USBLMP.asp). The
driver generates virtual files "red", "green", and "blue" under the
device's /sys/ directory, where color values can be read from and
written to.
This patch adds support for Dream Cheeky's "DL100B Webmail Notifier"
(http://www.dreamcheeky.com/webmail-notifier -- available from several
shops, such as http://www.conrad.at/ce/de/product/777048/USB-WEBMAIL).
This device isn't as pretty as Delcom's, but it's *far* cheaper, and
its 3 LEDs can be set in 32 brightness steps each. The grey envelope
contour can easily be removed, leaving a rather neutral white box (with
a few small holes), which is useful for generic signalling purposes.
Of course, the small circuit board can easily be put into a prettier
case.
The DL100B device pretends to be a HID, but the HID descriptor shows
that it's not overly useful as such (see below). The patch therefore
removes the "HID-ness" (hid-core.c, hid-ids.h), and adds the necessary
commands to usbled.c. The protocol info comes from the developer's
manual that Dream Cheeky kindly provided (815DeveloperManual.pdf).
HID descriptor:
0: 05 01 Usage Page 'Generic Desktop Controls'
2: 09 10 Usage 'Reserved'
4: a1 01 Collection 'Application (mouse, keyboard)'
6: 05 00 Usage Page 'Undefined'
8: 19 10 Usage Minimum = 16
10: 29 11 Usage Maximum = 17
12: 15 00 Logical Minimum = 0
14: 25 0f Logical Maximum = 15
16: 75 08 Report Size = 8
18: 95 08 Report Count = 8
20: 91 02 Output data *var abs lin pref-state null-pos non-vol bit-field
22: 19 10 Usage Minimum = 16
24: 29 11 Usage Maximum = 17
26: 15 00 Logical Minimum = 0
28: 25 0f Logical Maximum = 15
30: 75 08 Report Size = 8
32: 95 08 Report Count = 8
34: 81 00 Input data array abs lin pref-state null-pos non-vol bit-field
36: c0 End Collection
Signed-off-by: Melchior FRANZ <mfranz@aon.at>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2010-12-22 08:04:33 +07:00
|
|
|
dev->type = id->driver_info;
|
2005-04-17 05:20:36 +07:00
|
|
|
|
2011-07-29 14:17:57 +07:00
|
|
|
usb_set_intfdata(interface, dev);
|
2005-04-17 05:20:36 +07:00
|
|
|
|
2006-08-29 01:43:25 +07:00
|
|
|
retval = device_create_file(&interface->dev, &dev_attr_blue);
|
|
|
|
if (retval)
|
|
|
|
goto error;
|
|
|
|
retval = device_create_file(&interface->dev, &dev_attr_red);
|
|
|
|
if (retval)
|
|
|
|
goto error;
|
|
|
|
retval = device_create_file(&interface->dev, &dev_attr_green);
|
|
|
|
if (retval)
|
|
|
|
goto error;
|
2005-04-17 05:20:36 +07:00
|
|
|
|
USB: add support for Dream Cheeky DL100B Webmail Notifier (1d34:0004)
So far the USBLED driver only supports Delcom's "USB Visual Signal
Indicator" (http://www.delcomproducts.com/products_USBLMP.asp). The
driver generates virtual files "red", "green", and "blue" under the
device's /sys/ directory, where color values can be read from and
written to.
This patch adds support for Dream Cheeky's "DL100B Webmail Notifier"
(http://www.dreamcheeky.com/webmail-notifier -- available from several
shops, such as http://www.conrad.at/ce/de/product/777048/USB-WEBMAIL).
This device isn't as pretty as Delcom's, but it's *far* cheaper, and
its 3 LEDs can be set in 32 brightness steps each. The grey envelope
contour can easily be removed, leaving a rather neutral white box (with
a few small holes), which is useful for generic signalling purposes.
Of course, the small circuit board can easily be put into a prettier
case.
The DL100B device pretends to be a HID, but the HID descriptor shows
that it's not overly useful as such (see below). The patch therefore
removes the "HID-ness" (hid-core.c, hid-ids.h), and adds the necessary
commands to usbled.c. The protocol info comes from the developer's
manual that Dream Cheeky kindly provided (815DeveloperManual.pdf).
HID descriptor:
0: 05 01 Usage Page 'Generic Desktop Controls'
2: 09 10 Usage 'Reserved'
4: a1 01 Collection 'Application (mouse, keyboard)'
6: 05 00 Usage Page 'Undefined'
8: 19 10 Usage Minimum = 16
10: 29 11 Usage Maximum = 17
12: 15 00 Logical Minimum = 0
14: 25 0f Logical Maximum = 15
16: 75 08 Report Size = 8
18: 95 08 Report Count = 8
20: 91 02 Output data *var abs lin pref-state null-pos non-vol bit-field
22: 19 10 Usage Minimum = 16
24: 29 11 Usage Maximum = 17
26: 15 00 Logical Minimum = 0
28: 25 0f Logical Maximum = 15
30: 75 08 Report Size = 8
32: 95 08 Report Count = 8
34: 81 00 Input data array abs lin pref-state null-pos non-vol bit-field
36: c0 End Collection
Signed-off-by: Melchior FRANZ <mfranz@aon.at>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2010-12-22 08:04:33 +07:00
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
2005-04-17 05:20:36 +07:00
|
|
|
dev_info(&interface->dev, "USB LED device now attached\n");
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
error:
|
2006-08-29 01:43:25 +07:00
|
|
|
device_remove_file(&interface->dev, &dev_attr_blue);
|
|
|
|
device_remove_file(&interface->dev, &dev_attr_red);
|
|
|
|
device_remove_file(&interface->dev, &dev_attr_green);
|
2011-07-29 14:17:57 +07:00
|
|
|
usb_set_intfdata(interface, NULL);
|
2006-08-29 01:43:25 +07:00
|
|
|
usb_put_dev(dev->udev);
|
2005-04-17 05:20:36 +07:00
|
|
|
kfree(dev);
|
2006-08-29 01:43:25 +07:00
|
|
|
error_mem:
|
2005-04-17 05:20:36 +07:00
|
|
|
return retval;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void led_disconnect(struct usb_interface *interface)
|
|
|
|
{
|
|
|
|
struct usb_led *dev;
|
|
|
|
|
2011-07-29 14:17:57 +07:00
|
|
|
dev = usb_get_intfdata(interface);
|
2005-04-17 05:20:36 +07:00
|
|
|
|
|
|
|
device_remove_file(&interface->dev, &dev_attr_blue);
|
|
|
|
device_remove_file(&interface->dev, &dev_attr_red);
|
|
|
|
device_remove_file(&interface->dev, &dev_attr_green);
|
|
|
|
|
2007-10-28 14:21:59 +07:00
|
|
|
/* first remove the files, then set the pointer to NULL */
|
2011-07-29 14:17:57 +07:00
|
|
|
usb_set_intfdata(interface, NULL);
|
2007-10-28 14:21:59 +07:00
|
|
|
|
2005-04-17 05:20:36 +07:00
|
|
|
usb_put_dev(dev->udev);
|
|
|
|
|
|
|
|
kfree(dev);
|
|
|
|
|
|
|
|
dev_info(&interface->dev, "USB LED now disconnected\n");
|
|
|
|
}
|
|
|
|
|
|
|
|
static struct usb_driver led_driver = {
|
|
|
|
.name = "usbled",
|
|
|
|
.probe = led_probe,
|
|
|
|
.disconnect = led_disconnect,
|
|
|
|
.id_table = id_table,
|
|
|
|
};
|
|
|
|
|
2011-11-19 00:34:02 +07:00
|
|
|
module_usb_driver(led_driver);
|
2005-04-17 05:20:36 +07:00
|
|
|
|
|
|
|
MODULE_AUTHOR(DRIVER_AUTHOR);
|
|
|
|
MODULE_DESCRIPTION(DRIVER_DESC);
|
|
|
|
MODULE_LICENSE("GPL");
|