All of lore.kernel.org
 help / color / mirror / Atom feed
From: Nikolai Kondrashov <spbnick@gmail.com>
To: Benjamin Tissoires <benjamin.tissoires@gmail.com>
Cc: Jiri Kosina <jkosina@suse.cz>,
	linux-input <linux-input@vger.kernel.org>,
	DIGImend-devel <DIGImend-devel@lists.sourceforge.net>
Subject: Re: [PATCH 4/5] hid: huion: Switch to generating report descriptor
Date: Wed, 23 Jul 2014 17:59:57 +0300	[thread overview]
Message-ID: <53CFCDED.1030607@gmail.com> (raw)
In-Reply-To: <CAN+gG=FapAjC3C5oMg2UvpAvXN6pzuG5ovjfXPygGorjPjTKcw@mail.gmail.com>

On 07/23/2014 05:42 PM, Benjamin Tissoires wrote:
> On Wed, Jul 23, 2014 at 8:42 AM, Nikolai Kondrashov <spbnick@gmail.com> wrote:
>> Switch to generating tablet pen report descriptor from a template and
>> parameters retrieved from string descriptor 0x64.
>>
>> Signed-off-by: Nikolai Kondrashov <spbnick@gmail.com>
>> ---
>
> This is a nice solution.

Thanks, Benjamin :)

>> -       rc = usb_string(hid_to_usb_dev(hdev), 0x64, buf, sizeof(buf));
>> -       if (rc < 0)
>> -               return rc;
>> +       /*
>> +        * Read string descriptor containing tablet parameters. The specific
>> +        * string descriptor and data were discovered by sniffing the Windows
>> +        * driver traffic.
>> +        * NOTE: This enables fully-functional tablet mode.
>> +        */
>> +       rc = usb_control_msg(usb_dev, usb_rcvctrlpipe(usb_dev, 0),
>> +                               USB_REQ_GET_DESCRIPTOR, USB_DIR_IN,
>> +                               (USB_DT_STRING << 8) + 0x64,
>> +                               0x0409, buf, sizeof(buf),
>> +                               USB_CTRL_GET_TIMEOUT);
>
> Just out of curiosity, you are replacing usb_string() by
> usb_control_msg(). They both seem to do the same, so why bother
> changing the call?

Well, actually they don't seem to do the same and the main difference is that
usb_string attempts to convert the data from UTF-16LE to UTF-8, which would be
undesirable for the binary contents we expect there.

>> +               resolution = le16_to_cpu(buf[5]);
>> +               if (resolution == 0) {
>> +                       params[HUION_PH_ID_X_PM] = 0;
>> +                       params[HUION_PH_ID_Y_PM] = 0;
>
> This is not good (not your code I mean). I know OEMs tend to not care
> about resolution, but Wayland will for the tablet protocol. The idea
> will be to report the coordinate in mm so that we can have a constant
> reporting across vendors/products.
>
> Did you ever fall in this case? and if so, isn't there any way of
> retrieving the actual resolution or an approximation?

Thankfully not. This is merely a protection against division-by-zero
exception in case they start doing that.

BTW, it's nice that Wayland tries to actually use the resolution.

> The rest looks fair enough, so even with my questions:
> Reviewed-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>

Thanks for the review, Benjamin!

Will send a new version soon.

Sincerely,
Nick

  reply	other threads:[~2014-07-23 15:00 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-23 12:42 [PATCHES] hid: Add support for more Huion tablets Nikolai Kondrashov
2014-07-23 12:42 ` [PATCH 1/5] hid: huion: Use "tablet" instead of specific model Nikolai Kondrashov
2014-07-23 14:30   ` Benjamin Tissoires
2014-07-23 12:42 ` [PATCH 2/5] hid: huion: Invert in-range on specific product Nikolai Kondrashov
2014-07-23 14:34   ` Benjamin Tissoires
2014-07-23 14:40     ` Nikolai Kondrashov
2014-07-23 16:31       ` [PATCHES v2] Add support for more Huion tablets Nikolai Kondrashov
2014-07-23 16:31         ` [PATCH 1/4] hid: huion: Use "tablet" instead of specific model Nikolai Kondrashov
2014-07-23 16:31         ` [PATCH 2/4] hid: huion: Don't ignore other interfaces Nikolai Kondrashov
2014-07-23 16:31         ` [PATCH 3/4] hid: huion: Switch to generating report descriptor Nikolai Kondrashov
2014-07-23 16:31         ` [PATCH 4/4] hid: huion: Handle tablets with UC-Logic vendor ID Nikolai Kondrashov
2014-07-28 15:33         ` [PATCHES v2] Add support for more Huion tablets Benjamin Tissoires
2014-07-29  9:22           ` Jiri Kosina
2014-07-29 12:50             ` [PATCH] hid: huion: Fix sparse warnings Nikolai Kondrashov
2014-07-29 13:06               ` Jiri Kosina
2014-07-29 13:24                 ` Nikolai Kondrashov
2014-07-23 12:42 ` [PATCH 3/5] hid: huion: Don't ignore other interfaces Nikolai Kondrashov
2014-07-23 14:43   ` Benjamin Tissoires
2014-07-23 12:42 ` [PATCH 4/5] hid: huion: Switch to generating report descriptor Nikolai Kondrashov
2014-07-23 14:42   ` Benjamin Tissoires
2014-07-23 14:59     ` Nikolai Kondrashov [this message]
2014-07-23 12:42 ` [PATCH 5/5] hid: huion: Handle tablets with UC-Logic vendor ID Nikolai Kondrashov
2014-07-23 14:43   ` Benjamin Tissoires
2014-07-23 13:39 ` [PATCHES] hid: Add support for more Huion tablets Nikolai Kondrashov

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=53CFCDED.1030607@gmail.com \
    --to=spbnick@gmail.com \
    --cc=DIGImend-devel@lists.sourceforge.net \
    --cc=benjamin.tissoires@gmail.com \
    --cc=jkosina@suse.cz \
    --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 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.