History log of /linux-master/drivers/hid/hid-uclogic-params.c
Revision Date Author Comments
# 9266a881 26-Dec-2022 José Expósito <jose.exposito89@gmail.com>

HID: uclogic: Add support for XP-PEN Deco Pro MW

The XP-PEN Deco Pro MW is a UGEE v2 device with a frame with 8 buttons,
a bitmap dial and a mouse. Its pen has 2 buttons, supports tilt and
pressure.

It can be connected using a USB cable or, to use it in wireless mode,
using a USB Bluetooth dongle. When it is connected in wireless mode the
device battery is used to power it.

All the pieces to support it are already in place. Add its ID and
quirks in order to support the device.

Link: https://github.com/DIGImend/digimend-kernel-drivers/issues/622
Tested-by: Andreas Grosse <andig.mail@t-online.de>
Signed-off-by: José Expósito <jose.exposito89@gmail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>


# 7744ca57 26-Dec-2022 José Expósito <jose.exposito89@gmail.com>

HID: uclogic: Add support for XP-PEN Deco Pro SW

The XP-PEN Deco Pro SW is a UGEE v2 device with a frame with 8 buttons,
a bitmap dial and a mouse; however, the UCLOGIC_MOUSE_FRAME_QUIRK is
required because it reports an incorrect frame type. Its pen has 2
buttons, supports tilt and pressure.

It can be connected using a USB cable or, to use it in wireless mode,
using a USB Bluetooth dongle. When it is connected in wireless mode the
device battery is used to power it.

All the pieces to support it are already in place. Add its ID and
quirks in order to support the device.

Signed-off-by: José Expósito <jose.exposito89@gmail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>


# a251d657 26-Dec-2022 José Expósito <jose.exposito89@gmail.com>

HID: uclogic: Handle wireless device reconnection

UGEEv2 tablets with battery can be connected using a USB cable or a USB
Bluetooth dongle.

When the Bluetooth dongle is used, the connection to that tablet can be
lost because the tablet is out of the range of the receiver or because
it was switched off using the switch placed in the back of the tablet's
frame.

After losing connection, the tablet is able to reconnect automatically
and its firmware sends a special packet indicating that the device was
reconnected. In response to this packet, the tablet needs to receive the
same array of magic data it expects on probe to enable its interfaces.

This patch implements a generic mechanism to hook raw events and
schedule a work to perform any custom action.

Tested-by: Mia Kanashi <chad@redpilled.dev>
Tested-by: Andreas Grosse <andig.mail@t-online.de>
Signed-off-by: José Expósito <jose.exposito89@gmail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>


# bd85c131 26-Dec-2022 José Expósito <jose.exposito89@gmail.com>

HID: uclogic: Refactor UGEEv2 probe magic data

A fututure patch will need to use the array of magic data that the
UGEEv2 devices expect on probe and the endpoint number. Move them to a
common place.

Refactor, no functional changes.

Tested-by: Mia Kanashi <chad@redpilled.dev>
Tested-by: Andreas Grosse <andig.mail@t-online.de>
Signed-off-by: José Expósito <jose.exposito89@gmail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>


# f60c377f 26-Dec-2022 José Expósito <jose.exposito89@gmail.com>

HID: uclogic: Add battery quirk

Some UGEE v2 tablets have a wireless version with an internal battery
and their firmware is able to report their battery level.

However, there was not found a field on their descriptor indicating
whether the tablet has battery or not, making it mandatory to classify
such devices through the UCLOGIC_BATTERY_QUIRK quirk.

Tested-by: Mia Kanashi <chad@redpilled.dev>
Tested-by: Andreas Grosse <andig.mail@t-online.de>
Signed-off-by: José Expósito <jose.exposito89@gmail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>


# 14b71e6a 26-Dec-2022 José Expósito <jose.exposito89@gmail.com>

HID: uclogic: Add frame type quirk

The report descriptor used to get information about UGEE v2 devices is
incorrect in the XP-PEN Deco Pro SW. It indicates that the device frame
is of type UCLOGIC_PARAMS_FRAME_BUTTONS but the device has a frame of
type UCLOGIC_PARAMS_FRAME_MOUSE.

