Commit 5fba0925 authored by Linus Torvalds's avatar Linus Torvalds

Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/hid

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/hid:
  HID: remove compat stuff
  HID: constify arrays of struct apple_key_translation
  HID: add support for Kye/Genius Ergo 525V
  HID: Support Apple mini aluminum keyboard
  HID: support for Kensington slimblade device
  HID: DragonRise game controller force feedback driver
  HID: add support for another version of 0e8f:0003 device in hid-pl
  HID: fix race between usb_register_dev() and hiddev_open()
  HID: bring back possibility to specify vid/pid ignore on module load
  HID: make HID_DEBUG defaults consistent
  HID: autosuspend -- fix lockup of hid on reset
  HID: hid_reset_resume() needs to be defined only when CONFIG_PM is set
  HID: fix USB HID devices after STD with autosuspend
  HID: do not try to compile PM code with CONFIG_PM unset
  HID: autosuspend support for USB HID
parents 811158b1 621de593
......@@ -283,13 +283,6 @@ Who: Glauber Costa <gcosta@redhat.com>
---------------------------
What: remove HID compat support
When: 2.6.29
Why: needed only as a temporary solution until distros fix themselves up
Who: Jiri Slaby <jirislaby@gmail.com>
---------------------------
What: print_fn_descriptor_symbol()
When: October 2009
Why: The %pF vsprintf format provides the same functionality in a
......
......@@ -29,11 +29,11 @@ config HID
For docs and specs, see http://www.usb.org/developers/hidpage/
If unsure, say Y
If unsure, say Y.
config HID_DEBUG
bool "HID debugging support"
default y if !EMBEDDED
default y
depends on HID
---help---
This option lets the HID layer output diagnostics about its internal
......@@ -44,7 +44,7 @@ config HID_DEBUG
This feature is useful for those who are either debugging the HID parser
or any HID hardware device.
If unsure, say N
If unsure, say Y.
config HIDRAW
bool "/dev/hidraw raw HID device support"
......@@ -70,18 +70,6 @@ source "drivers/hid/usbhid/Kconfig"
menu "Special HID drivers"
depends on HID
config HID_COMPAT
bool "Load all HID drivers on hid core load"
default y
---help---
Compatible option for older userspace. If you have system without udev
support of module loading through aliases and also old
module-init-tools which can't handle hid bus, choose Y here. Otherwise
say N. If you say N and your userspace is old enough, the only
functionality you lose is modules autoloading.
If unsure, say Y.
config HID_A4TECH
tristate "A4 tech" if EMBEDDED
depends on USB_HID
......@@ -128,6 +116,14 @@ config HID_CYPRESS
---help---
Support for cypress mouse and barcode readers.
config DRAGONRISE_FF
tristate "DragonRise Inc. force feedback support"
depends on USB_HID
select INPUT_FF_MEMLESS
---help---
Say Y here if you want to enable force feedback support for DragonRise Inc.
game controllers.
config HID_EZKEY
tristate "Ezkey" if EMBEDDED
depends on USB_HID
......@@ -135,6 +131,13 @@ config HID_EZKEY
---help---
Support for Ezkey BTC 8193 keyboard.
config HID_KYE
tristate "Kye" if EMBEDDED
depends on USB_HID
default !EMBEDDED
---help---
Support for Kye/Genius Ergo Mouse.
config HID_GYRATION
tristate "Gyration" if EMBEDDED
depends on USB_HID
......@@ -142,6 +145,13 @@ config HID_GYRATION
---help---
Support for Gyration remote control.
config HID_KENSINGTON
tristate "Kensington" if EMBEDDED
depends on USB_HID
default !EMBEDDED
---help---
Support for Kensington Slimblade Trackball.
config HID_LOGITECH
tristate "Logitech" if EMBEDDED
depends on USB_HID
......
......@@ -8,10 +8,6 @@ obj-$(CONFIG_HID) += hid.o
hid-$(CONFIG_HID_DEBUG) += hid-debug.o
hid-$(CONFIG_HIDRAW) += hidraw.o
ifdef CONFIG_HID_COMPAT
obj-m += hid-dummy.o
endif
hid-logitech-objs := hid-lg.o
ifdef CONFIG_LOGITECH_FF
hid-logitech-objs += hid-lgff.o
......@@ -26,8 +22,11 @@ obj-$(CONFIG_HID_BELKIN) += hid-belkin.o
obj-$(CONFIG_HID_CHERRY) += hid-cherry.o
obj-$(CONFIG_HID_CHICONY) += hid-chicony.o
obj-$(CONFIG_HID_CYPRESS) += hid-cypress.o
obj-$(CONFIG_DRAGONRISE_FF) += hid-drff.o
obj-$(CONFIG_HID_EZKEY) += hid-ezkey.o
obj-$(CONFIG_HID_GYRATION) += hid-gyration.o
obj-$(CONFIG_HID_KENSINGTON) += hid-kensington.o
obj-$(CONFIG_HID_KYE) += hid-kye.o
obj-$(CONFIG_HID_LOGITECH) += hid-logitech.o
obj-$(CONFIG_HID_MICROSOFT) += hid-microsoft.o
obj-$(CONFIG_HID_MONTEREY) += hid-monterey.o
......
......@@ -158,5 +158,3 @@ static void a4_exit(void)
module_init(a4_init);
module_exit(a4_exit);
MODULE_LICENSE("GPL");
HID_COMPAT_LOAD_DRIVER(a4tech);
......@@ -53,7 +53,7 @@ struct apple_key_translation {
u8 flags;
};
static struct apple_key_translation apple_fn_keys[] = {
static const struct apple_key_translation apple_fn_keys[] = {
{ KEY_BACKSPACE, KEY_DELETE },
{ KEY_ENTER, KEY_INSERT },
{ KEY_F1, KEY_BRIGHTNESSDOWN, APPLE_FLAG_FKEY },
......@@ -75,7 +75,7 @@ static struct apple_key_translation apple_fn_keys[] = {
{ }
};
static struct apple_key_translation powerbook_fn_keys[] = {
static const struct apple_key_translation powerbook_fn_keys[] = {
{ KEY_BACKSPACE, KEY_DELETE },
{ KEY_F1, KEY_BRIGHTNESSDOWN, APPLE_FLAG_FKEY },
{ KEY_F2, KEY_BRIGHTNESSUP, APPLE_FLAG_FKEY },
......@@ -94,7 +94,7 @@ static struct apple_key_translation powerbook_fn_keys[] = {
{ }
};
static struct apple_key_translation powerbook_numlock_keys[] = {
static const struct apple_key_translation powerbook_numlock_keys[] = {
{ KEY_J, KEY_KP1 },
{ KEY_K, KEY_KP2 },
{ KEY_L, KEY_KP3 },
......@@ -117,16 +117,16 @@ static struct apple_key_translation powerbook_numlock_keys[] = {
{ }
};
static struct apple_key_translation apple_iso_keyboard[] = {
static const struct apple_key_translation apple_iso_keyboard[] = {
{ KEY_GRAVE, KEY_102ND },
{ KEY_102ND, KEY_GRAVE },
{ }
};
static struct apple_key_translation *apple_find_translation(
struct apple_key_translation *table, u16 from)
static const struct apple_key_translation *apple_find_translation(
const struct apple_key_translation *table, u16 from)
{
struct apple_key_translation *trans;
const struct apple_key_translation *trans;
/* Look for the translation */
for (trans = table; trans->from; trans++)
......@@ -140,7 +140,7 @@ static int hidinput_apple_event(struct hid_device *hid, struct input_dev *input,
struct hid_usage *usage, __s32 value)
{
struct apple_sc *asc = hid_get_drvdata(hid);
struct apple_key_translation *trans;
const struct apple_key_translation *trans;
if (usage->code == KEY_FN) {
asc->fn_on = !!value;
......@@ -253,7 +253,7 @@ static void apple_report_fixup(struct hid_device *hdev, __u8 *rdesc,
static void apple_setup_input(struct input_dev *input)
{
struct apple_key_translation *trans;
const struct apple_key_translation *trans;
set_bit(KEY_NUMLOCK, input->keybit);
......@@ -387,6 +387,12 @@ static const struct hid_device_id apple_devices[] = {
{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_JIS),
.driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN |
APPLE_RDESC_JIS },
{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_MINI_ANSI),
.driver_data = APPLE_HAS_FN },
{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_MINI_ISO),
.driver_data = APPLE_HAS_FN | APPLE_ISO_KEYBOARD },
{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_MINI_JIS),
.driver_data = APPLE_HAS_FN },
{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_ANSI),
.driver_data = APPLE_HAS_FN },
{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_ISO),
......@@ -468,5 +474,3 @@ static void apple_exit(void)
module_init(apple_init);
module_exit(apple_exit);
MODULE_LICENSE("GPL");
HID_COMPAT_LOAD_DRIVER(apple);
......@@ -101,5 +101,3 @@ static void belkin_exit(void)
module_init(belkin_init);
module_exit(belkin_exit);
MODULE_LICENSE("GPL");
HID_COMPAT_LOAD_DRIVER(belkin);
......@@ -83,5 +83,3 @@ static void ch_exit(void)
module_init(ch_init);
module_exit(ch_exit);
MODULE_LICENSE("GPL");
HID_COMPAT_LOAD_DRIVER(cherry);
......@@ -76,5 +76,3 @@ static void ch_exit(void)
module_init(ch_init);
module_exit(ch_exit);
MODULE_LICENSE("GPL");
HID_COMPAT_LOAD_DRIVER(chicony);
......@@ -1236,6 +1236,9 @@ static const struct hid_device_id hid_blacklist[] = {
{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_ANSI) },
{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_ISO) },
{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_JIS) },
{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_MINI_ANSI) },
{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_MINI_ISO) },
{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_MINI_JIS) },
{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_ANSI) },
{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_ISO) },
{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_JIS) },
......@@ -1262,6 +1265,7 @@ static const struct hid_device_id hid_blacklist[] = {
{ HID_USB_DEVICE(USB_VENDOR_ID_CYPRESS, USB_DEVICE_ID_CYPRESS_BARCODE_1) },
{ HID_USB_DEVICE(USB_VENDOR_ID_CYPRESS, USB_DEVICE_ID_CYPRESS_BARCODE_2) },
{ HID_USB_DEVICE(USB_VENDOR_ID_CYPRESS, USB_DEVICE_ID_CYPRESS_MOUSE) },
{ HID_USB_DEVICE(USB_VENDOR_ID_DRAGONRISE, 0x0006) },
{ HID_USB_DEVICE(USB_VENDOR_ID_EZKEY, USB_DEVICE_ID_BTC_8193) },
{ HID_USB_DEVICE(USB_VENDOR_ID_GAMERON, USB_DEVICE_ID_GAMERON_DUAL_PSX_ADAPTOR) },
{ HID_USB_DEVICE(USB_VENDOR_ID_GAMERON, USB_DEVICE_ID_GAMERON_DUAL_PCS_ADAPTOR) },
......@@ -1269,6 +1273,8 @@ static const struct hid_device_id hid_blacklist[] = {
{ HID_USB_DEVICE(USB_VENDOR_ID_GREENASIA, 0x0012) },
{ HID_USB_DEVICE(USB_VENDOR_ID_GYRATION, USB_DEVICE_ID_GYRATION_REMOTE) },
{ HID_USB_DEVICE(USB_VENDOR_ID_GYRATION, USB_DEVICE_ID_GYRATION_REMOTE_2) },
{ HID_USB_DEVICE(USB_VENDOR_ID_KENSINGTON, USB_DEVICE_ID_KS_SLIMBLADE) },
{ HID_USB_DEVICE(USB_VENDOR_ID_KYE, USB_DEVICE_ID_KYE_ERGO_525V) },
{ HID_USB_DEVICE(USB_VENDOR_ID_LABTEC, USB_DEVICE_ID_LABTEC_WIRELESS_KEYBOARD) },
{ HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_MX3000_RECEIVER) },
{ HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_S510_RECEIVER) },
......@@ -1813,14 +1819,21 @@ void hid_unregister_driver(struct hid_driver *hdrv)
}
EXPORT_SYMBOL_GPL(hid_unregister_driver);
#ifdef CONFIG_HID_COMPAT
static void hid_compat_load(struct work_struct *ws)
int hid_check_keys_pressed(struct hid_device *hid)
{
request_module("hid-dummy");
struct hid_input *hidinput;
int i;
list_for_each_entry(hidinput, &hid->inputs, list) {
for (i = 0; i < BITS_TO_LONGS(KEY_MAX); i++)
if (hidinput->input->key[i])
return 1;
}
return 0;
}
static DECLARE_WORK(hid_compat_work, hid_compat_load);
static struct workqueue_struct *hid_compat_wq;
#endif
EXPORT_SYMBOL_GPL(hid_check_keys_pressed);
static int __init hid_init(void)
{
......@@ -1836,15 +1849,6 @@ static int __init hid_init(void)
if (ret)
goto err_bus;
#ifdef CONFIG_HID_COMPAT
hid_compat_wq = create_singlethread_workqueue("hid_compat");
if (!hid_compat_wq) {
hidraw_exit();
goto err;
}
queue_work(hid_compat_wq, &hid_compat_work);
#endif
return 0;
err_bus:
bus_unregister(&hid_bus_type);
......@@ -1854,9 +1858,6 @@ static int __init hid_init(void)
static void __exit hid_exit(void)
{
#ifdef CONFIG_HID_COMPAT
destroy_workqueue(hid_compat_wq);
#endif
hidraw_exit();
bus_unregister(&hid_bus_type);
}
......
......@@ -154,5 +154,3 @@ static void cp_exit(void)
module_init(cp_init);
module_exit(cp_exit);
MODULE_LICENSE("GPL");
HID_COMPAT_LOAD_DRIVER(cypress);
/*
* Force feedback support for DragonRise Inc. game controllers
*
* From what I have gathered, these devices are mass produced in China and are
* distributed under several vendors. They often share the same design as
* the original PlayStation DualShock controller.
*
* 0079:0006 "DragonRise Inc. Generic USB Joystick "
* - tested with a Tesun USB-703 game controller.
*
* Copyright (c) 2009 Richard Walmsley <richwalm@gmail.com>
*/
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include <linux/input.h>
#include <linux/usb.h>
#include <linux/hid.h>
#include "hid-ids.h"
#include "usbhid/usbhid.h"
struct drff_device {
struct hid_report *report;
};
static int drff_play(struct input_dev *dev, void *data,
struct ff_effect *effect)
{
struct hid_device *hid = input_get_drvdata(dev);
struct drff_device *drff = data;
int strong, weak;
strong = effect->u.rumble.strong_magnitude;
weak = effect->u.rumble.weak_magnitude;
dbg_hid("called with 0x%04x 0x%04x", strong, weak);
if (strong || weak) {
strong = strong * 0xff / 0xffff;
weak = weak * 0xff / 0xffff;
/* While reverse engineering this device, I found that when
this value is set, it causes the strong rumble to function
at a near maximum speed, so we'll bypass it. */
if (weak == 0x0a)
weak = 0x0b;
drff->report->field[0]->value[0] = 0x51;
drff->report->field[0]->value[1] = 0x00;
drff->report->field[0]->value[2] = weak;
drff->report->field[0]->value[4] = strong;
usbhid_submit_report(hid, drff->report, USB_DIR_OUT);
drff->report->field[0]->value[0] = 0xfa;
drff->report->field[0]->value[1] = 0xfe;
} else {
drff->report->field[0]->value[0] = 0xf3;
drff->report->field[0]->value[1] = 0x00;
}
drff->report->field[0]->value[2] = 0x00;
drff->report->field[0]->value[4] = 0x00;
dbg_hid("running with 0x%02x 0x%02x", strong, weak);
usbhid_submit_report(hid, drff->report, USB_DIR_OUT);
return 0;
}
static int drff_init(struct hid_device *hid)
{
struct drff_device *drff;
struct hid_report *report;
struct hid_input *hidinput = list_first_entry(&hid->inputs,
struct hid_input, list);
struct list_head *report_list =
&hid->report_enum[HID_OUTPUT_REPORT].report_list;
struct input_dev *dev = hidinput->input;
int error;
if (list_empty(report_list)) {
dev_err(&hid->dev, "no output reports found\n");
return -ENODEV;
}
report = list_first_entry(report_list, struct hid_report, list);
if (report->maxfield < 1) {
dev_err(&hid->dev, "no fields in the report\n");
return -ENODEV;
}
if (report->field[0]->report_count < 7) {
dev_err(&hid->dev, "not enough values in the field\n");
return -ENODEV;
}
drff = kzalloc(sizeof(struct drff_device), GFP_KERNEL);
if (!drff)
return -ENOMEM;
set_bit(FF_RUMBLE, dev->ffbit);
error = input_ff_create_memless(dev, drff, drff_play);
if (error) {
kfree(drff);
return error;
}
drff->report = report;
drff->report->field[0]->value[0] = 0xf3;
drff->report->field[0]->value[1] = 0x00;
drff->report->field[0]->value[2] = 0x00;
drff->report->field[0]->value[3] = 0x00;
drff->report->field[0]->value[4] = 0x00;
drff->report->field[0]->value[5] = 0x00;
drff->report->field[0]->value[6] = 0x00;
usbhid_submit_report(hid, drff->report, USB_DIR_OUT);
dev_info(&hid->dev, "Force Feedback for DragonRise Inc. game "
"controllers by Richard Walmsley <richwalm@gmail.com>\n");
return 0;
}
static int dr_probe(struct hid_device *hdev, const struct hid_device_id *id)
{
int ret;
dev_dbg(&hdev->dev, "DragonRise Inc. HID hardware probe...");
ret = hid_parse(hdev);
if (ret) {
dev_err(&hdev->dev, "parse failed\n");
goto err;
}
ret = hid_hw_start(hdev, HID_CONNECT_DEFAULT & ~HID_CONNECT_FF);
if (ret) {
dev_err(&hdev->dev, "hw start failed\n");
goto err;
}
drff_init(hdev);
return 0;
err:
return ret;
}
static const struct hid_device_id dr_devices[] = {
{ HID_USB_DEVICE(USB_VENDOR_ID_DRAGONRISE, 0x0006), },
{ }
};
MODULE_DEVICE_TABLE(hid, dr_devices);
static struct hid_driver dr_driver = {
.name = "dragonrise",
.id_table = dr_devices,
.probe = dr_probe,
};
static int __init dr_init(void)
{
return hid_register_driver(&dr_driver);
}
static void __exit dr_exit(void)
{
hid_unregister_driver(&dr_driver);
}
module_init(dr_init);
module_exit(dr_exit);
MODULE_LICENSE("GPL");
#include <linux/autoconf.h>
#include <linux/module.h>
#include <linux/hid.h>
static int __init hid_dummy_init(void)
{
#ifdef CONFIG_HID_A4TECH_MODULE
HID_COMPAT_CALL_DRIVER(a4tech);
#endif
#ifdef CONFIG_HID_APPLE_MODULE
HID_COMPAT_CALL_DRIVER(apple);
#endif
#ifdef CONFIG_HID_BELKIN_MODULE
HID_COMPAT_CALL_DRIVER(belkin);
#endif
#ifdef CONFIG_HID_BRIGHT_MODULE
HID_COMPAT_CALL_DRIVER(bright);
#endif
#ifdef CONFIG_HID_CHERRY_MODULE
HID_COMPAT_CALL_DRIVER(cherry);
#endif
#ifdef CONFIG_HID_CHICONY_MODULE
HID_COMPAT_CALL_DRIVER(chicony);
#endif
#ifdef CONFIG_HID_CYPRESS_MODULE
HID_COMPAT_CALL_DRIVER(cypress);
#endif
#ifdef CONFIG_HID_DELL_MODULE
HID_COMPAT_CALL_DRIVER(dell);
#endif
#ifdef CONFIG_HID_EZKEY_MODULE
HID_COMPAT_CALL_DRIVER(ezkey);
#endif
#ifdef CONFIG_HID_GYRATION_MODULE
HID_COMPAT_CALL_DRIVER(gyration);
#endif
#ifdef CONFIG_HID_LOGITECH_MODULE
HID_COMPAT_CALL_DRIVER(logitech);
#endif
#ifdef CONFIG_HID_MICROSOFT_MODULE
HID_COMPAT_CALL_DRIVER(microsoft);
#endif
#ifdef CONFIG_HID_MONTEREY_MODULE
HID_COMPAT_CALL_DRIVER(monterey);
#endif
#ifdef CONFIG_HID_NTRIG_MODULE
HID_COMPAT_CALL_DRIVER(ntrig);
#endif
#ifdef CONFIG_HID_PANTHERLORD_MODULE
HID_COMPAT_CALL_DRIVER(pantherlord);
#endif
#ifdef CONFIG_HID_PETALYNX_MODULE
HID_COMPAT_CALL_DRIVER(petalynx);
#endif
#ifdef CONFIG_HID_SAMSUNG_MODULE
HID_COMPAT_CALL_DRIVER(samsung);
#endif
#ifdef CONFIG_HID_SONY_MODULE
HID_COMPAT_CALL_DRIVER(sony);
#endif
#ifdef CONFIG_HID_SUNPLUS_MODULE
HID_COMPAT_CALL_DRIVER(sunplus);
#endif
#ifdef CONFIG_GREENASIA_FF_MODULE
HID_COMPAT_CALL_DRIVER(greenasia);
#endif
#ifdef CONFIG_THRUSTMASTER_FF_MODULE
HID_COMPAT_CALL_DRIVER(thrustmaster);
#endif
#ifdef CONFIG_ZEROPLUS_FF_MODULE
HID_COMPAT_CALL_DRIVER(zeroplus);
#endif
return -EIO;
}
module_init(hid_dummy_init);
MODULE_LICENSE("GPL");
......@@ -91,5 +91,3 @@ static void ez_exit(void)
module_init(ez_init);
module_exit(ez_exit);
MODULE_LICENSE("GPL");
HID_COMPAT_LOAD_DRIVER(ezkey);
......@@ -181,5 +181,3 @@ static void __exit ga_exit(void)
module_init(ga_init);
module_exit(ga_exit);
MODULE_LICENSE("GPL");
HID_COMPAT_LOAD_DRIVER(greenasia);
......@@ -94,5 +94,3 @@ static void gyration_exit(void)
module_init(gyration_init);
module_exit(gyration_exit);
MODULE_LICENSE("GPL");
HID_COMPAT_LOAD_DRIVER(gyration);
......@@ -67,6 +67,9 @@
#define USB_DEVICE_ID_APPLE_GEYSER4_ANSI 0x021a
#define USB_DEVICE_ID_APPLE_GEYSER4_ISO 0x021b
#define USB_DEVICE_ID_APPLE_GEYSER4_JIS 0x021c
#define USB_DEVICE_ID_APPLE_ALU_MINI_ANSI 0x021d
#define USB_DEVICE_ID_APPLE_ALU_MINI_ISO 0x021e
#define USB_DEVICE_ID_APPLE_ALU_MINI_JIS 0x021f
#define USB_DEVICE_ID_APPLE_ALU_ANSI 0x0220
#define USB_DEVICE_ID_APPLE_ALU_ISO 0x0221
#define USB_DEVICE_ID_APPLE_ALU_JIS 0x0222
......@@ -148,6 +151,8 @@
#define USB_VENDOR_ID_DMI 0x0c0b
#define USB_DEVICE_ID_DMI_ENC 0x5fab
#define USB_VENDOR_ID_DRAGONRISE 0x0079
#define USB_VENDOR_ID_ELO 0x04E7
#define USB_DEVICE_ID_ELO_TS2700 0x0020
......@@ -272,6 +277,9 @@
#define USB_DEVICE_ID_LD_POWERCONTROL 0x2030
#define USB_DEVICE_ID_LD_MACHINETEST 0x2040
#define USB_VENDOR_ID_KENSINGTON 0x047d
#define USB_DEVICE_ID_KS_SLIMBLADE 0x2041
#define USB_VENDOR_ID_LOGITECH 0x046d
#define USB_DEVICE_ID_LOGITECH_RECEIVER 0xc101
#define USB_DEVICE_ID_LOGITECH_HARMONY_FIRST 0xc110
......@@ -418,6 +426,8 @@
#define USB_VENDOR_ID_ZEROPLUS 0x0c12
#define USB_VENDOR_ID_KYE 0x0458
#define USB_DEVICE_ID_KYE_ERGO_525V 0x0087
#define USB_DEVICE_ID_KYE_GPEN_560 0x5003
#endif
/*
* HID driver for Kensigton Slimblade Trackball
*
* Copyright (c) 2009 Jiri Kosina
*/
/*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
* Software Foundation; either version 2 of the License, or (at your option)
* any later version.
*/
#include <linux/device.h>
#include <linux/input.h>
#include <linux/hid.h>
#include <linux/module.h>
#include "hid-ids.h"
#define ks_map_key(c) hid_map_usage(hi, usage, bit, max, EV_KEY, (c))
static int ks_input_mapping(struct hid_device *hdev, struct hid_input *hi,
struct hid_field *field, struct hid_usage *usage,
unsigned long **bit, int *max)
{
if ((usage->hid & HID_USAGE_PAGE) != HID_UP_MSVENDOR)
return 0;
switch (usage->hid & HID_USAGE) {
case 0x01: ks_map_key(BTN_MIDDLE); break;
case 0x02: ks_map_key(BTN_SIDE); break;
default:
return 0;
}
return 1;
}
static const struct hid_device_id ks_devices[] = {
{ HID_USB_DEVICE(USB_VENDOR_ID_KENSINGTON, USB_DEVICE_ID_KS_SLIMBLADE) },
{ }
};
MODULE_DEVICE_TABLE(hid, ks_devices);
static struct hid_driver ks_driver = {
.name = "kensington",
.id_table = ks_devices,
.input_mapping = ks_input_mapping,
};
static int ks_init(void)
{
return hid_register_driver(&ks_driver);
}
static void ks_exit(void)
{
hid_unregister_driver(&ks_driver);
}
module_init(ks_init);
module_exit(ks_exit);
MODULE_LICENSE("GPL");
/*
* HID driver for Kye/Genius devices not fully compliant with HID standard
*
* Copyright (c) 2009 Jiri Kosina
* Copyright (c) 2009 Tomas Hanak
*/
/*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
* Software Foundation; either version 2 of the License, or (at your option)
* any later version.
*/
#include <linux/device.h>
#include <linux/hid.h>
#include <linux/module.h>
#include "hid-ids.h"
/* the fixups that need to be done:
* - change led usage page to button for extra buttons
* - report size 8 count 1 must be size 1 count 8 for button bitfield
* - change the button usage range to 4-7 for the extra buttons
*/
static void kye_report_fixup(struct hid_device *hdev, __u8 *rdesc,
unsigned int rsize)
{
if (rsize >= 74 &&
rdesc[61] == 0x05 && rdesc[62] == 0x08 &&
rdesc[63] == 0x19 && rdesc[64] == 0x08 &&
rdesc[65] == 0x29 && rdesc[66] == 0x0f &&
rdesc[71] == 0x75 && rdesc[72] == 0x08 &&
rdesc[73] == 0x95 && rdesc[74] == 0x01) {
dev_info(&hdev->dev, "fixing up Kye/Genius Ergo Mouse report "
"descriptor\n");
rdesc[62] = 0x09;
rdesc[64] = 0x04;
rdesc[66] = 0x07;
rdesc[72] = 0x01;
rdesc[74] = 0x08;
}
}
static const struct hid_device_id kye_devices[] = {
{ HID_USB_DEVICE(USB_VENDOR_ID_KYE, USB_DEVICE_ID_KYE_ERGO_525V) },
{ }
};
MODULE_DEVICE_TABLE(hid, kye_devices);
static struct hid_driver kye_driver = {
.name = "kye",
.id_table = kye_devices,
.report_fixup = kye_report_fixup,
};
static int kye_init(void)
{
return hid_register_driver(&kye_driver);
}
static void kye_exit(void)
{
hid_unregister_driver(&kye_driver);
}
module_init(kye_init);
module_exit(kye_exit);
MODULE_LICENSE("GPL");
......@@ -326,5 +326,3 @@ static void lg_exit(void)
module_init(lg_init);
module_exit(lg_exit);
MODULE_LICENSE("GPL");
HID_COMPAT_LOAD_DRIVER(logitech);
......@@ -210,5 +210,3 @@ static void ms_exit(void)
module_init(ms_init);
module_exit(ms_exit);
MODULE_LICENSE("GPL");
HID_COMPAT_LOAD_DRIVER(microsoft);
......@@ -78,5 +78,3 @@ static void mr_exit(void)
module_init(mr_init);
module_exit(mr_exit);
MODULE_LICENSE("GPL");
HID_COMPAT_LOAD_DRIVER(monterey);
......@@ -78,5 +78,3 @@ static void ntrig_exit(void)
module_init(ntrig_init);
module_exit(ntrig_exit);
MODULE_LICENSE("GPL");
HID_COMPAT_LOAD_DRIVER(ntrig);
......@@ -118,5 +118,3 @@ static void pl_exit(void)
module_init(pl_init);
module_exit(pl_exit);
MODULE_LICENSE("GPL");
HID_COMPAT_LOAD_DRIVER(petalynx);
......@@ -9,9 +9,12 @@
* - contains two reports, one for each port (HID_QUIRK_MULTI_INPUT)
*
* 0e8f:0003 "GreenAsia Inc. USB Joystick "
* - tested with K??ng Gaming gamepad
* - tested with Knig Gaming gamepad
*
* Copyright (c) 2007 Anssi Hannula <anssi.hannula@gmail.com>
* 0e8f:0003 "GASIA USB Gamepad"
* - another version of the Knig gamepad
*
* Copyright (c) 2007, 2009 Anssi Hannula <anssi.hannula@gmail.com>
*/
/*
......@@ -46,6 +49,8 @@
struct plff_device {
struct hid_report *report;
s32 *strong;
s32 *weak;
};
static int hid_plff_play(struct input_dev *dev, void *data,
......@@ -62,8 +67,8 @@ static int hid_plff_play(struct input_dev *dev, void *data,
left = left * 0x7f / 0xffff;
right = right * 0x7f / 0xffff;
plff->report->field[0]->value[2] = left;
plff->report->field[0]->value[3] = right;
*plff->strong = left;
*plff->weak = right;
debug("running with 0x%02x 0x%02x", left, right);
usbhid_submit_report(hid, plff->report, USB_DIR_OUT);
......@@ -80,6 +85,8 @@ static int plff_init(struct hid_device *hid)
struct list_head *report_ptr = report_list;
struct input_dev *dev;
int error;
s32 *strong;
s32 *weak;
/* The device contains one output report per physical device, all
containing 1 field, which contains 4 ff00.0002 usages and 4 16bit
......@@ -87,7 +94,12 @@ static int plff_init(struct hid_device *hid)
The input reports also contain a field which contains
8 ff00.0001 usages and 8 boolean values. Their meaning is
currently unknown. */
currently unknown.
A version of the 0e8f:0003 exists that has all the values in
separate fields and misses the extra input field, thus resembling
Zeroplus (hid-zpff) devices.
*/
if (list_empty(report_list)) {
dev_err(&hid->dev, "no output reports found\n");
......@@ -110,8 +122,21 @@ static int plff_init(struct hid_device *hid)
return -ENODEV;
}
if (report->field[0]->report_count < 4) {
dev_err(&hid->dev, "not enough values in the field\n");
if (report->field[0]->report_count >= 4) {
report->field[0]->value[0] = 0x00;
report->field[0]->value[1] = 0x00;
strong = &report->field[0]->value[2];
weak = &report->field[0]->value[3];
debug("detected single-field device");
} else if (report->maxfield >= 4 && report->field[0]->maxusage == 1 &&
report->field[0]->usage[0].hid == (HID_UP_LED | 0x43)) {
report->field[0]->value[0] = 0x00;
report->field[1]->value[0] = 0x00;
strong = &report->field[2]->value[0];
weak = &report->field[3]->value[0];
debug("detected 4-field device");
} else {
dev_err(&hid->dev, "not enough fields or values\n");
return -ENODEV;
}
......@@ -130,10 +155,11 @@ static int plff_init(struct hid_device *hid)
}
plff->report = report;
plff->report->field[0]->value[0] = 0x00;
plff->report->field[0]->value[1] = 0x00;
plff->report->field[0]->value[2] = 0x00;
plff->report->field[0]->value[3] = 0x00;
plff->strong = strong;
plff->weak = weak;
*strong = 0x00;
*weak = 0x00;
usbhid_submit_report(hid, plff->report, USB_DIR_OUT);
}
......@@ -180,7 +206,7 @@ static const struct hid_device_id pl_devices[] = {
.driver_data = 1 }, /* Twin USB Joystick */
{ HID_USB_DEVICE(USB_VENDOR_ID_GAMERON, USB_DEVICE_ID_GAMERON_DUAL_PCS_ADAPTOR),
.driver_data = 1 }, /* Twin USB Joystick */
{ HID_USB_DEVICE(USB_VENDOR_ID_GREENASIA, 0x0003), }, /* GreenAsia Inc. USB Joystick */
{ HID_USB_DEVICE(USB_VENDOR_ID_GREENASIA, 0x0003), },
{ }
};
MODULE_DEVICE_TABLE(hid, pl_devices);
......@@ -204,5 +230,3 @@ static void pl_exit(void)
module_init(pl_init);
module_exit(pl_exit);
MODULE_LICENSE("GPL");
HID_COMPAT_LOAD_DRIVER(pantherlord);
......@@ -96,5 +96,3 @@ static void samsung_exit(void)
module_init(samsung_init);
module_exit(samsung_exit);
MODULE_LICENSE("GPL");
HID_COMPAT_LOAD_DRIVER(samsung);
......@@ -148,5 +148,3 @@ static void sony_exit(void)
module_init(sony_init);
module_exit(sony_exit);
MODULE_LICENSE("GPL");
HID_COMPAT_LOAD_DRIVER(sony);
......@@ -78,5 +78,3 @@ static void sp_exit(void)
module_init(sp_init);
module_exit(sp_exit);
MODULE_LICENSE("GPL");
HID_COMPAT_LOAD_DRIVER(sunplus);
......@@ -265,5 +265,3 @@ static void tm_exit(void)
module_init(tm_init);
module_exit(tm_exit);
MODULE_LICENSE("GPL");
HID_COMPAT_LOAD_DRIVER(thrustmaster);
......@@ -73,5 +73,3 @@ static void ts_exit(void)
module_init(ts_init);
module_exit(ts_exit);
MODULE_LICENSE("GPL");
HID_COMPAT_LOAD_DRIVER(topseed);
......@@ -158,5 +158,3 @@ static void zp_exit(void)
module_init(zp_init);
module_exit(zp_exit);
MODULE_LICENSE("GPL");
HID_COMPAT_LOAD_DRIVER(zeroplus);
......@@ -181,10 +181,18 @@ static int hidraw_open(struct inode *inode, struct file *file)
dev = hidraw_table[minor];
if (!dev->open++) {
err = dev->hid->ll_driver->open(dev->hid);
if (dev->hid->ll_driver->power) {
err = dev->hid->ll_driver->power(dev->hid, PM_HINT_FULLON);
if (err < 0)
goto out_unlock;
}
err = dev->hid->ll_driver->open(dev->hid);
if (err < 0) {
if (dev->hid->ll_driver->power)
dev->hid->ll_driver->power(dev->hid, PM_HINT_NORMAL);
dev->open--;
}
}
out_unlock:
mutex_unlock(&minors_lock);
......@@ -209,11 +217,14 @@ static int hidraw_release(struct inode * inode, struct file * file)
list_del(&list->node);
dev = hidraw_table[minor];
if (!--dev->open) {
if (list->hidraw->exist)
if (list->hidraw->exist) {
if (dev->hid->ll_driver->power)
dev->hid->ll_driver->power(dev->hid, PM_HINT_NORMAL);
dev->hid->ll_driver->close(dev->hid);
else
} else {
kfree(list->hidraw);
}
}
kfree(list);
......
This diff is collapsed.
......@@ -246,11 +246,13 @@ static int hiddev_release(struct inode * inode, struct file * file)
spin_unlock_irqrestore(&list->hiddev->list_lock, flags);
if (!--list->hiddev->open) {
if (list->hiddev->exist)
if (list->hiddev->exist) {
usbhid_close(list->hiddev->hid);
else
usbhid_put_power(list->hiddev->hid);
} else {
kfree(list->hiddev);
}
}
kfree(list);
......@@ -300,6 +302,17 @@ static int hiddev_open(struct inode *inode, struct file *file)
list_add_tail(&list->node, &hiddev_table[i]->list);
spin_unlock_irq(&list->hiddev->list_lock);
if (!list->hiddev->open++)
if (list->hiddev->exist) {
struct hid_device *hid = hiddev_table[i]->hid;
res = usbhid_get_power(hid);
if (res < 0) {
res = -EIO;
goto bail;
}
usbhid_open(hid);
}
return 0;
bail:
file->private_data = NULL;
......@@ -875,16 +888,21 @@ int hiddev_connect(struct hid_device *hid, unsigned int force)
hiddev->hid = hid;
hiddev->exist = 1;
/* when lock_kernel() usage is fixed in usb_open(),
* we could also fix it here */
lock_kernel();
retval = usb_register_dev(usbhid->intf, &hiddev_class);
if (retval) {
err_hid("Not able to get a minor for this device.");
hid->hiddev = NULL;
unlock_kernel();
kfree(hiddev);
return -1;
} else {
hid->minor = usbhid->intf->minor;
hiddev_table[usbhid->intf->minor - HIDDEV_MINOR_BASE] = hiddev;
}
unlock_kernel();
return 0;
}
......
......@@ -38,7 +38,10 @@ int usbhid_wait_io(struct hid_device* hid);
void usbhid_close(struct hid_device *hid);
int usbhid_open(struct hid_device *hid);
void usbhid_init_reports(struct hid_device *hid);
void usbhid_submit_report(struct hid_device *hid, struct hid_report *report, unsigned char dir);
void usbhid_submit_report
(struct hid_device *hid, struct hid_report *report, unsigned char dir);
int usbhid_get_power(struct hid_device *hid);
void usbhid_put_power(struct hid_device *hid);
/* iofl flags */
#define HID_CTRL_RUNNING 1
......@@ -49,6 +52,9 @@ void usbhid_submit_report(struct hid_device *hid, struct hid_report *report, uns
#define HID_CLEAR_HALT 6
#define HID_DISCONNECTED 7
#define HID_STARTED 8
#define HID_REPORTED_IDLE 9
#define HID_KEYS_PRESSED 10
#define HID_LED_ON 11
/*
* USB-specific HID struct, to be pointed to
......@@ -66,7 +72,6 @@ struct usbhid_device {
struct urb *urbin; /* Input URB */
char *inbuf; /* Input buffer */
dma_addr_t inbuf_dma; /* Input buffer dma */
spinlock_t inlock; /* Input fifo spinlock */
struct urb *urbctrl; /* Control URB */
struct usb_ctrlrequest *cr; /* Control request struct */
......@@ -75,21 +80,22 @@ struct usbhid_device {
unsigned char ctrlhead, ctrltail; /* Control fifo head & tail */
char *ctrlbuf; /* Control buffer */
dma_addr_t ctrlbuf_dma; /* Control buffer dma */
spinlock_t ctrllock; /* Control fifo spinlock */
struct urb *urbout; /* Output URB */
struct hid_output_fifo out[HID_CONTROL_FIFO_SIZE]; /* Output pipe fifo */
unsigned char outhead, outtail; /* Output pipe fifo head & tail */
char *outbuf; /* Output buffer */
dma_addr_t outbuf_dma; /* Output buffer dma */
spinlock_t outlock; /* Output fifo spinlock */
spinlock_t lock; /* fifo spinlock */
unsigned long iofl; /* I/O flags (CTRL_RUNNING, OUT_RUNNING) */
struct timer_list io_retry; /* Retry timer */
unsigned long stop_retry; /* Time to give up, in jiffies */
unsigned int retry_delay; /* Delay length in ms */
struct work_struct reset_work; /* Task context for resets */
struct work_struct restart_work; /* waking up for output to be done in a task */
wait_queue_head_t wait; /* For sleeping */
int ledcount; /* counting the number of active leds */
};
#define hid_to_usb_dev(hid_dev) \
......
......@@ -270,6 +270,7 @@ struct hid_item {
#define HID_QUIRK_INVERT 0x00000001
#define HID_QUIRK_NOTOUCH 0x00000002
#define HID_QUIRK_IGNORE 0x00000004
#define HID_QUIRK_NOGET 0x00000008
#define HID_QUIRK_BADPAD 0x00000020
#define HID_QUIRK_MULTI_INPUT 0x00000040
......@@ -603,12 +604,17 @@ struct hid_ll_driver {
int (*open)(struct hid_device *hdev);
void (*close)(struct hid_device *hdev);
int (*power)(struct hid_device *hdev, int level);
int (*hidinput_input_event) (struct input_dev *idev, unsigned int type,
unsigned int code, int value);
int (*parse)(struct hid_device *hdev);
};
#define PM_HINT_FULLON 1<<5
#define PM_HINT_NORMAL 1<<1
/* Applications from HID Usage Tables 4/8/99 Version 1.1 */
/* We ignore a few input applications that are not widely used */
#define IS_INPUT_APPLICATION(a) (((a >= 0x00010000) && (a <= 0x00010008)) || (a == 0x00010080) || (a == 0x000c0001) || (a == 0x000d0002))
......@@ -641,6 +647,7 @@ int hidinput_find_field(struct hid_device *hid, unsigned int type, unsigned int
void hid_output_report(struct hid_report *report, __u8 *data);
struct hid_device *hid_allocate_device(void);
int hid_parse_report(struct hid_device *hid, __u8 *start, unsigned size);
int hid_check_keys_pressed(struct hid_device *hid);
int hid_connect(struct hid_device *hid, unsigned int connect_mask);
/**
......@@ -791,21 +798,5 @@ dbg_hid(const char *fmt, ...)
__FILE__ , ## arg)
#endif /* HID_FF */
#ifdef __KERNEL__
#ifdef CONFIG_HID_COMPAT
#define HID_COMPAT_LOAD_DRIVER(name) \
/* prototype to avoid sparse warning */ \
extern void hid_compat_##name(void); \
void hid_compat_##name(void) { } \
EXPORT_SYMBOL(hid_compat_##name)
#else
#define HID_COMPAT_LOAD_DRIVER(name)
#endif /* HID_COMPAT */
#define HID_COMPAT_CALL_DRIVER(name) do { \
extern void hid_compat_##name(void); \
hid_compat_##name(); \
} while (0)
#endif /* __KERNEL__ */
#endif
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment