diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2013-04-30 12:37:55 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2013-04-30 12:37:55 -0400 |
commit | 19b344efa35dbc253e2d10403dafe6aafda73c56 (patch) | |
tree | 47c4ad25398642bcf1a93e186d77548ced3f7a2a /drivers/hid/hid-core.c | |
parent | 5d434fcb255dec99189f1c58a06e4f56e12bf77d (diff) | |
parent | ad1b890e06af049fb48d7ccb799d0e96c071c893 (diff) |
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/hid
Pull HID updates from Jiri Kosina:
- hid driver transport cleanup, finalizing the long-desired decoupling
of core from transport layers, by Benjamin Tissoires and Henrik
Rydberg
- support for hybrid finger/pen multitouch HID devices, by Benjamin
Tissoires
- fix for long-standing issue in Logitech unifying driver sometimes not
inializing properly due to device specifics, by Andrew de los Reyes
- Wii remote driver updates to support 2nd generation of devices, by
David Herrmann
- support for Apple IR remote
- roccat driver now supports new devices (Roccat Kone Pure, IskuFX), by
Stefan Achatz
- debugfs locking fixes in hid debug interface, by Jiri Kosina
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/hid: (43 commits)
HID: protect hid_debug_list
HID: debug: break out hid_dump_report() into hid-debug
HID: Add PID for Japanese version of NE4K keyboard
HID: hid-lg4ff add support for new version of DFGT wheel
HID: icade: u16 which never < 0
HID: clarify Magic Mouse Kconfig description
HID: appleir: add support for Apple ir devices
HID: roccat: added media key support for Kone
HID: hid-lenovo-tpkbd: remove doubled hid_get_drvdata
HID: i2c-hid: fix length for set/get report in i2c hid
HID: wiimote: parse reduced status reports
HID: wiimote: add 2nd generation Wii Remote IDs
HID: wiimote: use unique battery names
HID: hidraw: warn if userspace headers are outdated
HID: multitouch: force BTN_STYLUS for pen devices
HID: multitouch: append " Pen" to the name of the stylus input
HID: multitouch: add handling for pen in dual-sensors device
HID: multitouch: change touch sensor detection in mt_input_configured()
HID: multitouch: do not map usage from non used reports
HID: multitouch: breaks out touch handling in specific functions
...
Diffstat (limited to 'drivers/hid/hid-core.c')
-rw-r--r-- | drivers/hid/hid-core.c | 63 |
1 files changed, 33 insertions, 30 deletions
diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c index aa341d135867..6961bbeab3ed 100644 --- a/drivers/hid/hid-core.c +++ b/drivers/hid/hid-core.c | |||
@@ -728,8 +728,7 @@ static int hid_scan_report(struct hid_device *hid) | |||
728 | } else if (page == HID_UP_SENSOR && | 728 | } else if (page == HID_UP_SENSOR && |
729 | item.type == HID_ITEM_TYPE_MAIN && | 729 | item.type == HID_ITEM_TYPE_MAIN && |
730 | item.tag == HID_MAIN_ITEM_TAG_BEGIN_COLLECTION && | 730 | item.tag == HID_MAIN_ITEM_TAG_BEGIN_COLLECTION && |
731 | (item_udata(&item) & 0xff) == HID_COLLECTION_PHYSICAL && | 731 | (item_udata(&item) & 0xff) == HID_COLLECTION_PHYSICAL) |
732 | (hid->bus == BUS_USB || hid->bus == BUS_I2C)) | ||
733 | hid->group = HID_GROUP_SENSOR_HUB; | 732 | hid->group = HID_GROUP_SENSOR_HUB; |
734 | } | 733 | } |
735 | 734 | ||
@@ -1260,14 +1259,12 @@ int hid_input_report(struct hid_device *hid, int type, u8 *data, int size, int i | |||
1260 | struct hid_report_enum *report_enum; | 1259 | struct hid_report_enum *report_enum; |
1261 | struct hid_driver *hdrv; | 1260 | struct hid_driver *hdrv; |
1262 | struct hid_report *report; | 1261 | struct hid_report *report; |
1263 | char *buf; | ||
1264 | unsigned int i; | ||
1265 | int ret = 0; | 1262 | int ret = 0; |
1266 | 1263 | ||
1267 | if (!hid) | 1264 | if (!hid) |
1268 | return -ENODEV; | 1265 | return -ENODEV; |
1269 | 1266 | ||
1270 | if (down_trylock(&hid->driver_lock)) | 1267 | if (down_trylock(&hid->driver_input_lock)) |
1271 | return -EBUSY; | 1268 | return -EBUSY; |
1272 | 1269 | ||
1273 | if (!hid->driver) { | 1270 | if (!hid->driver) { |
@@ -1284,28 +1281,9 @@ int hid_input_report(struct hid_device *hid, int type, u8 *data, int size, int i | |||
1284 | } | 1281 | } |
1285 | 1282 | ||
1286 | /* Avoid unnecessary overhead if debugfs is disabled */ | 1283 | /* Avoid unnecessary overhead if debugfs is disabled */ |
1287 | if (list_empty(&hid->debug_list)) | 1284 | if (!list_empty(&hid->debug_list)) |
1288 | goto nomem; | 1285 | hid_dump_report(hid, type, data, size); |
1289 | |||
1290 | buf = kmalloc(sizeof(char) * HID_DEBUG_BUFSIZE, GFP_ATOMIC); | ||
1291 | |||
1292 | if (!buf) | ||
1293 | goto nomem; | ||
1294 | |||
1295 | /* dump the report */ | ||
1296 | snprintf(buf, HID_DEBUG_BUFSIZE - 1, | ||
1297 | "\nreport (size %u) (%snumbered) = ", size, report_enum->numbered ? "" : "un"); | ||
1298 | hid_debug_event(hid, buf); | ||
1299 | |||
1300 | for (i = 0; i < size; i++) { | ||
1301 | snprintf(buf, HID_DEBUG_BUFSIZE - 1, | ||
1302 | " %02x", data[i]); | ||
1303 | hid_debug_event(hid, buf); | ||
1304 | } | ||
1305 | hid_debug_event(hid, "\n"); | ||
1306 | kfree(buf); | ||
1307 | 1286 | ||
1308 | nomem: | ||
1309 | report = hid_get_report(report_enum, data); | 1287 | report = hid_get_report(report_enum, data); |
1310 | 1288 | ||
1311 | if (!report) { | 1289 | if (!report) { |
@@ -1324,7 +1302,7 @@ nomem: | |||
1324 | ret = hid_report_raw_event(hid, type, data, size, interrupt); | 1302 | ret = hid_report_raw_event(hid, type, data, size, interrupt); |
1325 | 1303 | ||
1326 | unlock: | 1304 | unlock: |
1327 | up(&hid->driver_lock); | 1305 | up(&hid->driver_input_lock); |
1328 | return ret; | 1306 | return ret; |
1329 | } | 1307 | } |
1330 | EXPORT_SYMBOL_GPL(hid_input_report); | 1308 | EXPORT_SYMBOL_GPL(hid_input_report); |
@@ -1502,8 +1480,6 @@ static const struct hid_device_id hid_have_special_driver[] = { | |||
1502 | { HID_USB_DEVICE(USB_VENDOR_ID_A4TECH, USB_DEVICE_ID_A4TECH_X5_005D) }, | 1480 | { HID_USB_DEVICE(USB_VENDOR_ID_A4TECH, USB_DEVICE_ID_A4TECH_X5_005D) }, |
1503 | { HID_USB_DEVICE(USB_VENDOR_ID_A4TECH, USB_DEVICE_ID_A4TECH_RP_649) }, | 1481 | { HID_USB_DEVICE(USB_VENDOR_ID_A4TECH, USB_DEVICE_ID_A4TECH_RP_649) }, |
1504 | { HID_USB_DEVICE(USB_VENDOR_ID_ACRUX, 0x0802) }, | 1482 | { HID_USB_DEVICE(USB_VENDOR_ID_ACRUX, 0x0802) }, |
1505 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ATV_IRCONTROL) }, | ||
1506 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_IRCONTROL4) }, | ||
1507 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_MIGHTYMOUSE) }, | 1483 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_MIGHTYMOUSE) }, |
1508 | { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_MAGICMOUSE) }, | 1484 | { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_MAGICMOUSE) }, |
1509 | { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_MAGICTRACKPAD) }, | 1485 | { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_MAGICTRACKPAD) }, |
@@ -1527,6 +1503,11 @@ static const struct hid_device_id hid_have_special_driver[] = { | |||
1527 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_HF_ANSI) }, | 1503 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_HF_ANSI) }, |
1528 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_HF_ISO) }, | 1504 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_HF_ISO) }, |
1529 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_HF_JIS) }, | 1505 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_HF_JIS) }, |
1506 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_IRCONTROL) }, | ||
1507 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_IRCONTROL2) }, | ||
1508 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_IRCONTROL3) }, | ||
1509 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_IRCONTROL4) }, | ||
1510 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_IRCONTROL5) }, | ||
1530 | { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_ANSI) }, | 1511 | { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_ANSI) }, |
1531 | { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_ISO) }, | 1512 | { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_ISO) }, |
1532 | { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_JIS) }, | 1513 | { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_JIS) }, |
@@ -1654,6 +1635,7 @@ static const struct hid_device_id hid_have_special_driver[] = { | |||
1654 | { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_COMFORT_MOUSE_4500) }, | 1635 | { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_COMFORT_MOUSE_4500) }, |
1655 | { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_SIDEWINDER_GV) }, | 1636 | { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_SIDEWINDER_GV) }, |
1656 | { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_NE4K) }, | 1637 | { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_NE4K) }, |
1638 | { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_NE4K_JP) }, | ||
1657 | { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_LK6K) }, | 1639 | { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_LK6K) }, |
1658 | { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_PRESENTER_8K_USB) }, | 1640 | { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_PRESENTER_8K_USB) }, |
1659 | { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_DIGITAL_MEDIA_3K) }, | 1641 | { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_DIGITAL_MEDIA_3K) }, |
@@ -1687,6 +1669,7 @@ static const struct hid_device_id hid_have_special_driver[] = { | |||
1687 | { HID_USB_DEVICE(USB_VENDOR_ID_ROCCAT, USB_DEVICE_ID_ROCCAT_ARVO) }, | 1669 | { HID_USB_DEVICE(USB_VENDOR_ID_ROCCAT, USB_DEVICE_ID_ROCCAT_ARVO) }, |
1688 | { HID_USB_DEVICE(USB_VENDOR_ID_ROCCAT, USB_DEVICE_ID_ROCCAT_ISKU) }, | 1670 | { HID_USB_DEVICE(USB_VENDOR_ID_ROCCAT, USB_DEVICE_ID_ROCCAT_ISKU) }, |
1689 | { HID_USB_DEVICE(USB_VENDOR_ID_ROCCAT, USB_DEVICE_ID_ROCCAT_KONEPLUS) }, | 1671 | { HID_USB_DEVICE(USB_VENDOR_ID_ROCCAT, USB_DEVICE_ID_ROCCAT_KONEPLUS) }, |
1672 | { HID_USB_DEVICE(USB_VENDOR_ID_ROCCAT, USB_DEVICE_ID_ROCCAT_KONEPURE) }, | ||
1690 | { HID_USB_DEVICE(USB_VENDOR_ID_ROCCAT, USB_DEVICE_ID_ROCCAT_KOVAPLUS) }, | 1673 | { HID_USB_DEVICE(USB_VENDOR_ID_ROCCAT, USB_DEVICE_ID_ROCCAT_KOVAPLUS) }, |
1691 | { HID_USB_DEVICE(USB_VENDOR_ID_ROCCAT, USB_DEVICE_ID_ROCCAT_LUA) }, | 1674 | { HID_USB_DEVICE(USB_VENDOR_ID_ROCCAT, USB_DEVICE_ID_ROCCAT_LUA) }, |
1692 | { HID_USB_DEVICE(USB_VENDOR_ID_ROCCAT, USB_DEVICE_ID_ROCCAT_PYRA_WIRED) }, | 1675 | { HID_USB_DEVICE(USB_VENDOR_ID_ROCCAT, USB_DEVICE_ID_ROCCAT_PYRA_WIRED) }, |
@@ -1747,6 +1730,7 @@ static const struct hid_device_id hid_have_special_driver[] = { | |||
1747 | 1730 | ||
1748 | { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_PRESENTER_8K_BT) }, | 1731 | { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_PRESENTER_8K_BT) }, |
1749 | { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_NINTENDO, USB_DEVICE_ID_NINTENDO_WIIMOTE) }, | 1732 | { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_NINTENDO, USB_DEVICE_ID_NINTENDO_WIIMOTE) }, |
1733 | { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_NINTENDO, USB_DEVICE_ID_NINTENDO_WIIMOTE2) }, | ||
1750 | { } | 1734 | { } |
1751 | }; | 1735 | }; |
1752 | 1736 | ||
@@ -1845,6 +1829,11 @@ static int hid_device_probe(struct device *dev) | |||
1845 | 1829 | ||
1846 | if (down_interruptible(&hdev->driver_lock)) | 1830 | if (down_interruptible(&hdev->driver_lock)) |
1847 | return -EINTR; | 1831 | return -EINTR; |
1832 | if (down_interruptible(&hdev->driver_input_lock)) { | ||
1833 | ret = -EINTR; | ||
1834 | goto unlock_driver_lock; | ||
1835 | } | ||
1836 | hdev->io_started = false; | ||
1848 | 1837 | ||
1849 | if (!hdev->driver) { | 1838 | if (!hdev->driver) { |
1850 | id = hid_match_device(hdev, hdrv); | 1839 | id = hid_match_device(hdev, hdrv); |
@@ -1867,6 +1856,9 @@ static int hid_device_probe(struct device *dev) | |||
1867 | } | 1856 | } |
1868 | } | 1857 | } |
1869 | unlock: | 1858 | unlock: |
1859 | if (!hdev->io_started) | ||
1860 | up(&hdev->driver_input_lock); | ||
1861 | unlock_driver_lock: | ||
1870 | up(&hdev->driver_lock); | 1862 | up(&hdev->driver_lock); |
1871 | return ret; | 1863 | return ret; |
1872 | } | 1864 | } |
@@ -1875,9 +1867,15 @@ static int hid_device_remove(struct device *dev) | |||
1875 | { | 1867 | { |
1876 | struct hid_device *hdev = container_of(dev, struct hid_device, dev); | 1868 | struct hid_device *hdev = container_of(dev, struct hid_device, dev); |
1877 | struct hid_driver *hdrv; | 1869 | struct hid_driver *hdrv; |
1870 | int ret = 0; | ||
1878 | 1871 | ||
1879 | if (down_interruptible(&hdev->driver_lock)) | 1872 | if (down_interruptible(&hdev->driver_lock)) |
1880 | return -EINTR; | 1873 | return -EINTR; |
1874 | if (down_interruptible(&hdev->driver_input_lock)) { | ||
1875 | ret = -EINTR; | ||
1876 | goto unlock_driver_lock; | ||
1877 | } | ||
1878 | hdev->io_started = false; | ||
1881 | 1879 | ||
1882 | hdrv = hdev->driver; | 1880 | hdrv = hdev->driver; |
1883 | if (hdrv) { | 1881 | if (hdrv) { |
@@ -1889,8 +1887,11 @@ static int hid_device_remove(struct device *dev) | |||
1889 | hdev->driver = NULL; | 1887 | hdev->driver = NULL; |
1890 | } | 1888 | } |
1891 | 1889 | ||
1890 | if (!hdev->io_started) | ||
1891 | up(&hdev->driver_input_lock); | ||
1892 | unlock_driver_lock: | ||
1892 | up(&hdev->driver_lock); | 1893 | up(&hdev->driver_lock); |
1893 | return 0; | 1894 | return ret; |
1894 | } | 1895 | } |
1895 | 1896 | ||
1896 | static ssize_t modalias_show(struct device *dev, struct device_attribute *a, | 1897 | static ssize_t modalias_show(struct device *dev, struct device_attribute *a, |
@@ -2340,7 +2341,9 @@ struct hid_device *hid_allocate_device(void) | |||
2340 | 2341 | ||
2341 | init_waitqueue_head(&hdev->debug_wait); | 2342 | init_waitqueue_head(&hdev->debug_wait); |
2342 | INIT_LIST_HEAD(&hdev->debug_list); | 2343 | INIT_LIST_HEAD(&hdev->debug_list); |
2344 | mutex_init(&hdev->debug_list_lock); | ||
2343 | sema_init(&hdev->driver_lock, 1); | 2345 | sema_init(&hdev->driver_lock, 1); |
2346 | sema_init(&hdev->driver_input_lock, 1); | ||
2344 | 2347 | ||
2345 | return hdev; | 2348 | return hdev; |
2346 | } | 2349 | } |