public inbox for linux-usb@vger.kernel.org
 help / color / mirror / Atom feed
From: Andreas Bergmeier <abergmeier@gmx.net>
To: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Cc: ?Andreas Bergmeier <abergmeier@gmx.net>,
	linux-input@vger.kernel.org,
	USB mailing list <linux-usb@vger.kernel.org>,
	Alan Stern <stern@rowland.harvard.edu>,
	Jiri Kosina <jikos@kernel.org>,
	linux-leds@vger.kernel.org,
	Nestor Lopez Casado <nlopezcasad@logitech.com>
Subject: Re: Litra Glow on Linux
Date: Thu, 10 Nov 2022 13:24:08 +0100 (CET)	[thread overview]
Message-ID: <2a20d7d1-55df-4861-5cf1-dee19536ed5@9300> (raw)
In-Reply-To: <CAO-hwJ+PysPKFG=a9+L8vwhiw4uY3F3DZmg4FwgPWGZ7LPt4EA@mail.gmail.com>



On Thu, 10 Nov 2022, Benjamin Tissoires wrote:

> On Thu, Nov 10, 2022 at 4:29 AM Andreas Bergmeier <abergmeier@gmx.net> wrote:
> >
> > On Wed, 9 Nov 2022 at 21:27, Andreas Bergmeier <abergmeier@gmx.net> wrote:
> > >
> > > Finally I have an environment where I can test my kernel code.
> > >
> > > On Mon, 31 Oct 2022 at 10:29, Benjamin Tissoires
> > > <benjamin.tissoires@redhat.com> wrote:
> > > > For identifying the GLOW device you should be adding an id in the
> > > > table of hid-logitech-hidpp, with a driver data that tells the driver
> > > > to look for 0x1990.
> > > >
> > > > >
> > > > > > - you need to add a hook in connect_event to register the led class
> > > > > > device that will hook on to the actual LED of the device
> > > Sadly my tests did not go very far. The code fails already when
> > > calling the `probe` callback (`hidpp_probe`).
> > > When it calls into `hidpp_root_get_protocol_version` it seems to
> > > receive `HIDPP_ERROR_RESOURCE_ERROR`.
> > > Which then leads to an error message: Device not connected
> > > Upon looking at `HIDPP_ERROR_RESOURCE_ERROR` (9) there is no
> > > documentation what it means in code.
> > > From a look into the docs it says that 9 is UNSUPPORTED error for 2.0
> > > devices. Thus I am wondering how the code knows
> > > that it is a problem with connectivity.
>
> From the top of my memory, this was told to us that this is the way we
> detect if the device was connected or not in the unifying case. Though
> in your case, it's a USB device, so there is no such thing as "not
> connected"...
So isn't the current error handling at a minimum misleading?


> > > Couldn't it also mean that the
> > > device is not supporting getting the protocol version?
>
> Probably. What happens if you comment out that protocol version
> request and force connected to be true?
Well I went the other way around. I had a look at the hidpp utility
sources:
https://github.com/cvuchener/hidpp/blob/057407fbb7248bbc6cefcfaa860758d0711c01b9/src/libhidpp/hidpp/Device.cpp#L82
Which seems to do a similar thing. From the top of my head the only
difference seems to be that they are sending `0x1` as a ping value instead
of `0x5a`. Might give that a shot next.
Anyway hidpp-list-features successfully reads the protocol version in
userspace (4, 2) as seen here:
https://github.com/abergmeier/litra_glow_linux/blob/main/hidpp-list-features

> In your case though, it would be interesting to know if we should
> bypass that verification.
Since reading the protocol version seems generally possible I think we
should understand what logitech-hidpp does wrong first.


> > Also, looking into `supported_reports` turned out to be 2 (very long).
>
> Oops, you mistook the bit definition with the value:
> #define HIDPP_REPORT_SHORT_SUPPORTED  BIT(0)  -> value of 1
> #define HIDPP_REPORT_LONG_SUPPORTED  BIT(1)  -> value of 2
> #define HIDPP_REPORT_VERY_LONG_SUPPORTED  BIT(2)  -> value of 4
Ah indeed, thx.

> And this is expected because you don't have VERY_LONG support on your device.
True. The question remains whether the upgrade from LONG to VERY_LONG
could be needed should a device only support VERY_LONG.

  reply	other threads:[~2022-11-10 12:25 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-19 15:17 Litra Glow on Linux Alan Stern
2022-10-19 15:48 ` Bastien Nocera
2022-10-19 15:49 ` Bastien Nocera
2022-10-19 19:40   ` Andreas Bergmeier
2022-10-20 18:22 ` Andreas Bergmeier
2022-10-22 12:42 ` Andreas Bergmeier
2022-10-25  7:46   ` Benjamin Tissoires
2022-10-26 20:49     ` Andreas Bergmeier
2022-10-27  9:45       ` Benjamin Tissoires
2022-10-29  8:21         ` Andreas Bergmeier
2022-10-31  9:30           ` Benjamin Tissoires
2022-11-04  7:45             ` Andreas Bergmeier
2022-11-04 11:40               ` Pavel Machek
2022-11-09 20:27             ` Andreas Bergmeier
2022-11-10  3:29               ` Andreas Bergmeier
2022-11-10  9:22                 ` Benjamin Tissoires
2022-11-10 12:24                   ` Andreas Bergmeier [this message]
2022-11-10 13:39                     ` Benjamin Tissoires
2022-11-19 20:18                       ` Andreas Bergmeier
2022-11-27 11:04                         ` Andreas Bergmeier
  -- strict thread matches above, loose matches on Subject: below --
2022-10-17 16:45 Andreas Bergmeier

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=2a20d7d1-55df-4861-5cf1-dee19536ed5@9300 \
    --to=abergmeier@gmx.net \
    --cc=benjamin.tissoires@redhat.com \
    --cc=jikos@kernel.org \
    --cc=linux-input@vger.kernel.org \
    --cc=linux-leds@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=nlopezcasad@logitech.com \
    --cc=stern@rowland.harvard.edu \
    /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