diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2013-09-07 12:48:41 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2013-09-07 12:48:41 -0400 |
commit | b04c99e3b845892d754ee8052d6324c39c4040de (patch) | |
tree | f2bcedc7977a43b731a0b5cb1030136d40ea2c1e /drivers/hid | |
parent | 44598f98b98e54beca34dc836b38eaea40be1abf (diff) |
Revert "Input: introduce BTN/ABS bits for drums and guitars"
This reverts commits 61e00655e9cb, 73f8645db191 and 8e22ecb603c8:
"Input: introduce BTN/ABS bits for drums and guitars"
"HID: wiimote: add support for Guitar-Hero drums"
"HID: wiimote: add support for Guitar-Hero guitars"
The extra new ABS_xx values resulted in ABS_MAX no longer being a
power-of-two, which broke the comparison logic. It also caused the
ioctl numbers to overflow into the next byte, causing problems for that.
We'll try again for 3.13.
Reported-by: Markus Trippelsdorf <markus@trippelsdorf.de>
Reported-by: Linus Torvalds <torvalds@linux-foundation.org>
Acked-by: David Herrmann <dh.herrmann@gmail.com>
Acked-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Cc: Benjamin Tissoires <benjamin.tissoires@gmail.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/hid')
-rw-r--r-- | drivers/hid/hid-wiimote-core.c | 14 | ||||
-rw-r--r-- | drivers/hid/hid-wiimote-modules.c | 392 | ||||
-rw-r--r-- | drivers/hid/hid-wiimote.h | 3 |
3 files changed, 0 insertions, 409 deletions
diff --git a/drivers/hid/hid-wiimote-core.c b/drivers/hid/hid-wiimote-core.c index bd2bc4a1f378..abb20db2b443 100644 --- a/drivers/hid/hid-wiimote-core.c +++ b/drivers/hid/hid-wiimote-core.c | |||
@@ -455,12 +455,6 @@ static __u8 wiimote_cmd_read_ext(struct wiimote_data *wdata, __u8 *rmem) | |||
455 | return WIIMOTE_EXT_BALANCE_BOARD; | 455 | return WIIMOTE_EXT_BALANCE_BOARD; |
456 | if (rmem[4] == 0x01 && rmem[5] == 0x20) | 456 | if (rmem[4] == 0x01 && rmem[5] == 0x20) |
457 | return WIIMOTE_EXT_PRO_CONTROLLER; | 457 | return WIIMOTE_EXT_PRO_CONTROLLER; |
458 | if (rmem[0] == 0x01 && rmem[1] == 0x00 && | ||
459 | rmem[4] == 0x01 && rmem[5] == 0x03) | ||
460 | return WIIMOTE_EXT_GUITAR_HERO_DRUMS; | ||
461 | if (rmem[0] == 0x00 && rmem[1] == 0x00 && | ||
462 | rmem[4] == 0x01 && rmem[5] == 0x03) | ||
463 | return WIIMOTE_EXT_GUITAR_HERO_GUITAR; | ||
464 | 458 | ||
465 | return WIIMOTE_EXT_UNKNOWN; | 459 | return WIIMOTE_EXT_UNKNOWN; |
466 | } | 460 | } |
@@ -494,8 +488,6 @@ static bool wiimote_cmd_map_mp(struct wiimote_data *wdata, __u8 exttype) | |||
494 | /* map MP with correct pass-through mode */ | 488 | /* map MP with correct pass-through mode */ |
495 | switch (exttype) { | 489 | switch (exttype) { |
496 | case WIIMOTE_EXT_CLASSIC_CONTROLLER: | 490 | case WIIMOTE_EXT_CLASSIC_CONTROLLER: |
497 | case WIIMOTE_EXT_GUITAR_HERO_DRUMS: | ||
498 | case WIIMOTE_EXT_GUITAR_HERO_GUITAR: | ||
499 | wmem = 0x07; | 491 | wmem = 0x07; |
500 | break; | 492 | break; |
501 | case WIIMOTE_EXT_NUNCHUK: | 493 | case WIIMOTE_EXT_NUNCHUK: |
@@ -1083,8 +1075,6 @@ static const char *wiimote_exttype_names[WIIMOTE_EXT_NUM] = { | |||
1083 | [WIIMOTE_EXT_CLASSIC_CONTROLLER] = "Nintendo Wii Classic Controller", | 1075 | [WIIMOTE_EXT_CLASSIC_CONTROLLER] = "Nintendo Wii Classic Controller", |
1084 | [WIIMOTE_EXT_BALANCE_BOARD] = "Nintendo Wii Balance Board", | 1076 | [WIIMOTE_EXT_BALANCE_BOARD] = "Nintendo Wii Balance Board", |
1085 | [WIIMOTE_EXT_PRO_CONTROLLER] = "Nintendo Wii U Pro Controller", | 1077 | [WIIMOTE_EXT_PRO_CONTROLLER] = "Nintendo Wii U Pro Controller", |
1086 | [WIIMOTE_EXT_GUITAR_HERO_DRUMS] = "Nintendo Wii Guitar Hero Drums", | ||
1087 | [WIIMOTE_EXT_GUITAR_HERO_GUITAR] = "Nintendo Wii Guitar Hero Guitar", | ||
1088 | }; | 1078 | }; |
1089 | 1079 | ||
1090 | /* | 1080 | /* |
@@ -1670,10 +1660,6 @@ static ssize_t wiimote_ext_show(struct device *dev, | |||
1670 | return sprintf(buf, "balanceboard\n"); | 1660 | return sprintf(buf, "balanceboard\n"); |
1671 | case WIIMOTE_EXT_PRO_CONTROLLER: | 1661 | case WIIMOTE_EXT_PRO_CONTROLLER: |
1672 | return sprintf(buf, "procontroller\n"); | 1662 | return sprintf(buf, "procontroller\n"); |
1673 | case WIIMOTE_EXT_GUITAR_HERO_DRUMS: | ||
1674 | return sprintf(buf, "drums\n"); | ||
1675 | case WIIMOTE_EXT_GUITAR_HERO_GUITAR: | ||
1676 | return sprintf(buf, "guitar\n"); | ||
1677 | case WIIMOTE_EXT_UNKNOWN: | 1663 | case WIIMOTE_EXT_UNKNOWN: |
1678 | /* fallthrough */ | 1664 | /* fallthrough */ |
1679 | default: | 1665 | default: |
diff --git a/drivers/hid/hid-wiimote-modules.c b/drivers/hid/hid-wiimote-modules.c index 7e124c351e67..2e7d644dba18 100644 --- a/drivers/hid/hid-wiimote-modules.c +++ b/drivers/hid/hid-wiimote-modules.c | |||
@@ -1834,396 +1834,6 @@ static const struct wiimod_ops wiimod_pro = { | |||
1834 | }; | 1834 | }; |
1835 | 1835 | ||
1836 | /* | 1836 | /* |
1837 | * Drums | ||
1838 | * Guitar-Hero, Rock-Band and other games came bundled with drums which can | ||
1839 | * be plugged as extension to a Wiimote. Drum-reports are still not entirely | ||
1840 | * figured out, but the most important information is known. | ||
1841 | * We create a separate device for drums and report all information via this | ||
1842 | * input device. | ||
1843 | */ | ||
1844 | |||
1845 | static inline void wiimod_drums_report_pressure(struct wiimote_data *wdata, | ||
1846 | __u8 none, __u8 which, | ||
1847 | __u8 pressure, __u8 onoff, | ||
1848 | __u8 *store, __u16 code, | ||
1849 | __u8 which_code) | ||
1850 | { | ||
1851 | static const __u8 default_pressure = 3; | ||
1852 | |||
1853 | if (!none && which == which_code) { | ||
1854 | *store = pressure; | ||
1855 | input_report_abs(wdata->extension.input, code, *store); | ||
1856 | } else if (onoff != !!*store) { | ||
1857 | *store = onoff ? default_pressure : 0; | ||
1858 | input_report_abs(wdata->extension.input, code, *store); | ||
1859 | } | ||
1860 | } | ||
1861 | |||
1862 | static void wiimod_drums_in_ext(struct wiimote_data *wdata, const __u8 *ext) | ||
1863 | { | ||
1864 | __u8 pressure, which, none, hhp, sx, sy; | ||
1865 | __u8 o, r, y, g, b, bass, bm, bp; | ||
1866 | |||
1867 | /* Byte | 8 | 7 | 6 | 5 | 4 | 3 | 2 | 1 | | ||
1868 | * -----+-----+-----+-----+-----+-----+-----+-----+-----+ | ||
1869 | * 1 | 0 | 0 | SX <5:0> | | ||
1870 | * 2 | 0 | 0 | SY <5:0> | | ||
1871 | * -----+-----+-----+-----------------------------+-----+ | ||
1872 | * 3 | HPP | NON | WHICH <5:1> | ? | | ||
1873 | * -----+-----+-----+-----+-----+-----+-----+-----+-----+ | ||
1874 | * 4 | SOFT <7:5> | 0 | 1 | 1 | 0 | ? | | ||
1875 | * -----+-----+-----+-----+-----+-----+-----+-----+-----+ | ||
1876 | * 5 | ? | 1 | 1 | B- | 1 | B+ | 1 | ? | | ||
1877 | * -----+-----+-----+-----+-----+-----+-----+-----+-----+ | ||
1878 | * 6 | O | R | Y | G | B | BSS | 1 | 1 | | ||
1879 | * -----+-----+-----+-----+-----+-----+-----+-----+-----+ | ||
1880 | * All buttons are 0 if pressed | ||
1881 | * | ||
1882 | * With Motion+ enabled, the following bits will get invalid: | ||
1883 | * Byte | 8 | 7 | 6 | 5 | 4 | 3 | 2 | 1 | | ||
1884 | * -----+-----+-----+-----+-----+-----+-----+-----+-----+ | ||
1885 | * 1 | 0 | 0 | SX <5:1> |XXXXX| | ||
1886 | * 2 | 0 | 0 | SY <5:1> |XXXXX| | ||
1887 | * -----+-----+-----+-----------------------------+-----+ | ||
1888 | * 3 | HPP | NON | WHICH <5:1> | ? | | ||
1889 | * -----+-----+-----+-----+-----+-----+-----+-----+-----+ | ||
1890 | * 4 | SOFT <7:5> | 0 | 1 | 1 | 0 | ? | | ||
1891 | * -----+-----+-----+-----+-----+-----+-----+-----+-----+ | ||
1892 | * 5 | ? | 1 | 1 | B- | 1 | B+ | 1 |XXXXX| | ||
1893 | * -----+-----+-----+-----+-----+-----+-----+-----+-----+ | ||
1894 | * 6 | O | R | Y | G | B | BSS |XXXXX|XXXXX| | ||
1895 | * -----+-----+-----+-----+-----+-----+-----+-----+-----+ | ||
1896 | */ | ||
1897 | |||
1898 | pressure = 7 - (ext[3] >> 5); | ||
1899 | which = (ext[2] >> 1) & 0x1f; | ||
1900 | none = !!(ext[2] & 0x40); | ||
1901 | hhp = !(ext[2] & 0x80); | ||
1902 | sx = ext[0] & 0x3f; | ||
1903 | sy = ext[1] & 0x3f; | ||
1904 | o = !(ext[5] & 0x80); | ||
1905 | r = !(ext[5] & 0x40); | ||
1906 | y = !(ext[5] & 0x20); | ||
1907 | g = !(ext[5] & 0x10); | ||
1908 | b = !(ext[5] & 0x08); | ||
1909 | bass = !(ext[5] & 0x04); | ||
1910 | bm = !(ext[4] & 0x10); | ||
1911 | bp = !(ext[4] & 0x04); | ||
1912 | |||
1913 | wiimod_drums_report_pressure(wdata, none, which, pressure, | ||
1914 | o, &wdata->state.pressure_drums[0], | ||
1915 | ABS_CYMBAL_RIGHT, 0x0e); | ||
1916 | wiimod_drums_report_pressure(wdata, none, which, pressure, | ||
1917 | r, &wdata->state.pressure_drums[1], | ||
1918 | ABS_TOM_LEFT, 0x19); | ||
1919 | wiimod_drums_report_pressure(wdata, none, which, pressure, | ||
1920 | y, &wdata->state.pressure_drums[2], | ||
1921 | ABS_CYMBAL_LEFT, 0x11); | ||
1922 | wiimod_drums_report_pressure(wdata, none, which, pressure, | ||
1923 | g, &wdata->state.pressure_drums[3], | ||
1924 | ABS_TOM_FAR_RIGHT, 0x12); | ||
1925 | wiimod_drums_report_pressure(wdata, none, which, pressure, | ||
1926 | b, &wdata->state.pressure_drums[4], | ||
1927 | ABS_TOM_RIGHT, 0x0f); | ||
1928 | |||
1929 | /* Bass shares pressure with hi-hat (set via hhp) */ | ||
1930 | wiimod_drums_report_pressure(wdata, none, hhp ? 0xff : which, pressure, | ||
1931 | bass, &wdata->state.pressure_drums[5], | ||
1932 | ABS_BASS, 0x1b); | ||
1933 | /* Hi-hat has no on/off values, just pressure. Force to off/0. */ | ||
1934 | wiimod_drums_report_pressure(wdata, none, hhp ? which : 0xff, pressure, | ||
1935 | 0, &wdata->state.pressure_drums[6], | ||
1936 | ABS_HI_HAT, 0x0e); | ||
1937 | |||
1938 | input_report_abs(wdata->extension.input, ABS_X, sx - 0x20); | ||
1939 | input_report_abs(wdata->extension.input, ABS_Y, sy - 0x20); | ||
1940 | |||
1941 | input_report_key(wdata->extension.input, BTN_START, bp); | ||
1942 | input_report_key(wdata->extension.input, BTN_SELECT, bm); | ||
1943 | |||
1944 | input_sync(wdata->extension.input); | ||
1945 | } | ||
1946 | |||
1947 | static int wiimod_drums_open(struct input_dev *dev) | ||
1948 | { | ||
1949 | struct wiimote_data *wdata = input_get_drvdata(dev); | ||
1950 | unsigned long flags; | ||
1951 | |||
1952 | spin_lock_irqsave(&wdata->state.lock, flags); | ||
1953 | wdata->state.flags |= WIIPROTO_FLAG_EXT_USED; | ||
1954 | wiiproto_req_drm(wdata, WIIPROTO_REQ_NULL); | ||
1955 | spin_unlock_irqrestore(&wdata->state.lock, flags); | ||
1956 | |||
1957 | return 0; | ||
1958 | } | ||
1959 | |||
1960 | static void wiimod_drums_close(struct input_dev *dev) | ||
1961 | { | ||
1962 | struct wiimote_data *wdata = input_get_drvdata(dev); | ||
1963 | unsigned long flags; | ||
1964 | |||
1965 | spin_lock_irqsave(&wdata->state.lock, flags); | ||
1966 | wdata->state.flags &= ~WIIPROTO_FLAG_EXT_USED; | ||
1967 | wiiproto_req_drm(wdata, WIIPROTO_REQ_NULL); | ||
1968 | spin_unlock_irqrestore(&wdata->state.lock, flags); | ||
1969 | } | ||
1970 | |||
1971 | static int wiimod_drums_probe(const struct wiimod_ops *ops, | ||
1972 | struct wiimote_data *wdata) | ||
1973 | { | ||
1974 | int ret; | ||
1975 | |||
1976 | wdata->extension.input = input_allocate_device(); | ||
1977 | if (!wdata->extension.input) | ||
1978 | return -ENOMEM; | ||
1979 | |||
1980 | input_set_drvdata(wdata->extension.input, wdata); | ||
1981 | wdata->extension.input->open = wiimod_drums_open; | ||
1982 | wdata->extension.input->close = wiimod_drums_close; | ||
1983 | wdata->extension.input->dev.parent = &wdata->hdev->dev; | ||
1984 | wdata->extension.input->id.bustype = wdata->hdev->bus; | ||
1985 | wdata->extension.input->id.vendor = wdata->hdev->vendor; | ||
1986 | wdata->extension.input->id.product = wdata->hdev->product; | ||
1987 | wdata->extension.input->id.version = wdata->hdev->version; | ||
1988 | wdata->extension.input->name = WIIMOTE_NAME " Drums"; | ||
1989 | |||
1990 | set_bit(EV_KEY, wdata->extension.input->evbit); | ||
1991 | set_bit(BTN_START, wdata->extension.input->keybit); | ||
1992 | set_bit(BTN_SELECT, wdata->extension.input->keybit); | ||
1993 | |||
1994 | set_bit(EV_ABS, wdata->extension.input->evbit); | ||
1995 | set_bit(ABS_X, wdata->extension.input->absbit); | ||
1996 | set_bit(ABS_Y, wdata->extension.input->absbit); | ||
1997 | set_bit(ABS_TOM_LEFT, wdata->extension.input->absbit); | ||
1998 | set_bit(ABS_TOM_RIGHT, wdata->extension.input->absbit); | ||
1999 | set_bit(ABS_TOM_FAR_RIGHT, wdata->extension.input->absbit); | ||
2000 | set_bit(ABS_CYMBAL_LEFT, wdata->extension.input->absbit); | ||
2001 | set_bit(ABS_CYMBAL_RIGHT, wdata->extension.input->absbit); | ||
2002 | set_bit(ABS_BASS, wdata->extension.input->absbit); | ||
2003 | set_bit(ABS_HI_HAT, wdata->extension.input->absbit); | ||
2004 | input_set_abs_params(wdata->extension.input, | ||
2005 | ABS_X, -32, 31, 1, 1); | ||
2006 | input_set_abs_params(wdata->extension.input, | ||
2007 | ABS_Y, -32, 31, 1, 1); | ||
2008 | input_set_abs_params(wdata->extension.input, | ||
2009 | ABS_TOM_LEFT, 0, 7, 0, 0); | ||
2010 | input_set_abs_params(wdata->extension.input, | ||
2011 | ABS_TOM_RIGHT, 0, 7, 0, 0); | ||
2012 | input_set_abs_params(wdata->extension.input, | ||
2013 | ABS_TOM_FAR_RIGHT, 0, 7, 0, 0); | ||
2014 | input_set_abs_params(wdata->extension.input, | ||
2015 | ABS_CYMBAL_LEFT, 0, 7, 0, 0); | ||
2016 | input_set_abs_params(wdata->extension.input, | ||
2017 | ABS_CYMBAL_RIGHT, 0, 7, 0, 0); | ||
2018 | input_set_abs_params(wdata->extension.input, | ||
2019 | ABS_BASS, 0, 7, 0, 0); | ||
2020 | input_set_abs_params(wdata->extension.input, | ||
2021 | ABS_HI_HAT, 0, 7, 0, 0); | ||
2022 | |||
2023 | ret = input_register_device(wdata->extension.input); | ||
2024 | if (ret) | ||
2025 | goto err_free; | ||
2026 | |||
2027 | return 0; | ||
2028 | |||
2029 | err_free: | ||
2030 | input_free_device(wdata->extension.input); | ||
2031 | wdata->extension.input = NULL; | ||
2032 | return ret; | ||
2033 | } | ||
2034 | |||
2035 | static void wiimod_drums_remove(const struct wiimod_ops *ops, | ||
2036 | struct wiimote_data *wdata) | ||
2037 | { | ||
2038 | if (!wdata->extension.input) | ||
2039 | return; | ||
2040 | |||
2041 | input_unregister_device(wdata->extension.input); | ||
2042 | wdata->extension.input = NULL; | ||
2043 | } | ||
2044 | |||
2045 | static const struct wiimod_ops wiimod_drums = { | ||
2046 | .flags = 0, | ||
2047 | .arg = 0, | ||
2048 | .probe = wiimod_drums_probe, | ||
2049 | .remove = wiimod_drums_remove, | ||
2050 | .in_ext = wiimod_drums_in_ext, | ||
2051 | }; | ||
2052 | |||
2053 | /* | ||
2054 | * Guitar | ||
2055 | * Guitar-Hero, Rock-Band and other games came bundled with guitars which can | ||
2056 | * be plugged as extension to a Wiimote. | ||
2057 | * We create a separate device for guitars and report all information via this | ||
2058 | * input device. | ||
2059 | */ | ||
2060 | |||
2061 | static void wiimod_guitar_in_ext(struct wiimote_data *wdata, const __u8 *ext) | ||
2062 | { | ||
2063 | __u8 sx, sy, tb, wb, bd, bm, bp, bo, br, bb, bg, by, bu; | ||
2064 | |||
2065 | /* Byte | 8 | 7 | 6 | 5 | 4 | 3 | 2 | 1 | | ||
2066 | * -----+-----+-----+-----+-----+-----+-----+-----+-----+ | ||
2067 | * 1 | 0 | 0 | SX <5:0> | | ||
2068 | * 2 | 0 | 0 | SY <5:0> | | ||
2069 | * -----+-----+-----+-----+-----------------------------+ | ||
2070 | * 3 | 0 | 0 | 0 | TB <4:0> | | ||
2071 | * -----+-----+-----+-----+-----------------------------+ | ||
2072 | * 4 | 0 | 0 | 0 | WB <4:0> | | ||
2073 | * -----+-----+-----+-----+-----+-----+-----+-----+-----+ | ||
2074 | * 5 | 1 | BD | 1 | B- | 1 | B+ | 1 | 1 | | ||
2075 | * -----+-----+-----+-----+-----+-----+-----+-----+-----+ | ||
2076 | * 6 | BO | BR | BB | BG | BY | 1 | 1 | BU | | ||
2077 | * -----+-----+-----+-----+-----+-----+-----+-----+-----+ | ||
2078 | * All buttons are 0 if pressed | ||
2079 | * | ||
2080 | * With Motion+ enabled, the following bits will get invalid: | ||
2081 | * Byte | 8 | 7 | 6 | 5 | 4 | 3 | 2 | 1 | | ||
2082 | * -----+-----+-----+-----+-----+-----+-----+-----+-----+ | ||
2083 | * 1 | 0 | 0 | SX <5:1> |XXXXX| | ||
2084 | * 2 | 0 | 0 | SY <5:1> |XXXXX| | ||
2085 | * -----+-----+-----+-----+-----------------------+-----+ | ||
2086 | * 3 | 0 | 0 | 0 | TB <4:0> | | ||
2087 | * -----+-----+-----+-----+-----------------------------+ | ||
2088 | * 4 | 0 | 0 | 0 | WB <4:0> | | ||
2089 | * -----+-----+-----+-----+-----+-----+-----+-----+-----+ | ||
2090 | * 5 | 1 | BD | 1 | B- | 1 | B+ | 1 |XXXXX| | ||
2091 | * -----+-----+-----+-----+-----+-----+-----+-----+-----+ | ||
2092 | * 6 | BO | BR | BB | BG | BY | 1 |XXXXX|XXXXX| | ||
2093 | * -----+-----+-----+-----+-----+-----+-----+-----+-----+ | ||
2094 | */ | ||
2095 | |||
2096 | sx = ext[0] & 0x3f; | ||
2097 | sy = ext[1] & 0x3f; | ||
2098 | tb = ext[2] & 0x1f; | ||
2099 | wb = ext[3] & 0x1f; | ||
2100 | bd = !(ext[4] & 0x40); | ||
2101 | bm = !(ext[4] & 0x10); | ||
2102 | bp = !(ext[4] & 0x04); | ||
2103 | bo = !(ext[5] & 0x80); | ||
2104 | br = !(ext[5] & 0x40); | ||
2105 | bb = !(ext[5] & 0x20); | ||
2106 | bg = !(ext[5] & 0x10); | ||
2107 | by = !(ext[5] & 0x08); | ||
2108 | bu = !(ext[5] & 0x01); | ||
2109 | |||
2110 | input_report_abs(wdata->extension.input, ABS_X, sx - 0x20); | ||
2111 | input_report_abs(wdata->extension.input, ABS_Y, sy - 0x20); | ||
2112 | input_report_abs(wdata->extension.input, ABS_FRET_BOARD, tb); | ||
2113 | input_report_abs(wdata->extension.input, ABS_WHAMMY_BAR, wb - 0x10); | ||
2114 | |||
2115 | input_report_key(wdata->extension.input, BTN_MODE, bm); | ||
2116 | input_report_key(wdata->extension.input, BTN_START, bp); | ||
2117 | input_report_key(wdata->extension.input, BTN_STRUM_BAR_UP, bu); | ||
2118 | input_report_key(wdata->extension.input, BTN_STRUM_BAR_DOWN, bd); | ||
2119 | input_report_key(wdata->extension.input, BTN_FRET_FAR_UP, bg); | ||
2120 | input_report_key(wdata->extension.input, BTN_FRET_UP, br); | ||
2121 | input_report_key(wdata->extension.input, BTN_FRET_MID, by); | ||
2122 | input_report_key(wdata->extension.input, BTN_FRET_LOW, bb); | ||
2123 | input_report_key(wdata->extension.input, BTN_FRET_FAR_LOW, bo); | ||
2124 | |||
2125 | input_sync(wdata->extension.input); | ||
2126 | } | ||
2127 | |||
2128 | static int wiimod_guitar_open(struct input_dev *dev) | ||
2129 | { | ||
2130 | struct wiimote_data *wdata = input_get_drvdata(dev); | ||
2131 | unsigned long flags; | ||
2132 | |||
2133 | spin_lock_irqsave(&wdata->state.lock, flags); | ||
2134 | wdata->state.flags |= WIIPROTO_FLAG_EXT_USED; | ||
2135 | wiiproto_req_drm(wdata, WIIPROTO_REQ_NULL); | ||
2136 | spin_unlock_irqrestore(&wdata->state.lock, flags); | ||
2137 | |||
2138 | return 0; | ||
2139 | } | ||
2140 | |||
2141 | static void wiimod_guitar_close(struct input_dev *dev) | ||
2142 | { | ||
2143 | struct wiimote_data *wdata = input_get_drvdata(dev); | ||
2144 | unsigned long flags; | ||
2145 | |||
2146 | spin_lock_irqsave(&wdata->state.lock, flags); | ||
2147 | wdata->state.flags &= ~WIIPROTO_FLAG_EXT_USED; | ||
2148 | wiiproto_req_drm(wdata, WIIPROTO_REQ_NULL); | ||
2149 | spin_unlock_irqrestore(&wdata->state.lock, flags); | ||
2150 | } | ||
2151 | |||
2152 | static int wiimod_guitar_probe(const struct wiimod_ops *ops, | ||
2153 | struct wiimote_data *wdata) | ||
2154 | { | ||
2155 | int ret; | ||
2156 | |||
2157 | wdata->extension.input = input_allocate_device(); | ||
2158 | if (!wdata->extension.input) | ||
2159 | return -ENOMEM; | ||
2160 | |||
2161 | input_set_drvdata(wdata->extension.input, wdata); | ||
2162 | wdata->extension.input->open = wiimod_guitar_open; | ||
2163 | wdata->extension.input->close = wiimod_guitar_close; | ||
2164 | wdata->extension.input->dev.parent = &wdata->hdev->dev; | ||
2165 | wdata->extension.input->id.bustype = wdata->hdev->bus; | ||
2166 | wdata->extension.input->id.vendor = wdata->hdev->vendor; | ||
2167 | wdata->extension.input->id.product = wdata->hdev->product; | ||
2168 | wdata->extension.input->id.version = wdata->hdev->version; | ||
2169 | wdata->extension.input->name = WIIMOTE_NAME " Guitar"; | ||
2170 | |||
2171 | set_bit(EV_KEY, wdata->extension.input->evbit); | ||
2172 | set_bit(BTN_MODE, wdata->extension.input->keybit); | ||
2173 | set_bit(BTN_START, wdata->extension.input->keybit); | ||
2174 | set_bit(BTN_FRET_FAR_UP, wdata->extension.input->keybit); | ||
2175 | set_bit(BTN_FRET_UP, wdata->extension.input->keybit); | ||
2176 | set_bit(BTN_FRET_MID, wdata->extension.input->keybit); | ||
2177 | set_bit(BTN_FRET_LOW, wdata->extension.input->keybit); | ||
2178 | set_bit(BTN_FRET_FAR_LOW, wdata->extension.input->keybit); | ||
2179 | set_bit(BTN_STRUM_BAR_UP, wdata->extension.input->keybit); | ||
2180 | set_bit(BTN_STRUM_BAR_DOWN, wdata->extension.input->keybit); | ||
2181 | |||
2182 | set_bit(EV_ABS, wdata->extension.input->evbit); | ||
2183 | set_bit(ABS_X, wdata->extension.input->absbit); | ||
2184 | set_bit(ABS_Y, wdata->extension.input->absbit); | ||
2185 | set_bit(ABS_FRET_BOARD, wdata->extension.input->absbit); | ||
2186 | set_bit(ABS_WHAMMY_BAR, wdata->extension.input->absbit); | ||
2187 | input_set_abs_params(wdata->extension.input, | ||
2188 | ABS_X, -32, 31, 1, 1); | ||
2189 | input_set_abs_params(wdata->extension.input, | ||
2190 | ABS_Y, -32, 31, 1, 1); | ||
2191 | input_set_abs_params(wdata->extension.input, | ||
2192 | ABS_FRET_BOARD, 0, 0x1f, 1, 1); | ||
2193 | input_set_abs_params(wdata->extension.input, | ||
2194 | ABS_WHAMMY_BAR, 0, 0x0f, 1, 1); | ||
2195 | |||
2196 | ret = input_register_device(wdata->extension.input); | ||
2197 | if (ret) | ||
2198 | goto err_free; | ||
2199 | |||
2200 | return 0; | ||
2201 | |||
2202 | err_free: | ||
2203 | input_free_device(wdata->extension.input); | ||
2204 | wdata->extension.input = NULL; | ||
2205 | return ret; | ||
2206 | } | ||
2207 | |||
2208 | static void wiimod_guitar_remove(const struct wiimod_ops *ops, | ||
2209 | struct wiimote_data *wdata) | ||
2210 | { | ||
2211 | if (!wdata->extension.input) | ||
2212 | return; | ||
2213 | |||
2214 | input_unregister_device(wdata->extension.input); | ||
2215 | wdata->extension.input = NULL; | ||
2216 | } | ||
2217 | |||
2218 | static const struct wiimod_ops wiimod_guitar = { | ||
2219 | .flags = 0, | ||
2220 | .arg = 0, | ||
2221 | .probe = wiimod_guitar_probe, | ||
2222 | .remove = wiimod_guitar_remove, | ||
2223 | .in_ext = wiimod_guitar_in_ext, | ||
2224 | }; | ||
2225 | |||
2226 | /* | ||
2227 | * Builtin Motion Plus | 1837 | * Builtin Motion Plus |
2228 | * This module simply sets the WIIPROTO_FLAG_BUILTIN_MP protocol flag which | 1838 | * This module simply sets the WIIPROTO_FLAG_BUILTIN_MP protocol flag which |
2229 | * disables polling for Motion-Plus. This should be set only for devices which | 1839 | * disables polling for Motion-Plus. This should be set only for devices which |
@@ -2473,6 +2083,4 @@ const struct wiimod_ops *wiimod_ext_table[WIIMOTE_EXT_NUM] = { | |||
2473 | [WIIMOTE_EXT_CLASSIC_CONTROLLER] = &wiimod_classic, | 2083 | [WIIMOTE_EXT_CLASSIC_CONTROLLER] = &wiimod_classic, |
2474 | [WIIMOTE_EXT_BALANCE_BOARD] = &wiimod_bboard, | 2084 | [WIIMOTE_EXT_BALANCE_BOARD] = &wiimod_bboard, |
2475 | [WIIMOTE_EXT_PRO_CONTROLLER] = &wiimod_pro, | 2085 | [WIIMOTE_EXT_PRO_CONTROLLER] = &wiimod_pro, |
2476 | [WIIMOTE_EXT_GUITAR_HERO_DRUMS] = &wiimod_drums, | ||
2477 | [WIIMOTE_EXT_GUITAR_HERO_GUITAR] = &wiimod_guitar, | ||
2478 | }; | 2086 | }; |
diff --git a/drivers/hid/hid-wiimote.h b/drivers/hid/hid-wiimote.h index 379cdfb6bd25..f1474f372c0b 100644 --- a/drivers/hid/hid-wiimote.h +++ b/drivers/hid/hid-wiimote.h | |||
@@ -88,8 +88,6 @@ enum wiimote_exttype { | |||
88 | WIIMOTE_EXT_CLASSIC_CONTROLLER, | 88 | WIIMOTE_EXT_CLASSIC_CONTROLLER, |
89 | WIIMOTE_EXT_BALANCE_BOARD, | 89 | WIIMOTE_EXT_BALANCE_BOARD, |
90 | WIIMOTE_EXT_PRO_CONTROLLER, | 90 | WIIMOTE_EXT_PRO_CONTROLLER, |
91 | WIIMOTE_EXT_GUITAR_HERO_DRUMS, | ||
92 | WIIMOTE_EXT_GUITAR_HERO_GUITAR, | ||
93 | WIIMOTE_EXT_NUM, | 91 | WIIMOTE_EXT_NUM, |
94 | }; | 92 | }; |
95 | 93 | ||
@@ -137,7 +135,6 @@ struct wiimote_state { | |||
137 | 135 | ||
138 | /* calibration data */ | 136 | /* calibration data */ |
139 | __u16 calib_bboard[4][3]; | 137 | __u16 calib_bboard[4][3]; |
140 | __u8 pressure_drums[7]; | ||
141 | }; | 138 | }; |
142 | 139 | ||
143 | struct wiimote_data { | 140 | struct wiimote_data { |