Skip to content

Commit

Permalink
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel…
Browse files Browse the repository at this point in the history
…/git/jikos/hid

Pull HID fixes from Jiri Kosina:
 - fix compat ioctl leak in uhid, by David Herrmann
 - fix scheduling in atomic context (causing actual lockups in real
   world) in hid-sony driver, by Sven Eckelmann
 - revert patch introducing VID/PID conflict, by Jiri Kosina
 - support from various new device IDs by Benjamin Tissoires and
   KaiChung Cheng

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/hid:
  HID: uhid: fix leak for 64/32 UHID_CREATE
  HID: kye: fix unresponsive keyboard
  HID: kye: Add report fixup for Genius Manticore Keyboard
  HID: multicouh: add PID VID to support 1 new Wistron optical touch device
  HID: appleir: force input to be set
  Revert "HID: wiimote: add LEGO-wiimote VID"
  HID: sony: Send FF commands in non-atomic context
  • Loading branch information
Linus Torvalds committed Nov 28, 2013
2 parents b7fe6bf + 80897aa commit ba33fef
Show file tree
Hide file tree
Showing 9 changed files with 72 additions and 18 deletions.
1 change: 1 addition & 0 deletions drivers/hid/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -460,6 +460,7 @@ config HID_MULTITOUCH
- Stantum multitouch panels
- Touch International Panels
- Unitec Panels
- Wistron optical touch panels
- XAT optical touch panels
- Xiroku optical touch panels
- Zytronic touch panels
Expand Down
3 changes: 3 additions & 0 deletions drivers/hid/hid-appleir.c
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 +297,9 @@ static int appleir_probe(struct hid_device *hid, const struct hid_device_id *id)

appleir->hid = hid;

/* force input as some remotes bypass the input registration */
hid->quirks |= HID_QUIRK_HIDINPUT_FORCE;

spin_lock_init(&appleir->lock);
setup_timer(&appleir->key_up_timer,
key_up_tick, (unsigned long) appleir);
Expand Down
2 changes: 1 addition & 1 deletion drivers/hid/hid-core.c
Original file line number Diff line number Diff line change
Expand Up @@ -1723,6 +1723,7 @@ static const struct hid_device_id hid_have_special_driver[] = {
{ HID_USB_DEVICE(USB_VENDOR_ID_KENSINGTON, USB_DEVICE_ID_KS_SLIMBLADE) },
{ HID_USB_DEVICE(USB_VENDOR_ID_KEYTOUCH, USB_DEVICE_ID_KEYTOUCH_IEC) },
{ HID_USB_DEVICE(USB_VENDOR_ID_KYE, USB_DEVICE_ID_GENIUS_GILA_GAMING_MOUSE) },
{ HID_USB_DEVICE(USB_VENDOR_ID_KYE, USB_DEVICE_ID_GENIUS_MANTICORE) },
{ HID_USB_DEVICE(USB_VENDOR_ID_KYE, USB_DEVICE_ID_GENIUS_GX_IMPERATOR) },
{ HID_USB_DEVICE(USB_VENDOR_ID_KYE, USB_DEVICE_ID_KYE_ERGO_525V) },
{ HID_USB_DEVICE(USB_VENDOR_ID_KYE, USB_DEVICE_ID_KYE_EASYPEN_I405X) },
Expand Down Expand Up @@ -1879,7 +1880,6 @@ static const struct hid_device_id hid_have_special_driver[] = {

{ HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_PRESENTER_8K_BT) },
{ HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_NINTENDO, USB_DEVICE_ID_NINTENDO_WIIMOTE) },
{ HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_NINTENDO2, USB_DEVICE_ID_NINTENDO_WIIMOTE) },
{ HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_NINTENDO, USB_DEVICE_ID_NINTENDO_WIIMOTE2) },
{ }
};
Expand Down
5 changes: 4 additions & 1 deletion drivers/hid/hid-ids.h
Original file line number Diff line number Diff line change
Expand Up @@ -489,6 +489,7 @@
#define USB_VENDOR_ID_KYE 0x0458
#define USB_DEVICE_ID_KYE_ERGO_525V 0x0087
#define USB_DEVICE_ID_GENIUS_GILA_GAMING_MOUSE 0x0138
#define USB_DEVICE_ID_GENIUS_MANTICORE 0x0153
#define USB_DEVICE_ID_GENIUS_GX_IMPERATOR 0x4018
#define USB_DEVICE_ID_KYE_GPEN_560 0x5003
#define USB_DEVICE_ID_KYE_EASYPEN_I405X 0x5010
Expand Down Expand Up @@ -640,7 +641,6 @@
#define USB_DEVICE_ID_NEXTWINDOW_TOUCHSCREEN 0x0003

