Skip to content

Commit

Permalink
HID: uclogic: Add battery quirk
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
José Expósito authored and Jiri Kosina committed Jan 18, 2023
1 parent 14b71e6 commit f60c377
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
5 changes: 5 additions & 0 deletions drivers/hid/hid-uclogic-params.c
Original file line number Diff line number Diff line change
Expand Up @@ -1222,6 +1222,11 @@ static int uclogic_params_ugee_v2_init_frame_mouse(struct uclogic_params *p)
*/
static bool uclogic_params_ugee_v2_has_battery(struct hid_device *hdev)
{
struct uclogic_drvdata *drvdata = hid_get_drvdata(hdev);

if (drvdata->quirks & UCLOGIC_BATTERY_QUIRK)
return true;

/* The XP-PEN Deco LW vendor, product and version are identical to the
* Deco L. The only difference reported by their firmware is the product
* name. Add a quirk to support battery reporting on the wireless
Expand Down
1 change: 1 addition & 0 deletions drivers/hid/hid-uclogic-params.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
#include <linux/hid.h>

#define UCLOGIC_MOUSE_FRAME_QUIRK BIT(0)
#define UCLOGIC_BATTERY_QUIRK BIT(1)

/* Types of pen in-range reporting */
enum uclogic_params_pen_inrange {
Expand Down

0 comments on commit f60c377

Please sign in to comment.