Re: [PATCH 1/2] HID: hid-lg4ff add support for G27 LEDs
From: <hidden>
Date: 2012-03-13 21:08:28
Also in:
lkml
Not really, it's rather simple to use and as Mark said, it's a proper
infrastructure to use here.
We already have HID drivers which are using this -- you can look at
PicoLCD or Wiimote drivers and you'll see that it's indeed fairly
simple.
So _you_ say.... I'm getting an Oops when device attempts to init the LED
subsytem. :-(
--
Mar 13 12:54:56 ubuntu kernel: [ 458.639674] Call Trace:
Mar 13 12:54:56 ubuntu kernel: [ 458.641143] [<c13498ed>] ?
device_create+0x2d/0x30
Mar 13 12:54:56 ubuntu kernel: [ 458.641245] [<c1439119>]
led_classdev_register+0x99/0xf0
Mar 13 12:54:56 ubuntu kernel: [ 458.641306] [<e0977311>]
lg4ff_init+0x2a1/0x570 [hid_logitech]
Mar 13 12:54:56 ubuntu kernel: [ 458.641313] [<e0975427>]
lg_probe+0x147/0x2c0 [hid_logitech]
--
Code snipet below (full file attached):
--
int lg4ff_init(struct hid_device *hid)
{
struct hid_input *hidinput = list_entry(hid->inputs.next, struct
hid_input, list);
struct list_head *report_list =
&hid->report_enum[HID_OUTPUT_REPORT].report_list;
struct input_dev *dev = hidinput->input;
struct hid_report *report;
struct hid_field *field;
struct lg_drv_data *drv_data;
struct lg4ff_device_entry *entry;
struct usb_device_descriptor *udesc;
int error, i, j;
__u16 bcdDevice, rev_maj, rev_min;
struct led_classdev *led;
struct device *dev2 = &dev->dev;
--
/* register led subsystem - G27 only */
//if (rev_maj == G27_REV_MAJ && rev_min == G27_REV_MIN) {
if (rev_maj != G27_REV_MAJ || rev_min != G27_REV_MIN) {
for (i = 0; i < 5; i++) {
led = kzalloc(sizeof(struct led_classdev), GFP_KERNEL); if
(!led) {
dev_err(dev2, "can't allocate memory for LED %d\n", i);
error = -ENOMEM;
goto err;
}
led->name = (void *)(g27_leds[i]);
led->brightness = 0;
led->max_brightness = 1;
led->brightness_get = lg4ff_led_get_brightness;
led->brightness_set = lg4ff_led_set_brightness;
entry->led[i] = led;
#if 1
error = led_classdev_register(dev2, entry->led[i]);
if (error) {
dev_err(dev2, "can't register LED %d\n", i);
goto err;
}
#endif
}
dbg_hid("sysfs interface created for leds\n");
--
Any suggestions as to what I'm doing wrong?
Simon
Attachments
- hid-lgff.c [text/x-csrc] 5020 bytes · preview