#define USB_VENDOR_ID_NINTENDO 0x057e
#define USB_VENDOR_ID_NINTENDO2 0x054c
#define USB_DEVICE_ID_NINTENDO_WIIMOTE 0x0306
#define USB_DEVICE_ID_NINTENDO_WIIMOTE2 0x0330

Expand Down Expand Up @@ -902,6 +902,9 @@
#define USB_DEVICE_ID_SUPER_DUAL_BOX_PRO 0x8802
#define USB_DEVICE_ID_SUPER_JOY_BOX_5_PRO 0x8804

#define USB_VENDOR_ID_WISTRON 0x0fb8
#define USB_DEVICE_ID_WISTRON_OPTICAL_TOUCH 0x1109

#define USB_VENDOR_ID_X_TENSIONS 0x1ae7
#define USB_DEVICE_ID_SPEEDLINK_VAD_CEZANNE 0x9001

Expand Down
13 changes: 13 additions & 0 deletions drivers/hid/hid-kye.c
Original file line number Diff line number Diff line change
Expand Up @@ -341,6 +341,9 @@ static __u8 *kye_report_fixup(struct hid_device *hdev, __u8 *rdesc,
case USB_DEVICE_ID_GENIUS_GX_IMPERATOR:
rdesc = kye_consumer_control_fixup(hdev, rdesc, rsize, 83,
"Genius Gx Imperator Keyboard");
case USB_DEVICE_ID_GENIUS_MANTICORE:
rdesc = kye_consumer_control_fixup(hdev, rdesc, rsize, 104,
"Genius Manticore Keyboard");
break;
}
return rdesc;
Expand Down Expand Up @@ -418,6 +421,14 @@ static int kye_probe(struct hid_device *hdev, const struct hid_device_id *id)
goto enabling_err;
}
break;
case USB_DEVICE_ID_GENIUS_MANTICORE:
/*
* The manticore keyboard needs to have all the interfaces
* opened at least once to be fully functional.
*/
if (hid_hw_open(hdev))
hid_hw_close(hdev);
break;
}

