From: Benjamin Tissoires <benjamin.tissoi...@redhat.com> Thanks to devres, we can now afford to create more than one input node without having to overload the remove/failure paths. Having one input node per remote is something which should have been implemented from start but the probability of having users with several remotes is quite low. Anyway, still, better looking at the future and implement things properly.
Remote input nodes will be freed/unregistered magically as they are created in the devres group &remote->remotes[index]. We need to open the hid node now that the remotes are dynamically allocated. Signed-off-by: Benjamin Tissoires <benjamin.tissoi...@redhat.com> Acked-by: Ping Cheng <pi...@wacom.com> Signed-off-by: Jiri Kosina <jkos...@suse.cz> [aaron.sko...@wacom.com: Imported into input-wacom repository (7c35dc3)] Signed-off-by: Aaron Armstrong Skomra <aaron.sko...@wacom.com> [aaron.sko...@wacom.com: Backported from input-wacom repository (9447bd6)] Signed-off-by: Aaron Armstrong Skomra <aaron.sko...@wacom.com> --- 2.6.38/wacom.h | 2 + 2.6.38/wacom_sys.c | 155 ++++++++++++++++++++++++++++++++++++++-------------- 2.6.38/wacom_wac.c | 35 ++++++++++-- 3.17/wacom.h | 2 + 3.17/wacom_sys.c | 30 +++++++++++ 3.17/wacom_wac.c | 35 ++++++++++-- 3.7/wacom.h | 2 + 3.7/wacom_sys.c | 156 +++++++++++++++++++++++++++++++++++++++-------------- 3.7/wacom_wac.c | 33 ++++++++++-- 9 files changed, 358 insertions(+), 92 deletions(-) diff --git a/2.6.38/wacom.h b/2.6.38/wacom.h index 5ecd3b8..e501fae 100644 --- a/2.6.38/wacom.h +++ b/2.6.38/wacom.h @@ -126,6 +126,8 @@ struct wacom_remote { struct { struct attribute_group group; u32 serial; + struct input_dev *input; + bool registered; } remotes[WACOM_MAX_REMOTES]; }; diff --git a/2.6.38/wacom_sys.c b/2.6.38/wacom_sys.c index 41f8b9a..b8dbcc4 100644 --- a/2.6.38/wacom_sys.c +++ b/2.6.38/wacom_sys.c @@ -1328,11 +1328,19 @@ static void wacom_remote_destroy_one(struct wacom *wacom, unsigned int index) struct wacom_remote *remote = wacom->remote; u32 serial = remote->remotes[index].serial; int i; + unsigned long flags; + + spin_lock_irqsave(&remote->remote_lock, flags); + remote->remotes[index].registered = false; + spin_unlock_irqrestore(&remote->remote_lock, flags); if (remote->remotes[index].group.name) devres_release_group(&wacom->usbdev->dev, &remote->remotes[index]); + if (remote->remotes[index].input) + input_unregister_device(remote->remotes[index].input); + for (i = 0; i < WACOM_MAX_REMOTES; i++) { if (remote->remotes[i].serial == serial) { remote->remotes[i].serial = 0; @@ -1343,50 +1351,12 @@ static void wacom_remote_destroy_one(struct wacom *wacom, unsigned int index) kfree((char *)remote->remotes[i].group.name); remote->remotes[i].group.name = NULL; + remote->remotes[i].registered = false; wacom->led.select[i] = WACOM_STATUS_UNKNOWN; } } } -static int wacom_remote_create_one(struct wacom *wacom, u32 serial, - unsigned int index) -{ - struct wacom_remote *remote = wacom->remote; - struct device *dev = &wacom->usbdev->dev; - int error, k; - - /* A remote can pair more than once with an EKR, - * check to make sure this serial isn't already paired. - */ - for (k = 0; k < WACOM_MAX_REMOTES; k++) { - if (remote->remotes[k].serial == serial) - break; - } - - if (k < WACOM_MAX_REMOTES) { - remote->remotes[index].serial = serial; - return 0; - } - - if (!devres_open_group(dev, &remote->remotes[index], GFP_KERNEL)) - return -ENOMEM; - - error = wacom_remote_create_attr_group(wacom, serial, index); - if (error) - goto fail; - - remote->remotes[index].serial = serial; - - devres_close_group(dev, &remote->remotes[index]); - - return 0; - -fail: - devres_release_group(dev, &remote->remotes[index]); - remote->remotes[index].serial = 0; - return error; -} - static ssize_t wacom_store_unpair_remote(struct kobject *kobj, struct kobj_attribute *attr, const char *buf, size_t count) @@ -1502,14 +1472,50 @@ static void wacom_unregister_inputs(struct wacom *wacom) wacom->wacom_wac.input = NULL; } +static int wacom_register_remote_input(struct wacom *wacom, int index) +{ + struct input_dev *input_dev; + struct wacom_remote *remote = wacom->remote; + struct usb_interface *intf = wacom->intf; + struct usb_device *dev = interface_to_usbdev(intf); + struct wacom_wac *wacom_wac = &(wacom->wacom_wac); + int error; + + input_dev = input_allocate_device(); + if (!input_dev) { + error = -ENOMEM; + goto fail1; + } + + input_dev->name = wacom_wac->name; + input_dev->dev.parent = &intf->dev; + usb_to_input_id(dev, &input_dev->id); + if (wacom_wac->pid != 0) { + /* copy PID of wireless device */ + input_dev->id.product = wacom_wac->pid; + } + input_set_drvdata(input_dev, wacom); + + remote->remotes[index].input = input_dev; + + return 0; + +fail1: + return error; +} + static int wacom_register_input(struct wacom *wacom) { struct input_dev *input_dev; struct usb_interface *intf = wacom->intf; struct usb_device *dev = interface_to_usbdev(intf); struct wacom_wac *wacom_wac = &(wacom->wacom_wac); + struct wacom_features *features = &wacom_wac->features; int error; + if (features->type == REMOTE) + return 0; + input_dev = input_allocate_device(); if (!input_dev) { error = -ENOMEM; @@ -1547,6 +1553,77 @@ fail1: return error; } +static int wacom_remote_create_one(struct wacom *wacom, u32 serial, + unsigned int index) +{ + struct wacom_remote *remote = wacom->remote; + struct wacom_wac *wacom_wac = &wacom->wacom_wac; + struct device *dev = &wacom->usbdev->dev; + int error, k; + + /* A remote can pair more than once with an EKR, + * check to make sure this serial isn't already paired. + */ + for (k = 0; k < WACOM_MAX_REMOTES; k++) { + if (remote->remotes[k].serial == serial) + break; + } + + if (k < WACOM_MAX_REMOTES) { + remote->remotes[index].serial = serial; + return 0; + } + + if (!devres_open_group(dev, &remote->remotes[index], GFP_KERNEL)) + return -ENOMEM; + + error = wacom_remote_create_attr_group(wacom, serial, index); + if (error) + goto fail; + + error = wacom_register_remote_input(wacom, index); + if (error) + goto fail; + + if (!remote->remotes[index].input) { + error = -ENOMEM; + goto fail; + } + + remote->remotes[index].input->uniq = remote->remotes[index].group.name; + remote->remotes[index].input->name = wacom_wac->name; + + if (!remote->remotes[index].input->name) { + error = -EINVAL; + goto fail; + } + + error = wacom_setup_input_capabilities(remote->remotes[index].input, + wacom_wac); + if (error) + goto fail; + + remote->remotes[index].serial = serial; + + error = input_register_device(remote->remotes[index].input); + if (error) + goto fail2; + + remote->remotes[index].registered = true; + + devres_close_group(dev, &remote->remotes[index]); + + return 0; +fail2: + if (remote->remotes[index].input) + input_free_device(remote->remotes[index].input); + remote->remotes[index].input = NULL; +fail: + devres_release_group(dev, &remote->remotes[index]); + remote->remotes[index].serial = 0; + return error; +} + /* * Not all devices report physical dimensions from HID. * Compute the default from hardcoded logical dimension diff --git a/2.6.38/wacom_wac.c b/2.6.38/wacom_wac.c index 4f369e8..4e246d0 100644 --- a/2.6.38/wacom_wac.c +++ b/2.6.38/wacom_wac.c @@ -700,22 +700,38 @@ static int wacom_intuos_inout(struct wacom_wac *wacom) static int wacom_remote_irq(struct wacom_wac *wacom_wac, size_t len) { unsigned char *data = wacom_wac->data; - struct input_dev *input = wacom_wac->input; struct wacom *wacom = container_of(wacom_wac, struct wacom, wacom_wac); struct wacom_features *features = &wacom_wac->features; struct wacom_remote *remote = wacom->remote; + struct input_dev *input; int bat_charging, bat_percent, touch_ring_mode; __u32 serial; - int i; + int i, index = -1; + unsigned long flags; if (data[0] != WACOM_REPORT_REMOTE) { - dev_dbg(input->dev.parent, + dev_dbg(&wacom->intf->dev, "%s: received unknown report #%d", __func__, data[0]); return 0; } serial = data[3] + (data[4] << 8) + (data[5] << 16); wacom_wac->id[0] = PAD_DEVICE_ID; + + spin_lock_irqsave(&remote->remote_lock, flags); + + for (i = 0; i < WACOM_MAX_REMOTES; i++) { + if (remote->remotes[i].serial == serial) { + index = i; + break; + } + } + + input = remote->remotes[index].input; + + if (index < 0 || !remote->remotes[index].registered) + goto out; + input_report_key(input, BTN_0, (data[9] & 0x01)); input_report_key(input, BTN_1, (data[9] & 0x02)); input_report_key(input, BTN_2, (data[9] & 0x04)); @@ -752,6 +768,8 @@ static int wacom_remote_irq(struct wacom_wac *wacom_wac, size_t len) input_event(input, EV_MSC, MSC_SERIAL, serial); + input_sync(input); + /*Which mode select (LED light) is currently on?*/ touch_ring_mode = (data[11] & 0xC0) >> 6; @@ -768,7 +786,9 @@ static int wacom_remote_irq(struct wacom_wac *wacom_wac, size_t len) wacom_notify_battery(wacom_wac, bat_percent, bat_charging, 1, bat_charging); - return 1; +out: + spin_unlock_irqrestore(&remote->remote_lock, flags); + return 0; } static void wacom_remote_status_irq(struct wacom_wac *wacom_wac, size_t len) @@ -1835,6 +1855,10 @@ void wacom_setup_device_quirks(struct wacom *wacom) features->quirks |= WACOM_QUIRK_BATTERY; } } + + if (features->type == REMOTE) { + features->quirks |= WACOM_QUIRK_MONITOR; + } } static void wacom_abs_set_axis(struct input_dev *input_dev, @@ -1899,6 +1923,9 @@ int wacom_setup_input_capabilities(struct input_dev *input_dev, struct wacom_features *features = &wacom_wac->features; int numbered_buttons = features->numbered_buttons; + if (features->type == REMOTE && input_dev == wacom_wac->input) + return -ENODEV; + input_dev->evbit[0] |= BIT_MASK(EV_KEY) | BIT_MASK(EV_ABS); __set_bit(BTN_TOUCH, input_dev->keybit); diff --git a/3.17/wacom.h b/3.17/wacom.h index 1dd9cce..c299a83 100644 --- a/3.17/wacom.h +++ b/3.17/wacom.h @@ -137,6 +137,8 @@ struct wacom_remote { struct { struct attribute_group group; u32 serial; + struct input_dev *input; + bool registered; } remotes[WACOM_MAX_REMOTES]; }; diff --git a/3.17/wacom_sys.c b/3.17/wacom_sys.c index 4c5b075..efa03fb 100644 --- a/3.17/wacom_sys.c +++ b/3.17/wacom_sys.c @@ -1976,6 +1976,11 @@ static void wacom_remote_destroy_one(struct wacom *wacom, unsigned int index) struct wacom_remote *remote = wacom->remote; u32 serial = remote->remotes[index].serial; int i; + unsigned long flags; + + spin_lock_irqsave(&remote->remote_lock, flags); + remote->remotes[index].registered = false; + spin_unlock_irqrestore(&remote->remote_lock, flags); if (remote->remotes[index].group.name) devres_release_group(&wacom->hdev->dev, @@ -1985,6 +1990,7 @@ static void wacom_remote_destroy_one(struct wacom *wacom, unsigned int index) if (remote->remotes[i].serial == serial) { remote->remotes[i].serial = 0; remote->remotes[i].group.name = NULL; + remote->remotes[i].registered = false; wacom->led.groups[i].select = WACOM_STATUS_UNKNOWN; } } @@ -2017,8 +2023,32 @@ static int wacom_remote_create_one(struct wacom *wacom, u32 serial, if (error) goto fail; + remote->remotes[index].input = wacom_allocate_input(wacom); + if (!remote->remotes[index].input) { + error = -ENOMEM; + goto fail; + } + remote->remotes[index].input->uniq = remote->remotes[index].group.name; + remote->remotes[index].input->name = wacom->wacom_wac.pad_name; + + if (!remote->remotes[index].input->name) { + error = -EINVAL; + goto fail; + } + + error = wacom_setup_pad_input_capabilities(remote->remotes[index].input, + &wacom->wacom_wac); + if (error) + goto fail; + remote->remotes[index].serial = serial; + error = input_register_device(remote->remotes[index].input); + if (error) + goto fail; + + remote->remotes[index].registered = true; + devres_close_group(dev, &remote->remotes[index]); return 0; diff --git a/3.17/wacom_wac.c b/3.17/wacom_wac.c index 96ced4e..4cfd4dd 100644 --- a/3.17/wacom_wac.c +++ b/3.17/wacom_wac.c @@ -757,23 +757,38 @@ static int wacom_intuos_inout(struct wacom_wac *wacom) static int wacom_remote_irq(struct wacom_wac *wacom_wac, size_t len) { unsigned char *data = wacom_wac->data; - struct input_dev *input = wacom_wac->pad_input; + struct input_dev *input; struct wacom *wacom = container_of(wacom_wac, struct wacom, wacom_wac); struct wacom_remote *remote = wacom->remote; struct wacom_features *features = &wacom_wac->features; int bat_charging, bat_percent, touch_ring_mode; __u32 serial; - int i; + int i, index = -1; + unsigned long flags; if (data[0] != WACOM_REPORT_REMOTE) { - dev_dbg(input->dev.parent, - "%s: received unknown report #%d", __func__, data[0]); + hid_dbg(wacom->hdev, "%s: received unknown report #%d", + __func__, data[0]); return 0; } serial = data[3] + (data[4] << 8) + (data[5] << 16); wacom_wac->id[0] = PAD_DEVICE_ID; + spin_lock_irqsave(&remote->remote_lock, flags); + + for (i = 0; i < WACOM_MAX_REMOTES; i++) { + if (remote->remotes[i].serial == serial) { + index = i; + break; + } + } + + if (index < 0 || !remote->remotes[index].registered) + goto out; + + input = remote->remotes[index].input; + input_report_key(input, BTN_0, (data[9] & 0x01)); input_report_key(input, BTN_1, (data[9] & 0x02)); input_report_key(input, BTN_2, (data[9] & 0x04)); @@ -810,6 +825,8 @@ static int wacom_remote_irq(struct wacom_wac *wacom_wac, size_t len) input_event(input, EV_MSC, MSC_SERIAL, serial); + input_sync(input); + /*Which mode select (LED light) is currently on?*/ touch_ring_mode = (data[11] & 0xC0) >> 6; @@ -827,7 +844,9 @@ static int wacom_remote_irq(struct wacom_wac *wacom_wac, size_t len) wacom_notify_battery(wacom_wac, bat_percent, bat_charging, 1, bat_charging); - return 1; +out: + spin_unlock_irqrestore(&remote->remote_lock, flags); + return 0; } static void wacom_remote_status_irq(struct wacom_wac *wacom_wac, size_t len) @@ -2467,6 +2486,9 @@ void wacom_setup_device_quirks(struct wacom *wacom) features->quirks |= WACOM_QUIRK_BATTERY; } } + + if (features->type == REMOTE) + features->device_type |= WACOM_DEVICETYPE_WL_MONITOR; } int wacom_setup_pen_input_capabilities(struct input_dev *input_dev, @@ -2774,6 +2796,9 @@ int wacom_setup_pad_input_capabilities(struct input_dev *input_dev, if (!(features->device_type & WACOM_DEVICETYPE_PAD)) return -ENODEV; + if (features->type == REMOTE && input_dev == wacom_wac->pad_input) + return -ENODEV; + input_dev->evbit[0] |= BIT_MASK(EV_KEY) | BIT_MASK(EV_ABS); /* kept for making legacy xf86-input-wacom working with the wheels */ diff --git a/3.7/wacom.h b/3.7/wacom.h index 492b09a..1183cbb 100644 --- a/3.7/wacom.h +++ b/3.7/wacom.h @@ -122,6 +122,8 @@ struct wacom_remote { struct { struct attribute_group group; u32 serial; + struct input_dev *input; + bool registered; } remotes[WACOM_MAX_REMOTES]; }; diff --git a/3.7/wacom_sys.c b/3.7/wacom_sys.c index e899cb2..3801468 100644 --- a/3.7/wacom_sys.c +++ b/3.7/wacom_sys.c @@ -1320,11 +1320,19 @@ static void wacom_remote_destroy_one(struct wacom *wacom, unsigned int index) struct wacom_remote *remote = wacom->remote; u32 serial = remote->remotes[index].serial; int i; + unsigned long flags; + + spin_lock_irqsave(&remote->remote_lock, flags); + remote->remotes[index].registered = false; + spin_unlock_irqrestore(&remote->remote_lock, flags); if (remote->remotes[index].group.name) devres_release_group(&wacom->usbdev->dev, &remote->remotes[index]); + if (remote->remotes[index].input) + input_unregister_device(remote->remotes[index].input); + for (i = 0; i < WACOM_MAX_REMOTES; i++) { if (remote->remotes[i].serial == serial) { remote->remotes[i].serial = 0; @@ -1334,51 +1342,12 @@ static void wacom_remote_destroy_one(struct wacom *wacom, unsigned int index) */ kfree((char *)remote->remotes[i].group.name); remote->remotes[i].group.name = NULL; - + remote->remotes[i].registered = false; wacom->led.select[i] = WACOM_STATUS_UNKNOWN; } } } -static int wacom_remote_create_one(struct wacom *wacom, u32 serial, - unsigned int index) -{ - struct wacom_remote *remote = wacom->remote; - struct device *dev = &wacom->usbdev->dev; - int error, k; - - /* A remote can pair more than once with an EKR, - * check to make sure this serial isn't already paired. - */ - for (k = 0; k < WACOM_MAX_REMOTES; k++) { - if (remote->remotes[k].serial == serial) - break; - } - - if (k < WACOM_MAX_REMOTES) { - remote->remotes[index].serial = serial; - return 0; - } - - if (!devres_open_group(dev, &remote->remotes[index], GFP_KERNEL)) - return -ENOMEM; - - error = wacom_remote_create_attr_group(wacom, serial, index); - if (error) - goto fail; - - remote->remotes[index].serial = serial; - - devres_close_group(dev, &remote->remotes[index]); - - return 0; - -fail: - devres_release_group(dev, &remote->remotes[index]); - remote->remotes[index].serial = 0; - return error; -} - static ssize_t wacom_store_unpair_remote(struct kobject *kobj, struct kobj_attribute *attr, const char *buf, size_t count) @@ -1493,14 +1462,50 @@ static void wacom_unregister_inputs(struct wacom *wacom) wacom->wacom_wac.input = NULL; } +static int wacom_register_remote_input(struct wacom *wacom, int index) +{ + struct input_dev *input_dev; + struct wacom_remote *remote = wacom->remote; + struct usb_interface *intf = wacom->intf; + struct usb_device *dev = interface_to_usbdev(intf); + struct wacom_wac *wacom_wac = &(wacom->wacom_wac); + int error; + + input_dev = input_allocate_device(); + if (!input_dev) { + error = -ENOMEM; + goto fail1; + } + + input_dev->name = wacom_wac->name; + input_dev->dev.parent = &intf->dev; + usb_to_input_id(dev, &input_dev->id); + if (wacom_wac->pid != 0) { + /* copy PID of wireless device */ + input_dev->id.product = wacom_wac->pid; + } + input_set_drvdata(input_dev, wacom); + + remote->remotes[index].input = input_dev; + + return 0; + +fail1: + return error; +} + static int wacom_register_input(struct wacom *wacom) { struct input_dev *input_dev; struct usb_interface *intf = wacom->intf; struct usb_device *dev = interface_to_usbdev(intf); struct wacom_wac *wacom_wac = &(wacom->wacom_wac); + struct wacom_features *features = &wacom_wac->features; int error; + if (features->type == REMOTE) + return 0; + input_dev = input_allocate_device(); if (!input_dev) { error = -ENOMEM; @@ -1537,6 +1542,77 @@ fail1: return error; } +static int wacom_remote_create_one(struct wacom *wacom, u32 serial, + unsigned int index) +{ + struct wacom_remote *remote = wacom->remote; + struct wacom_wac *wacom_wac = &wacom->wacom_wac; + struct device *dev = &wacom->usbdev->dev; + int error, k; + + /* A remote can pair more than once with an EKR, + * check to make sure this serial isn't already paired. + */ + for (k = 0; k < WACOM_MAX_REMOTES; k++) { + if (remote->remotes[k].serial == serial) + break; + } + + if (k < WACOM_MAX_REMOTES) { + remote->remotes[index].serial = serial; + return 0; + } + + if (!devres_open_group(dev, &remote->remotes[index], GFP_KERNEL)) + return -ENOMEM; + + error = wacom_remote_create_attr_group(wacom, serial, index); + if (error) + goto fail; + + error = wacom_register_remote_input(wacom, index); + if (error) + goto fail; + + if (!remote->remotes[index].input) { + error = -ENOMEM; + goto fail; + } + + remote->remotes[index].input->uniq = remote->remotes[index].group.name; + remote->remotes[index].input->name = wacom_wac->name; + + if (!remote->remotes[index].input->name) { + error = -EINVAL; + goto fail; + } + + error = wacom_setup_input_capabilities(remote->remotes[index].input, + wacom_wac); + if (error) + goto fail; + + remote->remotes[index].serial = serial; + + error = input_register_device(remote->remotes[index].input); + if (error) + goto fail2; + + remote->remotes[index].registered = true; + + devres_close_group(dev, &remote->remotes[index]); + + return 0; +fail2: + if (remote->remotes[index].input) + input_free_device(remote->remotes[index].input); + remote->remotes[index].input = NULL; +fail: + devres_release_group(dev, &remote->remotes[index]); + remote->remotes[index].serial = 0; + return error; +} + /* * Not all devices report physical dimensions from HID. * Compute the default from hardcoded logical dimension diff --git a/3.7/wacom_wac.c b/3.7/wacom_wac.c index 8aa77c8..252e871 100644 --- a/3.7/wacom_wac.c +++ b/3.7/wacom_wac.c @@ -700,16 +700,17 @@ static int wacom_intuos_inout(struct wacom_wac *wacom) static int wacom_remote_irq(struct wacom_wac *wacom_wac, size_t len) { unsigned char *data = wacom_wac->data; - struct input_dev *input = wacom_wac->input; struct wacom *wacom = container_of(wacom_wac, struct wacom, wacom_wac); struct wacom_features *features = &wacom_wac->features; struct wacom_remote *remote = wacom->remote; + struct input_dev *input; int bat_charging, bat_percent, touch_ring_mode; __u32 serial; - int i; + int i, index = -1; + unsigned long flags; if (data[0] != WACOM_REPORT_REMOTE) { - dev_dbg(input->dev.parent, + dev_dbg(&wacom->intf->dev, "%s: received unknown report #%d", __func__, data[0]); return 0; } @@ -717,6 +718,20 @@ static int wacom_remote_irq(struct wacom_wac *wacom_wac, size_t len) serial = data[3] + (data[4] << 8) + (data[5] << 16); wacom_wac->id[0] = PAD_DEVICE_ID; + spin_lock_irqsave(&remote->remote_lock, flags); + + for (i = 0; i < WACOM_MAX_REMOTES; i++) { + if (remote->remotes[i].serial == serial) { + index = i; + break; + } + } + + input = remote->remotes[index].input; + + if (index < 0 || !remote->remotes[index].registered) + goto out; + input_report_key(input, BTN_0, (data[9] & 0x01)); input_report_key(input, BTN_1, (data[9] & 0x02)); input_report_key(input, BTN_2, (data[9] & 0x04)); @@ -753,6 +768,8 @@ static int wacom_remote_irq(struct wacom_wac *wacom_wac, size_t len) input_event(input, EV_MSC, MSC_SERIAL, serial); + input_sync(input); + /*Which mode select (LED light) is currently on?*/ touch_ring_mode = (data[11] & 0xC0) >> 6; @@ -770,7 +787,9 @@ static int wacom_remote_irq(struct wacom_wac *wacom_wac, size_t len) wacom_notify_battery(wacom_wac, bat_percent, bat_charging, 1, bat_charging); - return 1; +out: + spin_unlock_irqrestore(&remote->remote_lock, flags); + return 0; } static void wacom_remote_status_irq(struct wacom_wac *wacom_wac, size_t len) @@ -1815,6 +1834,10 @@ void wacom_setup_device_quirks(struct wacom *wacom) features->quirks |= WACOM_QUIRK_BATTERY; } } + + if (features->type == REMOTE) { + features->quirks |= WACOM_QUIRK_MONITOR; + } } static void wacom_abs_set_axis(struct input_dev *input_dev, @@ -1889,6 +1912,8 @@ int wacom_setup_input_capabilities(struct input_dev *input_dev, { struct wacom_features *features = &wacom_wac->features; int numbered_buttons = features->numbered_buttons; + if (features->type == REMOTE && input_dev == wacom_wac->input) + return -ENODEV; input_dev->evbit[0] |= BIT_MASK(EV_KEY) | BIT_MASK(EV_ABS); -- 2.7.4 ------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, SlashDot.org! http://sdm.link/slashdot _______________________________________________ Linuxwacom-devel mailing list Linuxwacom-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linuxwacom-devel