Here is the original report descriptor:

0x0e 0x03 0xc8 0xb3 0x34 0x65 0x08 0x00 0xff 0x1f 0xd8 0x13 0x00 0x00
^ This byte should be 2

Add a quirk to be able to fix the reported frame type.

Tested-by: Mia Kanashi <chad@redpilled.dev>
Tested-by: Andreas Grosse <andig.mail@t-online.de>
Signed-off-by: José Expósito <jose.exposito89@gmail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>


# febb2c0d 26-Dec-2022 José Expósito <jose.exposito89@gmail.com>

HID: uclogic: Add support for XP-PEN Deco 01 V2

The XP-PEN Deco 01 V2 is a UGEE v2 device with a frame with 8 buttons.
Its pen has 2 buttons, supports tilt and pressure.

Add its ID in order to support the device.

Link: https://gitlab.freedesktop.org/libinput/libinput/-/issues/839
Tested-by: Mark Waddoups <mwaddoups@gmail.com>
Signed-off-by: José Expósito <jose.exposito89@gmail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>


# f9ce4db0 29-Oct-2022 José Expósito <jose.exposito89@gmail.com>

HID: uclogic: Add support for XP-PEN Deco LW

The XP-PEN Deco LW is a UGEE v2 device with a frame with 8 buttons.
Its pen has 2 buttons, supports tilt and pressure.

It can be connected by USB cable or using a USB Bluetooth dongle to use
it in wireless mode. When it is connected using the dongle, the device
battery is used to power it.

Its vendor, product and version are identical to the Deco L. The only
difference reported by its firmware is the product name.
In order to add support for battery reporting, add a new HID descriptor
and a quirk to detect the wireless version of the tablet.

Link: https://github.com/DIGImend/digimend-kernel-drivers/issues/635
Tested-by: Mia Kanashi <chad@redpilled.dev>
Tested-by: Andreas Grosse <andig.mail@t-online.de>
Tested-by: Mia Kanashi <chad@redpilled.dev>
Signed-off-by: José Expósito <jose.exposito89@gmail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>


# 7495fb7e 15-Aug-2022 José Expósito <jose.exposito89@gmail.com>

HID: uclogic: Add support for Parblo A610 PRO

The Parblo A610 PRO is a UGEE v2 device with a frame with 9 buttons
and a bitmap dial. Its pen has 2 buttons, supports tilt and pressure.

Add its ID in order to support the device.

Signed-off-by: José Expósito <jose.exposito89@gmail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>


# 93b40b3e 15-Aug-2022 José Expósito <jose.exposito89@gmail.com>

HID: uclogic: Add support for XP-PEN Deco Pro S

The XP-PEN Deco Pro S is a UGEE v2 device with a frame with 8 buttons,
a bitmap dial and a mouse. Its pen has 2 buttons, supports tilt and
pressure.

All the pieces to support it are already in place. Add its ID in order
to support the device.

The required Wireshark traces were captured by Jouke Witteveen.
For more information check [1].

Link: https://gitlab.freedesktop.org/libinput/libinput/-/issues/738 [1]
Tested-by: Jouke Witteveen <j.witteveen@gmail.com>
Signed-off-by: José Expósito <jose.exposito89@gmail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>


# 387dcab7 15-Aug-2022 José Expósito <jose.exposito89@gmail.com>

HID: uclogic: Add support for UGEE v2 mouse frames

Add the required HID descriptors and the initialization function for
UGEE v2 frames with a mouse in the frame.

Tested-by: Jouke Witteveen <j.witteveen@gmail.com>
Signed-off-by: José Expósito <jose.exposito89@gmail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>


# b67439d7 15-Aug-2022 José Expósito <jose.exposito89@gmail.com>

HID: uclogic: Add support for UGEE v2 dial frames

Add the required HID descriptors and the initialization function for
UGEE v2 frames with a bitmap dial.

Tested-by: Jouke Witteveen <j.witteveen@gmail.com>
Signed-off-by: José Expósito <jose.exposito89@gmail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>


# a092986f 15-Aug-2022 José Expósito <jose.exposito89@gmail.com>

HID: uclogic: Parse the UGEE v2 frame type

The string descriptor returned by UGEE v2 devices contains a byte
indicating the device frame type.

The values discovered so far are:

- 0: Frame with buttons, present in the XP-PEN Deco L.
- 1: Frame with buttons and dial, present in the PARBLO A610 PRO.
- 2: Frame with buttons and a mouse, shaped as a dial + touchpad.
Present in the XP-PEN Deco Pro S.

Parse the frame type and add KUnit tests.

Tested-by: Jouke Witteveen <j.witteveen@gmail.com>
Signed-off-by: José Expósito <jose.exposito89@gmail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>


# 86402296 15-Aug-2022 José Expósito <jose.exposito89@gmail.com>

HID: uclogic: Refactor UGEE v2 frame initialization

At the moment, the driver only supports UGEE v2 devices that have
buttons in their frames.

In order to support other types of frames in the future, move the code
used to initialize this kind of frames to its own function.

Tested-by: Jouke Witteveen <j.witteveen@gmail.com>
Signed-off-by: José Expósito <jose.exposito89@gmail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>


# a64cbf3c 15-Aug-2022 José Expósito <jose.exposito89@gmail.com>

HID: uclogic: Refactor UGEE v2 string descriptor parsing

The UGEE v2 tablets expose a string descriptor with their capabilities.

Move the code used to parse the descriptors and generate a parameter
list from it to its own function and add KUnit tests to validate the
parser.

Tested-by: Jouke Witteveen <j.witteveen@gmail.com>
Signed-off-by: José Expósito <jose.exposito89@gmail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>


# 0cb1fc09 11-Jun-2022 José Expósito <jose.exposito89@gmail.com>

HID: uclogic: Add support for XP-PEN Deco L

The XP-PEN Deco L (UGEE) needs to be initialized by sending a buffer of
magic data, discovered by sniffing the Windows driver traffic.

In order to differentiate UGEE tablets that need this kind of
initialization from the previous ones, name them v2 internally and
create an entry point for them.

After initialization, the template report descriptors can be discovered
by parsing a string descriptor, similar to the one exposed by HUION v1
devices.

Add all the required elements to support the device.

Signed-off-by: José Expósito <jose.exposito89@gmail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>


# 76e645be 11-Jun-2022 José Expósito <jose.exposito89@gmail.com>

HID: uclogic: Make template placeholder IDs generic

Up until now, the report descriptor template parameter IDs were only
used with pen report descriptors and they were named accordingly.

Rename the enum and the total number of IDs to make them interface
agnostic.

Refactor, no functional changes.

Signed-off-by: José Expósito <jose.exposito89@gmail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>


# d5e649a5 03-Jun-2022 Bagas Sanjaya <bagasdotme@gmail.com>

HID: uclogic: properly format kernel-doc comment for hid_dbg() wrappers

Running kernel-doc script on drivers/hid/hid-uclogic-params.c, it found
6 warnings for hid_dbg() wrapper functions below:

drivers/hid/hid-uclogic-params.c:48: warning: This comment starts with '/**', but isn't a kernel-doc comment. Refer Documentation/doc-guide/kernel-doc.rst
* Dump tablet interface pen parameters with hid_dbg(), indented with one tab.
drivers/hid/hid-uclogic-params.c:48: warning: missing initial short description on line:
* Dump tablet interface pen parameters with hid_dbg(), indented with one tab.
drivers/hid/hid-uclogic-params.c:48: info: Scanning doc for function Dump
drivers/hid/hid-uclogic-params.c:80: warning: This comment starts with '/**', but isn't a kernel-doc comment. Refer Documentation/doc-guide/kernel-doc.rst
* Dump tablet interface frame parameters with hid_dbg(), indented with two
drivers/hid/hid-uclogic-params.c:80: warning: missing initial short description on line:
* Dump tablet interface frame parameters with hid_dbg(), indented with two
drivers/hid/hid-uclogic-params.c:80: info: Scanning doc for function Dump
drivers/hid/hid-uclogic-params.c:105: warning: This comment starts with '/**', but isn't a kernel-doc comment. Refer Documentation/doc-guide/kernel-doc.rst
* Dump tablet interface parameters with hid_dbg().
drivers/hid/hid-uclogic-params.c:105: warning: missing initial short description on line:
* Dump tablet interface parameters with hid_dbg().

