All of lore.kernel.org
 help / color / mirror / Atom feed
From: Benjamin Tissoires <benjamin.tissoires@redhat.com>
To: Stefan Seidel <lkml@stefanseidel.info>
Cc: smueller@chronox.de, jkosina@suse.cz, linux-input@vger.kernel.org
Subject: Re: Sony Vaio Duo 11: getting middle mouse button to work
Date: Fri, 12 Aug 2016 11:29:07 +0200	[thread overview]
Message-ID: <20160812092907.GP17850@mail.corp.redhat.com> (raw)
In-Reply-To: <20160811232759.Horde.nOLGcvRFRNEDDDHWRQr1nXw@horde.stefanseidel.info>

Hi Stefan,

On Aug 11 2016 or thereabouts, Stefan Seidel wrote:
> Hi,
> 
> I'm hijacking on that very old conversation you had here:
> http://linux-input.vger.kernel.narkive.com/78cpvzuC/sony-vaio-duo-11-getting-middle-mouse-button-to-work
> 
> I took Wireshark dumps of the USB traffic when the Windows configuration
> tools switches between "use middle button for scroll" and "send middle
> button as button 2" (they're not named like this, but that's what they do).
> I also have a second dump of enabling and disabling "touch trackpoint to
> send mouse button 1". I can see that there is a clear key/value mapping. I
> don't know anything about HID or USB (or Wireshark), but it seems like the
> *device* is sending different values back to the *host* when these settings
> are changed.
> 
> Anyway, is there a way I can "decrypt" this and write either a usespace
> helper or write or amend a kernel driver to be able to switch those two
> options in Linux? Or did I miss something in my capture? Those were taken
> with Wireshark 2.0.

If you can manage to get the beginning of the enumeration of the USB
device, Wireshark will decrypt most of the informations for you (if the
commands are SET_FEATURE or GET_FEATURE, etc...).

It's unclear to me which settings triggers the change, but it's clear
that when the host does a Set_Report Request on the Output 2:
 - bmRequestType: 0x21 -> Set_Report Request
 - bRequest: 9 -> SET_REPORT 
 - wValue: 0x0202 -> Report Type Output, Report ID 02
 - wIndex: 0 -> Interface 0
 - wLength: 5 -> Report Length
 - Data: ???

(see http://www.usb.org/developers/hidpage/HID1_11.pdf section 7.2.2 to
decrypt the raw USB events)

The answer is different in the first case and 7 seconds after (I assume
you toggled the setting there) -> frame 16 and 33 in the first log.

I'd say the first log would be:
- 1.  -> SET_IDLE (you can ignore it)
- 3.  -> SET_REPORT on OUTPUT 2, length 5 no data
      -> answer in 4.  -> 02 04 02 00 00
- 5.  -> SET CONFIGURATION Status (ignore this as well I think)
- 6.  -> SET_REPORT on OUTPUT 2, length 5 no data
      -> answer in 7.  -> 02 06 00 00 00
- 9.  -> SET_REPORT on OUTPUT 2, length 5 no data
      -> answer in 10. -> 02 05 01 00 00
- 12. -> SET_REPORT on OUTPUT 2, length 5 no data
      -> answer in 13. -> 02 02 01 00 00
- 16. -> SET_REPORT on OUTPUT 2, length 5 no data
      -> answer in 14. -> 02 03 01 00 00

The second sequence (frames 18 to 34) provides the same output except
for the last answer 02 03 00 00 00.

The "no data" part seems weird, but there is a chance if you output a
report with 02 03 00 00 00 or 02 03 01 00 00, this toggles the behavior.

I'll let you decrypt the second log :)

Anyway, once you got enough information, you can either directly work in
kernel space, in a driver, or in userspace, using hidraw.

If you start working in kernel space, start with a small hid driver and
in .probe() try accessing the device with the event sequences you got.

If you start working with hidraw, there is an example in the kernel
tree: samples/hidraw/hid-example.c.

Cheers,
Benjamin


  reply	other threads:[~2016-08-12  9:29 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-11 21:27 Sony Vaio Duo 11: getting middle mouse button to work Stefan Seidel
2016-08-12  9:29 ` Benjamin Tissoires [this message]
2016-08-12 19:41   ` Stefan Seidel
2016-08-12 20:02     ` Stefan Seidel
  -- strict thread matches above, loose matches on Subject: below --
2014-01-23 16:21 Stephan Mueller
2014-01-25  3:17 ` Mattia Dongili
2014-01-25  4:51   ` Stephan Mueller
2014-01-29 14:53     ` Benjamin Tissoires
2014-01-29 14:59       ` Stephan Mueller
2014-01-29 15:07         ` Benjamin Tissoires
2014-01-30  3:48           ` Stephan Mueller
2014-01-30 21:44             ` Benjamin Tissoires
2014-01-30 22:07               ` Stephan Mueller
2014-01-31  3:50                 ` Benjamin Tissoires
2014-01-31  4:31                   ` Stephan Mueller
2014-01-31 16:20                     ` Benjamin Tissoires
2014-01-31 21:02                     ` Stephan Mueller

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=20160812092907.GP17850@mail.corp.redhat.com \
    --to=benjamin.tissoires@redhat.com \
    --cc=jkosina@suse.cz \
    --cc=linux-input@vger.kernel.org \
    --cc=lkml@stefanseidel.info \
    --cc=smueller@chronox.de \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.