From: John Grs <johnpgrs@gmail.com>
To: linux-input@vger.kernel.org
Subject: Re: Kernel support for joystick RAVCORE JAVELIN
Date: Tue, 4 Feb 2020 23:48:09 +0200 [thread overview]
Message-ID: <9cba55e8-b88e-be30-5c9e-2cbeca881c4d@gmail.com> (raw)
In-Reply-To: <55dfec8d-c9de-6295-0695-7fc0aa6533bc@gmail.com>
[-- Attachment #1: Type: text/plain, Size: 558 bytes --]
Final version for Ravcore Javelin and VKB Gladiator MKII
Στις 5/8/19 10:50 μ.μ., ο John Grs έγραψε:
>
> Στις 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 (??)
>
>
[-- Attachment #2: hid-ravcore.c --]
[-- Type: text/x-csrc, Size: 1994 bytes --]
// SPDX-License-Identifier: GPL-2.0-or-later
/*
* HID driver for Ravcore Javelin & VKB Joysticks
* Currently supported devices are:
*
* Ravcore Javelin: v11C0 p5607
* VKB Gladiator MKII: v231d p0121
*
* Copyright (c) 2019 John Grs <johnpgrs@gmail.com>
*/
#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 USB_VENDOR_ID_VKB 0x231d
#define USB_DEVICE_ID_GLADIATOR 0x0121
static const struct {
__s32 x;
__s32 y;
} hid_hat_to_axis[] = {{ 0, 0}, { 0,-1}, { 1,-1}, { 1, 0}, { 1, 1}, { 0, 1}, {-1, 1}, {-1, 0}, {-1,-1}};
static __u8 *gladiator_report_fixup(struct hid_device *hdev, __u8 *rdesc, unsigned int *rsize)
{
hid_info(hdev, "Fix HAT for Gladiator MKII Joystick\n");
rdesc[177]=0x08; // Logigal Maximum = 8
return rdesc;
}
static int gladiator_event(struct hid_device *hdev, struct hid_field *field, struct hid_usage *usage, __s32 value)
{
struct input_dev *input = field->hidinput->input;
if (usage->type == EV_ABS && usage->code == 16) {
if (value > 239) { value=-1; } else { value /= 30; }
value +=1;
input_event(input, usage->type, usage->code, hid_hat_to_axis[value].x);
input_event(input, usage->type, usage->code+1, hid_hat_to_axis[value].y);
return 1;
}
return 0;
}
static const struct hid_device_id gladiator_devices[] = {
{ HID_USB_DEVICE(USB_VENDOR_ID_RAVCORE, USB_DEVICE_ID_RAVCORE_VKB5607) },
{ HID_USB_DEVICE(USB_VENDOR_ID_VKB, USB_DEVICE_ID_GLADIATOR) },
{ }
};
MODULE_DEVICE_TABLE(hid, gladiator_devices);
static struct hid_driver gladiator_driver = {
.name = "VKB Gladiator MKII",
.id_table = gladiator_devices,
.report_fixup = gladiator_report_fixup,
.event = gladiator_event,
};
module_hid_driver(gladiator_driver);
MODULE_AUTHOR("John Grs <johnpgrs@gmail.com>");
MODULE_DESCRIPTION("VKB Gladiator MKII driver");
MODULE_LICENSE("GPL");
parent reply other threads:[~2020-02-04 21:48 UTC|newest]
Thread overview: expand[flat|nested] mbox.gz Atom feed
[parent not found: <55dfec8d-c9de-6295-0695-7fc0aa6533bc@gmail.com>]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=9cba55e8-b88e-be30-5c9e-2cbeca881c4d@gmail.com \
--to=johnpgrs@gmail.com \
--cc=linux-input@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).