One of them is reported by kernel test robot.

Fix these warnings by properly format kernel-doc comment for these
functions.

Link: https://lore.kernel.org/linux-doc/202205272033.XFYlYj8k-lkp@intel.com/
Fixes: a228809fa6f39c ("HID: uclogic: Move param printing to a function")
Reported-by: kernel test robot <lkp@intel.com>
Tested-by: Randy Dunlap <rdunlap@infradead.org>
Tested-by: José Expósito <jose.exposito89@gmail.com>
Acked-by: Randy Dunlap <rdunlap@infradead.org>
Cc: Nikolai Kondrashov <spbnick@gmail.com>
Cc: Jiri Kosina <jikos@kernel.org>
Cc: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Cc: llvm@lists.linux.dev
Cc: linux-input@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Bagas Sanjaya <bagasdotme@gmail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>


# 61b1db5a 08-May-2022 Roman Romanenko <romu4444@gmail.com>

HID: uclogic: Add pen support for XP-PEN Star 06

Similar to other UGEE pens, but the IDs were missing.

Signed-off-by: Roman Romanenko <romu4444@gmail.com>
Signed-off-by: Nikolai Kondrashov <spbnick@gmail.com>
Signed-off-by: José Expósito <jose.exposito89@gmail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>


# 118dfdea 08-May-2022 Nikolai Kondrashov <spbnick@gmail.com>

HID: uclogic: Differentiate touch ring and touch strip

Improve support for touch strips.

Signed-off-by: Nikolai Kondrashov <spbnick@gmail.com>
Signed-off-by: José Expósito <jose.exposito89@gmail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>


# fbc08b4e 08-May-2022 Nikolai Kondrashov <spbnick@gmail.com>

HID: uclogic: Always shift touch reports to zero

Always decrement touch report values to have the range start with zero,
regardless if flipped or not. This fixes the future non-flipped touch
strip reports.

Signed-off-by: Nikolai Kondrashov <spbnick@gmail.com>
Signed-off-by: José Expósito <jose.exposito89@gmail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>


# caf7e934 08-May-2022 Nikolai Kondrashov <spbnick@gmail.com>

HID: uclogic: Do not focus on touch ring only

Accommodate both touch ring and touch strip in naming throughout
hid-uclogic by talking about abstract "touch" instead of "touch ring",
wherever possible.

Signed-off-by: Nikolai Kondrashov <spbnick@gmail.com>
Signed-off-by: José Expósito <jose.exposito89@gmail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>


# 945d5dd5 08-May-2022 Nikolai Kondrashov <spbnick@gmail.com>

HID: uclogic: Return raw parameters from v2 pen init

Return the raw parameters buffer from uclogic_params_pen_init_v2(), if
requested, as a way to identify the tablet.

Signed-off-by: Nikolai Kondrashov <spbnick@gmail.com>
Signed-off-by: José Expósito <jose.exposito89@gmail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>


# a228809f 08-May-2022 Nikolai Kondrashov <spbnick@gmail.com>

HID: uclogic: Move param printing to a function

Move parameter printing from a format string/argument list to a function
to allow printing the full parameters, which now wouldn't fit into a
single print call.

Signed-off-by: Nikolai Kondrashov <spbnick@gmail.com>
Signed-off-by: José Expósito <jose.exposito89@gmail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>


# 4c60bc7d 21-Apr-2022 Nikolai Kondrashov <spbnick@gmail.com>

HID: uclogic: Disable pen usage for Huion keyboard interfaces

Disable pen usage inputs for Huion interfaces reporting on-the-frame
buttons. We don't want to change those, as they mostly work, but we want
to avoid creation of a mute pen interface, confusing to users.