return 0;
Expand All @@ -439,6 +450,8 @@ static const struct hid_device_id kye_devices[] = {
USB_DEVICE_ID_GENIUS_GILA_GAMING_MOUSE) },
{ HID_USB_DEVICE(USB_VENDOR_ID_KYE,
USB_DEVICE_ID_GENIUS_GX_IMPERATOR) },
{ HID_USB_DEVICE(USB_VENDOR_ID_KYE,
USB_DEVICE_ID_GENIUS_MANTICORE) },
{ }
};
MODULE_DEVICE_TABLE(hid, kye_devices);
Expand Down
6 changes: 6 additions & 0 deletions drivers/hid/hid-multitouch.c
Original file line number Diff line number Diff line change
Expand Up @@ -1335,6 +1335,12 @@ static const struct hid_device_id mt_devices[] = {
{ .driver_data = MT_CLS_NSMU,
MT_USB_DEVICE(USB_VENDOR_ID_UNITEC,
USB_DEVICE_ID_UNITEC_USB_TOUCH_0A19) },

/* Wistron panels */
{ .driver_data = MT_CLS_NSMU,
MT_USB_DEVICE(USB_VENDOR_ID_WISTRON,
USB_DEVICE_ID_WISTRON_OPTICAL_TOUCH) },

/* XAT */
{ .driver_data = MT_CLS_NSMU,
MT_USB_DEVICE(USB_VENDOR_ID_XAT,
Expand Down
53 changes: 42 additions & 11 deletions drivers/hid/hid-sony.c
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,13 @@ static const unsigned int buzz_keymap[] = {
struct sony_sc {
unsigned long quirks;

#ifdef CONFIG_SONY_FF
struct work_struct rumble_worker;
struct hid_device *hdev;
__u8 left;
__u8 right;
#endif

void *extra;
};

Expand Down Expand Up @@ -615,9 +622,9 @@ static void buzz_remove(struct hid_device *hdev)
}

#ifdef CONFIG_SONY_FF
static int sony_play_effect(struct input_dev *dev, void *data,
struct ff_effect *effect)
static void sony_rumble_worker(struct work_struct *work)
{
struct sony_sc *sc = container_of(work, struct sony_sc, rumble_worker);
unsigned char buf[] = {
0x01,
0x00, 0xff, 0x00, 0xff, 0x00,
Expand All @@ -628,38 +635,60 @@ static int sony_play_effect(struct input_dev *dev, void *data,
0xff, 0x27, 0x10, 0x00, 0x32,
0x00, 0x00, 0x00, 0x00, 0x00
};
__u8 left;
__u8 right;

buf[3] = sc->right;
buf[5] = sc->left;

sc->hdev->hid_output_raw_report(sc->hdev, buf, sizeof(buf),
HID_OUTPUT_REPORT);
}

static int sony_play_effect(struct input_dev *dev, void *data,
struct ff_effect *effect)
{
struct hid_device *hid = input_get_drvdata(dev);
struct sony_sc *sc = hid_get_drvdata(hid);

if (effect->type != FF_RUMBLE)
return 0;

left = effect->u.rumble.strong_magnitude / 256;
right = effect->u.rumble.weak_magnitude ? 1 : 0;

buf[3] = right;
buf[5] = left;
sc->left = effect->u.rumble.strong_magnitude / 256;
sc->right = effect->u.rumble.weak_magnitude ? 1 : 0;

return hid->hid_output_raw_report(hid, buf, sizeof(buf),
HID_OUTPUT_REPORT);
schedule_work(&sc->rumble_worker);
return 0;
}

static int sony_init_ff(struct hid_device *hdev)
{
struct hid_input *hidinput = list_entry(hdev->inputs.next,
struct hid_input, list);
struct input_dev *input_dev = hidinput->input;
struct sony_sc *sc = hid_get_drvdata(hdev);

sc->hdev = hdev;
INIT_WORK(&sc->rumble_worker, sony_rumble_worker);

input_set_capability(input_dev, EV_FF, FF_RUMBLE);
return input_ff_create_memless(input_dev, NULL, sony_play_effect);
}

static void sony_destroy_ff(struct hid_device *hdev)
{
struct sony_sc *sc = hid_get_drvdata(hdev);

cancel_work_sync(&sc->rumble_worker);
}

#else
static int sony_init_ff(struct hid_device *hdev)
{
return 0;
}

static void sony_destroy_ff(struct hid_device *hdev)
{
}
#endif

static int sony_probe(struct hid_device *hdev, const struct hid_device_id *id)
Expand Down Expand Up @@ -728,6 +757,8 @@ static void sony_remove(struct hid_device *hdev)
if (sc->quirks & BUZZ_CONTROLLER)
buzz_remove(hdev);

sony_destroy_ff(hdev);

hid_hw_stop(hdev);
}

Expand Down
5 changes: 1 addition & 4 deletions drivers/hid/hid-wiimote-core.c
Original file line number Diff line number Diff line change
Expand Up @@ -834,8 +834,7 @@ static void wiimote_init_set_type(struct wiimote_data *wdata,
goto done;
}

if (vendor == USB_VENDOR_ID_NINTENDO ||
vendor == USB_VENDOR_ID_NINTENDO2) {
if (vendor == USB_VENDOR_ID_NINTENDO) {
if (product == USB_DEVICE_ID_NINTENDO_WIIMOTE) {
devtype = WIIMOTE_DEV_GEN10;
goto done;
Expand Down Expand Up @@ -1856,8 +1855,6 @@ static void wiimote_hid_remove(struct hid_device *hdev)
static const struct hid_device_id wiimote_hid_devices[] = {
{ HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_NINTENDO,
USB_DEVICE_ID_NINTENDO_WIIMOTE) },
{ HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_NINTENDO2,
USB_DEVICE_ID_NINTENDO_WIIMOTE) },
{ HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_NINTENDO,
USB_DEVICE_ID_NINTENDO_WIIMOTE2) },
{ }
Expand Down
2 changes: 1 addition & 1 deletion drivers/hid/uhid.c
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ static int uhid_event_from_user(const char __user *buffer, size_t len,
*/
struct uhid_create_req_compat *compat;

compat = kmalloc(sizeof(*compat), GFP_KERNEL);
compat = kzalloc(sizeof(*compat), GFP_KERNEL);
if (!compat)
return -ENOMEM;

Expand Down

0 comments on commit ba33fef

Please sign in to comment.