linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Pavel Machek <pavel@ucw.cz>
To: Jiri Kosina <jikos@kernel.org>
Cc: dmitry.torokhov@gmail.com, vojtech@suse.cz,
	linux-input@vger.kernel.org,
	kernel list <linux-kernel@vger.kernel.org>
Subject: Re: Proper support for Saitek X36F joystick
Date: Wed, 28 Oct 2020 18:32:17 +0100	[thread overview]
Message-ID: <20201028173217.GA25456@amd> (raw)
In-Reply-To: <nycvar.YFH.7.76.2010281728260.18859@cbobk.fhfr.pm>

[-- Attachment #1: Type: text/plain, Size: 2703 bytes --]

On Wed 2020-10-28 17:29:23, Jiri Kosina wrote:
> On Wed, 28 Oct 2020, Pavel Machek wrote:
> 
> > So no, I can't even replace it with equivalent one. Perhaps hrdc got
> > decompilation wrong, or I'm doing something else wrong.
> 
> You don't need to do any decompilation -- the descriptor can be obtained 
> from /sys/kernel/debug/hid/<device>/rdesc (also lsusb in verbose enough 
> mode should present it in case no driver is bound to the device).

I discovered problem in the meantime. hrdc (I was using to de-compile
and re-compile hid descriptors) was adding padding.

But thanks for the pointer. That is very useful:

This device has four hat switches... I declared two so far

     0x0b, 0x39, 0x00, 0x01, 0x00,  //     Usage (desktop.HatSwitch)
     0x35, 0x00,                    //     PhysicalMinimum (0)
     0x46, 0x3b, 0x01,              //     PhysicalMaximum (315)
     0x15, 0x01,                    //     LogicalMinimum (1)
     0x25, 0x08,                    //     LogicalMaximum (8)
     0x65, 0x14,                    //     Unit (Degree)
     0x55, 0x00,                    //     UnitExponent (0)
     0x95, 0x01,                    //     ReportCount (1)
     0x75, 0x04,                    //     ReportSize (4)
     0x81, 0x42,                    //     Input (Variable|NullState)

     0x95, 0x01,                    //     ReportCount (1)
     0x75, 0x02,                    //     ReportSize (2)
     0x81, 0x03,                    //     Input (Constant|Variable)
     0x0b, 0x39, 0x00, 0x01, 0x00,  //     Usage (desktop.HatSwitch)
     0x35, 0x00,                    //     PhysicalMinimum (0)
     0x46, 0x3b, 0x01,              //     PhysicalMaximum (315)
     0x15, 0x01,                    //     LogicalMinimum (1)
     0x25, 0x08,                    //     LogicalMaximum (8)
     0x65, 0x14,                    //     Unit (Degree)
     0x55, 0x00,                    //     UnitExponent (0)
     0x95, 0x01,                    //     ReportCount (1)
     0x75, 0x04,                    //     ReportSize (4)
     0x81, 0x42,                    //     Input (Variable|NullState)
     0xc0,                          // EndCollection

...but Linux seems to only recognize first of them:

GenericDesktop.HatSwitch ---> Absolute.Hat0X
GenericDesktop.HatSwitch ---> Sync.Report

Is there way to get extra hats mapped as Hat1X, Hat2X and Hat3X?

(Plus, they may have different bit orders than hid expects...?)

I'm thinking that maybe I should ignore this hid stuff and just do
"normal" driver in C? Is there precedent/example for that?

Best regards,
								Pavel
-- 
http://www.livejournal.com/~pavelmachek

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 181 bytes --]

      reply	other threads:[~2020-10-28 22:27 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-27 12:42 Proper support for Saitek X36F joystick Pavel Machek
2020-10-27 19:10 ` Jiri Kosina
2020-10-27 21:07   ` Pavel Machek
2020-10-28 16:26     ` Pavel Machek
2020-10-28 16:29       ` Jiri Kosina
2020-10-28 17:32         ` Pavel Machek [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=20201028173217.GA25456@amd \
    --to=pavel@ucw.cz \
    --cc=dmitry.torokhov@gmail.com \
    --cc=jikos@kernel.org \
    --cc=linux-input@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=vojtech@suse.cz \
    /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).