Signed-off-by: Nikolai Kondrashov <spbnick@gmail.com>
Signed-off-by: José Expósito <jose.exposito89@gmail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>


# d64a6e44 21-Apr-2022 Nikolai Kondrashov <spbnick@gmail.com>

HID: uclogic: Pass keyboard reports as is

Allow keyboard reports from interface #1 of Huion tablets to pass
unmodified, and stop the Wacom X.org driver from handling them.

The method for the latter is rather crude and also take the Dial reports
from the Wacom driver, but it's expected that libinput will be able to
handle them (still to be tested).

This enables Huion HS611 media and desktop keys.

Signed-off-by: Nikolai Kondrashov <spbnick@gmail.com>
Signed-off-by: José Expósito <jose.exposito89@gmail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>


# 6facd076 14-Apr-2022 Nikolai Kondrashov <spbnick@gmail.com>

HID: uclogic: Add support for Huion Q620M

The Huion Q620M tablet needs a v2 frame dial.

Signed-off-by: Nikolai Kondrashov <spbnick@gmail.com>
Signed-off-by: José Expósito <jose.exposito89@gmail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>


# c3e6e59a 03-Mar-2022 Nikolai Kondrashov <spbnick@gmail.com>

HID: uclogic: Add support for Huion touch ring reports

Support touch ring reports found in Huion HS610 to the UC-Logic driver.

Signed-off-by: Nikolai Kondrashov <spbnick@gmail.com>
Signed-off-by: José Expósito <jose.exposito89@gmail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>


# 337fa051 19-Feb-2022 Nikolai Kondrashov <spbnick@gmail.com>

HID: uclogic: Support multiple frame input devices

Add support for multiple frame input devices and their parameters to
the UC-Logic driver. This prepares for creating a separate input device
for Huion HS610 virtual touch ring reports.

Signed-off-by: Nikolai Kondrashov <spbnick@gmail.com>
Signed-off-by: José Expósito <jose.exposito89@gmail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>


# a985de58 19-Feb-2022 Nikolai Kondrashov <spbnick@gmail.com>

HID: uclogic: Put version first in rdesc namespace

Put general hardware version before everything else in uclogic_rdesc_
namespace.

Signed-off-by: Nikolai Kondrashov <spbnick@gmail.com>
Signed-off-by: José Expósito <jose.exposito89@gmail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>


# 2e28f3e0 19-Feb-2022 Nikolai Kondrashov <spbnick@gmail.com>

HID: uclogic: Use "frame" instead of "buttonpad"

Use the term "frame" instead of "buttonpad" for consistency, in UC-Logic
driver.

Signed-off-by: Nikolai Kondrashov <spbnick@gmail.com>
Signed-off-by: José Expósito <jose.exposito89@gmail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>


# e6be956f 19-Feb-2022 Nikolai Kondrashov <spbnick@gmail.com>

HID: uclogic: Switch to matching subreport bytes

Switch from matching UC-Logic subreport with a mask to a full value to
support detecting Huion HS610 touch dial reports. Those would match the
button mask otherwise.

Signed-off-by: Nikolai Kondrashov <spbnick@gmail.com>
Signed-off-by: José Expósito <jose.exposito89@gmail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>


# 8b013098 19-Feb-2022 Nikolai Kondrashov <spbnick@gmail.com>

HID: uclogic: Replace pen_frame_flag with subreport_list

Replace a single pen_frame_flag in struct uclogic_params with
subreport_list in struct uclogic_params_pen to prepare for handling more
subreports in Huion HS610.

Signed-off-by: Nikolai Kondrashov <spbnick@gmail.com>
Signed-off-by: José Expósito <jose.exposito89@gmail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>


# 606dadc1 19-Feb-2022 Nikolai Kondrashov <spbnick@gmail.com>

HID: uclogic: Remove pen usage masking

Remove support for pen usage masking from hid-uclogic. Disable whole
interfaces instead. Most of those interfaces are useless, and if there
is one which has an unused pen usage, but also has useful reports, its
report descriptor should be rewritten instead.

