|
@@ -21,16 +21,19 @@
|
|
*/
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
+#include <linux/hid.h>
|
|
#include <linux/input.h>
|
|
#include <linux/input.h>
|
|
#include <linux/usb.h>
|
|
#include <linux/usb.h>
|
|
-#include <linux/hid.h>
|
|
|
|
-#include "usbhid.h"
|
|
|
|
|
|
+
|
|
|
|
+#include "hid-ids.h"
|
|
|
|
+
|
|
|
|
+#include "usbhid/usbhid.h"
|
|
|
|
|
|
struct zpff_device {
|
|
struct zpff_device {
|
|
struct hid_report *report;
|
|
struct hid_report *report;
|
|
};
|
|
};
|
|
|
|
|
|
-static int hid_zpff_play(struct input_dev *dev, void *data,
|
|
|
|
|
|
+static int zpff_play(struct input_dev *dev, void *data,
|
|
struct ff_effect *effect)
|
|
struct ff_effect *effect)
|
|
{
|
|
{
|
|
struct hid_device *hid = input_get_drvdata(dev);
|
|
struct hid_device *hid = input_get_drvdata(dev);
|
|
@@ -58,7 +61,7 @@ static int hid_zpff_play(struct input_dev *dev, void *data,
|
|
return 0;
|
|
return 0;
|
|
}
|
|
}
|
|
|
|
|
|
-int hid_zpff_init(struct hid_device *hid)
|
|
|
|
|
|
+static int zpff_init(struct hid_device *hid)
|
|
{
|
|
{
|
|
struct zpff_device *zpff;
|
|
struct zpff_device *zpff;
|
|
struct hid_report *report;
|
|
struct hid_report *report;
|
|
@@ -87,7 +90,7 @@ int hid_zpff_init(struct hid_device *hid)
|
|
|
|
|
|
set_bit(FF_RUMBLE, dev->ffbit);
|
|
set_bit(FF_RUMBLE, dev->ffbit);
|
|
|
|
|
|
- error = input_ff_create_memless(dev, zpff, hid_zpff_play);
|
|
|
|
|
|
+ error = input_ff_create_memless(dev, zpff, zpff_play);
|
|
if (error) {
|
|
if (error) {
|
|
kfree(zpff);
|
|
kfree(zpff);
|
|
return error;
|
|
return error;
|
|
@@ -105,3 +108,55 @@ int hid_zpff_init(struct hid_device *hid)
|
|
|
|
|
|
return 0;
|
|
return 0;
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+static int zp_probe(struct hid_device *hdev, const struct hid_device_id *id)
|
|
|
|
+{
|
|
|
|
+ int ret;
|
|
|
|
+
|
|
|
|
+ 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;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ zpff_init(hdev);
|
|
|
|
+
|
|
|
|
+ return 0;
|
|
|
|
+err:
|
|
|
|
+ return ret;
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+static const struct hid_device_id zp_devices[] = {
|
|
|
|
+ { HID_USB_DEVICE(USB_VENDOR_ID_ZEROPLUS, 0x0005) },
|
|
|
|
+ { HID_USB_DEVICE(USB_VENDOR_ID_ZEROPLUS, 0x0030) },
|
|
|
|
+ { }
|
|
|
|
+};
|
|
|
|
+MODULE_DEVICE_TABLE(hid, zp_devices);
|
|
|
|
+
|
|
|
|
+static struct hid_driver zp_driver = {
|
|
|
|
+ .name = "zeroplus",
|
|
|
|
+ .id_table = zp_devices,
|
|
|
|
+ .probe = zp_probe,
|
|
|
|
+};
|
|
|
|
+
|
|
|
|
+static int zp_init(void)
|
|
|
|
+{
|
|
|
|
+ return hid_register_driver(&zp_driver);
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+static void zp_exit(void)
|
|
|
|
+{
|
|
|
|
+ hid_unregister_driver(&zp_driver);
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+module_init(zp_init);
|
|
|
|
+module_exit(zp_exit);
|
|
|
|
+MODULE_LICENSE("GPL");
|
|
|
|
+
|
|
|
|
+HID_COMPAT_LOAD_DRIVER(zeroplus);
|