From: "Bruno Prémont" <bonbons@linux-vserver.org>
To: "v1kt0p.rus@gmail.com" <v1kt0p.rus@gmail.com>
Cc: linux-input@vger.kernel.org
Subject: Re: How write driver for gamepad, that detected by usbhid but not work correctly?
Date: Sun, 29 Sep 2013 11:39:47 +0200 [thread overview]
Message-ID: <20130929113947.38ddbf1b@neptune.home> (raw)
In-Reply-To: <5247F168.10008@gmail.com>
On Sun, 29 September 2013 "v1kt0p.rus@gmail.com" <v1kt0p.rus@gmail.com> wrote:
> I have "Genesis to USB adapter" and two genesis gamepads. On windows it
> is work correctly. On linux do not work "left" and "up" buttons on
> D-pad, and two gamepads appear as one with double buttons.
> At first I tried to write usb driver(usb_register), but when I connect
> gamepad system choose usbhid driver not my. When I unplug gamepad system
> call "probe" in my driver, but then immediately call "disconnect". Is
> there a way to force the system to choose my driver first?
> Than I tried to write hid driver(hid_register_driver), but "probe" is
> not called. I can not find documentation describing how to make a
> working driver for hid, it exists at all?
> What is the correct way to write a driver for the gamepad? What am I
> doing wrong?
You can have a look at all the drivers located under drivers/hid/ for
how they do it.
Two drivers that represent gamepads:
hid-pl.c
hid-saitek.c
Depending on how your gamepad shows up when there are two pads connected
you may need to register a second input device to send buttons from the
first pad to first input device, buttons from second to the extra input
device.
A good start to find out what your device does is to enable debugging
in your kernel and cat /sys/kernel/debug/hid/<your device>/events
to determine what happens on button presses.
You can then check how that output matches events sent from /dev/input/event*
matching your device and determine if all that is needed is proper
scancode translation of if more tuning is needed.
Bruno
prev parent reply other threads:[~2013-09-29 9:39 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-09-29 9:22 How write driver for gamepad, that detected by usbhid but not work correctly? v1kt0p.rus
2013-09-29 9:39 ` Bruno Prémont [this message]
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=20130929113947.38ddbf1b@neptune.home \
--to=bonbons@linux-vserver.org \
--cc=linux-input@vger.kernel.org \
--cc=v1kt0p.rus@gmail.com \
/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