This simplifies the code and the data structures.

Signed-off-by: Nikolai Kondrashov <spbnick@gmail.com>
Signed-off-by: José Expósito <jose.exposito89@gmail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>


# 85e86071 10-Feb-2022 Nikolai Kondrashov <spbnick@gmail.com>

HID: uclogic: Rename Huion HS64 PID to Huion Tablet 2

Since the 006d Huion PID is used by multiple tablets (at least HS64 and
HS610), rename its constant to a more general
"USB_DEVICE_ID_HUION_TABLET2".

Signed-off-by: Nikolai Kondrashov <spbnick@gmail.com>
Signed-off-by: José Expósito <jose.exposito89@gmail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>


# 1324c5ac 10-Feb-2022 Nikolai Kondrashov <spbnick@gmail.com>

HID: uclogic: Support Huion tilt reporting

Add support for Huion v2 protocol tilt reporting. Describe reports as
angles in degrees, which is not exactly true, but there doesn't seem to
be a straightforward, consistent conversion possible, and what's
reported would have to be enough.

Signed-off-by: Nikolai Kondrashov <spbnick@gmail.com>
Signed-off-by: José Expósito <jose.exposito89@gmail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>


# aa320fdb 05-Jan-2022 José Expósito <jose.exposito89@gmail.com>

HID: hid-uclogic-params: Invalid parameter check in uclogic_params_frame_init_v1_buttonpad

The function performs a check on the hdev input parameters, however, it
is used before the check.

Initialize the udev variable after the sanity check to avoid a
possible NULL pointer dereference.

Fixes: 9614219e9310e ("HID: uclogic: Extract tablet parameter discovery into a module")
Addresses-Coverity-ID: 1443763 ("Null pointer dereference")
Signed-off-by: José Expósito <jose.exposito89@gmail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>


# ff6b548a 05-Jan-2022 José Expósito <jose.exposito89@gmail.com>

HID: hid-uclogic-params: Invalid parameter check in uclogic_params_huion_init

The function performs a check on its input parameters, however, the
hdev parameter is used before the check.

Initialize the stack variables after checking the input parameters to
avoid a possible NULL pointer dereference.

Fixes: 9614219e9310e ("HID: uclogic: Extract tablet parameter discovery into a module")
Addresses-Coverity-ID: 1443804 ("Null pointer dereference")
Signed-off-by: José Expósito <jose.exposito89@gmail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>


# 0a94131d 05-Jan-2022 José Expósito <jose.exposito89@gmail.com>

HID: hid-uclogic-params: Invalid parameter check in uclogic_params_get_str_desc

The function performs a check on the hdev input parameters, however, it
is used before the check.

Initialize the udev variable after the sanity check to avoid a
possible NULL pointer dereference.

Fixes: 9614219e9310e ("HID: uclogic: Extract tablet parameter discovery into a module")
Addresses-Coverity-ID: 1443827 ("Null pointer dereference")
Signed-off-by: José Expósito <jose.exposito89@gmail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>


# f364c571 05-Jan-2022 José Expósito <jose.exposito89@gmail.com>

HID: hid-uclogic-params: Invalid parameter check in uclogic_params_init

The function performs a check on its input parameters, however, the
hdev parameter is used before the check.

Initialize the stack variables after checking the input parameters to
avoid a possible NULL pointer dereference.

Fixes: 9614219e9310e ("HID: uclogic: Extract tablet parameter discovery into a module")
Addresses-Coverity-ID: 1443831 ("Null pointer dereference")
Signed-off-by: José Expósito <jose.exposito89@gmail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>


# f83baa0c 01-Dec-2021 Greg Kroah-Hartman <gregkh@linuxfoundation.org>

HID: add hid_is_usb() function to make it simpler for USB detection

A number of HID drivers already call hid_is_using_ll_driver() but only
for the detection of if this is a USB device or not. Make this more
obvious by creating hid_is_usb() and calling the function that way.

Also converts the existing hid_is_using_ll_driver() functions to use the
new call.

