Στις 23/4/19 4:30 π.μ., ο John Grs έγραψε:
After a couple of tries here my results.
Still 2 problems, but at least the hat works.Problem 1) Only 7 of 8 direction works as for some reason the physical maximum value doesn't work (the correct value must be 240-30=210 equal to direction 7) so i put as logical maximum 14 and not the use 8 2) to correct the opposite direction of hat report count = 2 (??)
// SPDX-License-Identifier: GPL-2.0-or-later /* * HID driver for Ravcore Javelin & VKB Joysticks * Currently supported devices are: * * Ravcore Javelin: v11C0 p5607 * * Copyright (c) 2019 John Grs <johnpgrs@xxxxxxxxx> */ #include <linux/kernel.h> #include <linux/module.h> #include <linux/device.h> #include <linux/hid.h> #define USB_VENDOR_ID_RAVCORE 0x11C0 #define USB_DEVICE_ID_RAVCORE_VKB5607 0x5607 #define DRIVER_DESC_RAVCORE "RAVCORE JAVELIN driver" static __u8 *ravcore_report_fixup(struct hid_device *hdev, __u8 *rdesc, unsigned int *rsize) { //fix descriptor for Hat Switch rdesc[177]=0x0D; // Logigal Maximum = 12 (=360/30) + null rdesc[185]=0x04; // Report Size = 4 to see it as HAT rdesc[187]=0x02; hid_info(hdev, "Fix HID Descriptor: Ravcore Javelin\n"); return rdesc; } static const struct hid_device_id ravcore_devices[] = { { HID_USB_DEVICE(USB_VENDOR_ID_RAVCORE, USB_DEVICE_ID_RAVCORE_VKB5607) }, { } }; MODULE_DEVICE_TABLE(hid, ravcore_devices); static struct hid_driver ravcore_driver = { .name = "Ravcore Javelin", .id_table = ravcore_devices, .report_fixup = ravcore_report_fixup, }; module_hid_driver(ravcore_driver); MODULE_AUTHOR("John Grs <johnpgrs@xxxxxxxxx>"); MODULE_DESCRIPTION(DRIVER_DESC_RAVCORE); MODULE_LICENSE("GPL");
// SPDX-License-Identifier GPL-2.0-or-later /* * HID driver for Ravcore Javelin & VKB Joysticks * Currently supported devices are * * Ravcore Javelin v11C0 p5607 * * Copyright (c) 2019 John Grs <johnpgrs@xxxxxxxxx> */ #include <linux/kernel.h> #include <linux/module.h> #include <linux/device.h> #include <linux/hid.h> #define USB_VENDOR_ID_RAVCORE 0x11C0 #define USB_DEVICE_ID_RAVCORE_VKB5607 0x5607 #define DRIVER_DESC_RAVCORE "RAVCORE JAVELIN driver" static u8 fix_rdesc[] = { 0x05, 0x01, // Usage Page 'Generic Desktop Controls' 0x09, 0x04, // Usage 'Joystick' 0xa1, 0x01, // Collection 'Application (mouse, keyboard)' 0x05, 0x01, // Usage Page 'Generic Desktop Controls' 0x85, 0x01, // Report ID = 1 0x05, 0x01, // Usage Page 'Generic Desktop Controls' 0x09, 0x30, // Usage 'X' 0x75, 0x10, // Report Size = 16 0x95, 0x01, // Report Count = 1 0x15, 0x00, // Logical Minimum = 0 0x26, 0xff, 0x07, // Logical Maximum = 2047 0x46, 0xff, 0x07, // Physical Maximum = 2047 0x81, 0x02, // Input data [var] abs lin pref-state null-pos non-vol bit-field 0x05, 0x01, // Usage Page 'Generic Desktop Controls' 0x09, 0x31, // Usage 'Y' 0x75, 0x10, // Report Size = 16 0x95, 0x01, // Report Count = 1 0x15, 0x00, // Logical Minimum = 0 0x26, 0xff, 0x07, // Logical Maximum = 2047 0x46, 0xff, 0x07, // Physical Maximum = 2047 0x81, 0x02, // Input data [var] abs lin pref-state null-pos non-vol bit-field 0x05, 0x01, // Usage Page 'Generic Desktop Controls' 0x09, 0x33, // Usage 'Rx' 0x75, 0x10, // Report Size = 16 0x95, 0x01, // Report Count = 1 0x15, 0x00, // Logical Minimum = 0 0x26, 0xff, 0x03, // Logical Maximum = 1023 0x46, 0xff, 0x03, // Physical Maximum = 1023 0x81, 0x02, // Input data [var] abs lin pref-state null-pos non-vol bit-field 0x05, 0x01, // Usage Page 'Generic Desktop Controls' 0x05, 0x00, // Usage Page 'Undefined' 0x09, 0x00, // Usage 'Undefined' 0x75, 0x10, // Report Size = 16 0x95, 0x01, // Report Count = 1 0x15, 0x00, // Logical Minimum = 0 0x26, 0xff, 0x03, // Logical Maximum = 1023 0x46, 0xff, 0x03, // Physical Maximum = 1023 0x81, 0x02, // Input data [var] abs lin pref-state null-pos non-vol bit-field 0x05, 0x01, // Usage Page 'Generic Desktop Controls' 0x09, 0x32, // Usage 'Z' 0x75, 0x10, // Report Size = 16 0x95, 0x01, // Report Count = 1 0x15, 0x00, // Logical Minimum = 0 0x26, 0xff, 0x03, // Logical Maximum = 1023 0x46, 0xff, 0x03, // Physical Maximum = 1023 0x81, 0x02, // Input data [var] abs lin pref-state null-pos non-vol bit-field 0x05, 0x01, // Usage Page 'Generic Desktop Controls' 0x09, 0x35, // Usage 'Rz' 0x75, 0x10, // Report Size = 16 0x95, 0x01, // Report Count = 1 0x15, 0x00, // Logical Minimum = 0 0x26, 0xff, 0x03, // Logical Maximum = 1023 0x46, 0xff, 0x03, // Physical Maximum = 1023 0x81, 0x02, // Input data [var] abs lin pref-state null-pos non-vol bit-field 0x05, 0x01, // Usage Page 'Generic Desktop Controls' 0x09, 0x34, // Usage 'Ry' 0x75, 0x10, // Report Size = 16 0x95, 0x01, // Report Count = 1 0x15, 0x00, // Logical Minimum = 0 0x26, 0xff, 0x07, // Logical Maximum = 2047 0x46, 0xff, 0x07, // Physical Maximum = 2047 0x81, 0x02, // Input data [var] abs lin pref-state null-pos non-vol bit-field 0x05, 0x01, // Usage Page 'Generic Desktop Controls' 0x09, 0x36, // Usage 'Slider' 0x75, 0x10, // Report Size = 16 0x95, 0x01, // Report Count = 1 0x15, 0x00, // Logical Minimum = 0 0x26, 0xff, 0x03, // Logical Maximum = 1023 0x46, 0xff, 0x03, // Physical Maximum = 1023 0x81, 0x02, // Input data [var] abs lin pref-state null-pos non-vol bit-field 0x05, 0x09, // Usage Page 'Button' 0x19, 0x01, // Usage Minimum = 1 0x2a, 0x1d, 0x00, // Usage Maximum = 29 0x15, 0x00, // Logical Minimum = 0 0x25, 0x01, // Logical Maximum = 1 0x75, 0x01, // Report Size = 1 0x96, 0x80, 0x00, // Report Count = 128 0x81, 0x02, // Input data [var] abs lin pref-state null-pos non-vol bit-field 0x05, 0x01, // Usage Page 'Generic Desktop Controls' 0x09, 0x39, // Usage 'Hat switch' 0x15, 0x00, 0x26, 0x0d, 0x00, // Logical Maximum = 239 --CHANGED to 0d from ef 0x35, 0x00, 0x46, 0xef, 0x00, // Physical Maximum = 360 0x65, 0x14, // Unit = System(English-Rotation) Length(Centimeter) 0x75, 0x04, // Report Size = 16 --CHANGED to 04 from 10-- 0x95, 0x02, // Report Count = 1 0x81, 0x42, // Input data [var] abs lin pref-state null-pos [vol] bit-field 0x05, 0x01, // Usage Page 'Generic Desktop Controls' 0x09, 0x00, // Usage 'Undefined' 0x75, 0x08, // Report Size = 8 0x95, 0x1d, // Report Count = 29 0x81, 0x01, // Input [const] array abs lin pref-state null-pos non-vol bit-field 0x85, 0x08, // Report ID = 8 0x05, 0x01, // Usage Page 'Generic Desktop Controls' 0x09, 0x00, // Usage 'Undefined' 0x75, 0x08, // Report Size = 8 0x95, 0x3f, // Report Count = 63 0x81, 0x01, // Input [const] array abs lin pref-state null-pos non-vol bit-field 0x15, 0x00, // Logical Minimum = 0 0x26, 0xff, 0x00, // Logical Maximum = 255 0x46, 0xff, 0x00, // Physical Maximum = 255 0x85, 0x58, 0x75, 0x08, // Report Size = 8 0x95, 0x3f, // Report Count = 63 0x09, 0x00, // Usage 'Undefined' 0x91, 0x02, 0x85, 0x59, 0x75, 0x08, // Report Size = 8 0x95, 0x80, // Report Count = 128 0x09, 0x00, // Usage 'Undefined' 0xb1, 0x02, 0xc0, // End Collection }; static __u8 *ravcore_report_fixup(struct hid_device *hdev, __u8 *rdesc, unsigned int *rsize) { //fix descriptor for Hat Switch hid_info(hdev, "Fixing up HID Descriptor for Ravcore Javelin\n"); rdesc = fix_rdesc; *rsize = sizeof(fix_rdesc); return rdesc; } static const struct hid_device_id ravcore_devices[] = { { HID_USB_DEVICE(USB_VENDOR_ID_RAVCORE, USB_DEVICE_ID_RAVCORE_VKB5607) }, { } }; MODULE_DEVICE_TABLE(hid, ravcore_devices); static struct hid_driver ravcore_driver = { .name = "Ravcore Javelin", .id_table = ravcore_devices, .report_fixup = ravcore_report_fixup, }; module_hid_driver(ravcore_driver); MODULE_AUTHOR("John Grs <johnpgrs@xxxxxxxxx>"); MODULE_DESCRIPTION(DRIVER_DESC_RAVCORE); MODULE_LICENSE("GPL");
Attachment:
RAVCORE_DEFAULT.pcapng
Description: application/pcapng