Cc: Jiri Kosina <jikos@kernel.org>
Cc: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Cc: linux-input@vger.kernel.org
Cc: stable@vger.kernel.org
Tested-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Link: https://lore.kernel.org/r/20211201183503.2373082-1-gregkh@linuxfoundation.org


# 5abb5445 26-Mar-2021 Lee Jones <lee.jones@linaro.org>

HID: hid-uclogic-params: Ensure function names are present and correct in kernel-doc headers

Fixes the following W=1 kernel build warning(s):

drivers/hid/hid-uclogic-params.c:33: warning: expecting prototype for Convert a pen in(). Prototype was for uclogic_params_pen_inrange_to_str() instead
drivers/hid/hid-uclogic-params.c:519: warning: wrong kernel-doc identifier on line:
drivers/hid/hid-uclogic-params.c:706: warning: expecting prototype for uclogic_params_init(). Prototype was for uclogic_params_huion_init() instead

Cc: Jiri Kosina <jikos@kernel.org>
Cc: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Cc: linux-input@vger.kernel.org
Signed-off-by: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>


# f7271b2a 27-Dec-2020 Cristian Klein <cristian.klein@elastisys.com>

HID: uclogic: Improve support for Trust Panora

After more discussions with the [libinput project][1], it has been
determined that the uclogic driver provides better support for this
tablet. Fortunately, the Trust Panora is physically and logically
identical with the UGEE G5, despite having a different USB vendor and
product ID.

[1]: https://gitlab.freedesktop.org/libinput/libinput/-/issues/482

Signed-off-by: Cristian Klein <cristian.klein@elastisys.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>


# a876e7e2 15-Dec-2020 Tom Rix <trix@redhat.com>

HID: uclogic: remove h from printk format specifier

See Documentation/core-api/printk-formats.rst.
h should no longer be used in the format specifier for printk.

Signed-off-by: Tom Rix <trix@redhat.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>


# 022fc531 16-Oct-2020 Martijn van de Streek <martijn@zeewinde.xyz>

HID: uclogic: Add ID for Trust Flex Design Tablet

The Trust Flex Design Tablet has an UGTizer USB ID and requires the same
initialization as the UGTizer GP0610 to be detected as a graphics tablet
instead of a mouse.

Signed-off-by: Martijn van de Streek <martijn@zeewinde.xyz>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>


# df561f66 23-Aug-2020 Gustavo A. R. Silva <gustavoars@kernel.org>

treewide: Use fallthrough pseudo-keyword

Replace the existing /* fall through */ comments and its variants with
the new pseudo-keyword macro fallthrough[1]. Also, remove unnecessary
fall-through markings when it is the case.

[1] https://www.kernel.org/doc/html/v5.7/process/deprecated.html?highlight=fallthrough#implicit-switch-case-fall-through

Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org>


# 315ffcc9 15-Jun-2019 Kyle Godbey <me@kyle.ee>

HID: uclogic: Add support for Huion HS64 tablet

Add support for Huion HS64 drawing tablet to hid-uclogic

Signed-off-by: Kyle Godbey <me@kyle.ee>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>


# 88bb346d 08-Jun-2019 Wang Xuerui <git@xen0n.name>

HID: uclogic: Add support for Ugee Rainbow CV720

Add support for Ugee Rainbow CV720 to hid-uclogic.

Signed-off-by: Wang Xuerui <git@xen0n.name>
Reviewed-by: Nikolai Kondrashov <spbnick@gmail.com>
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>


# 1cbbd85f 02-Mar-2019 Colin Ian King <colin.king@canonical.com>

HID: uclogic: remove redudant duplicated null check on ver_ptr

Currently ver_ptr is being null checked twice, once before calling
usb_string and once afterwards. The second null check is redundant
and can be removed, remove it.

Detected by CoverityScan, CID#1477308 ("Logically dead code")

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>


# 8547b778 09-Feb-2019 Nikolai Kondrashov <spbnick@gmail.com>

HID: uclogic: Do not initialize non-USB devices

Do not try to initialize UC-Logic tablets if the underlying device is
not a USB device, but e.g. a uhid device.

Signed-off-by: Nikolai Kondrashov <spbnick@gmail.com>
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>


# e902ed93 09-Feb-2019 Nikolai Kondrashov <spbnick@gmail.com>

HID: uclogic: Add support for Ugee G5

Add support for Ugee G5 to hid-uclogic.

Signed-off-by: Nikolai Kondrashov <spbnick@gmail.com>
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>


# 08367be17 09-Feb-2019 Nikolai Kondrashov <spbnick@gmail.com>

HID: uclogic: Add support for XP-Pen Deco 01

Add support for XP-Pen Deco 01 to hid-uclogic.

Signed-off-by: Nikolai Kondrashov <spbnick@gmail.com>
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>


# 492a9e9a 09-Feb-2019 Nikolai Kondrashov <spbnick@gmail.com>

HID: uclogic: Add support for XP-Pen Star G640

Add support for XP-Pen Star G640 to hid-uclogic.

Signed-off-by: Nikolai Kondrashov <spbnick@gmail.com>
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>


# c3e5a67c 09-Feb-2019 Nikolai Kondrashov <spbnick@gmail.com>

HID: uclogic: Add support for XP-Pen Star G540

Add support for XP-Pen Star G540 to hid-uclogic.

Signed-off-by: Nikolai Kondrashov <spbnick@gmail.com>
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>


# 1ee7c685 09-Feb-2019 Nikolai Kondrashov <spbnick@gmail.com>

HID: uclogic: Add support for Ugee EX07S frame controls

Add proper support for Ugee EX07(S) frame controls to hid-uclogic.

Signed-off-by: Nikolai Kondrashov <spbnick@gmail.com>
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>


# 9c17f735 09-Feb-2019 Nikolai Kondrashov <spbnick@gmail.com>

HID: uclogic: Add support for Ugee M540

Add support for Ugee M540 to hid-uclogic.

Signed-off-by: Nikolai Kondrashov <spbnick@gmail.com>
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>


# 0c15efe9 09-Feb-2019 Nikolai Kondrashov <spbnick@gmail.com>

HID: uclogic: Add support for Ugee 2150

Add support for Ugee 2150 to hid-uclogic.

Signed-off-by: Nikolai Kondrashov <spbnick@gmail.com>
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>


# 2c3a88c6 09-Feb-2019 Nikolai Kondrashov <spbnick@gmail.com>

HID: uclogic: Support v2 protocol

Add support for UC-Logic v2 protocol to hid-uclogic.
This adds support for a bunch of new Huion models.

Signed-off-by: Nikolai Kondrashov <spbnick@gmail.com>
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>


# 01309e29 09-Feb-2019 Nikolai Kondrashov <spbnick@gmail.com>

HID: uclogic: Support in-range reporting emulation

Newer UC-Logic tablets, such as ones made by Huion have stopped
reporting in-range state, but they're otherwise worthy tablets. The
manufacturer was notified of the problem and promised to fix this in the
future. Meanwhile, detect pen coming in range, and emulate the reports
to the userspace, to make the tablets useable.

Signed-off-by: Nikolai Kondrashov <spbnick@gmail.com>
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>


# eecb5b84 09-Feb-2019 Nikolai Kondrashov <spbnick@gmail.com>

HID: uclogic: Designate current protocol v1

Designate the current UC-Logic tablet initialization protocol v1, in
preparation for adding support for v2 protocol.

Signed-off-by: Nikolai Kondrashov <spbnick@gmail.com>
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>


# 9614219e 09-Feb-2019 Nikolai Kondrashov <spbnick@gmail.com>

HID: uclogic: Extract tablet parameter discovery into a module

Refactor and extract UC-Logic tablet initialization and parameter
discovery into a module. For these tablets, the major part of parameter
discovery cannot be separated from initialization so they have to be in
the same module. Define explicitly and clearly what possible quirks the
tablets may have to make the driver implementation easier and simpler.

Signed-off-by: Nikolai Kondrashov <spbnick@gmail.com>
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>