Skip to content

Commit 9956953

Browse files
bentissJiri Kosina
authored andcommitted
HID: wacom: power_supply: provide the actual model_name
Instead of displaying a generic "tablet", now g-c-c shows a pretty "Wacom Intuos Pro S (WL)". Signed-off-by: Benjamin Tissoires <[email protected]> Acked-by: Ping Cheng <[email protected]> Signed-off-by: Jiri Kosina <[email protected]>
1 parent 136ae5e commit 9956953

File tree

3 files changed

+13
-0
lines changed

3 files changed

+13
-0
lines changed

drivers/hid/wacom.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,7 @@ struct wacom_group_leds {
134134
};
135135

136136
struct wacom_battery {
137+
struct wacom *wacom;
137138
struct power_supply_desc bat_desc;
138139
struct power_supply *battery;
139140
char bat_name[WACOM_NAME_MAX];

drivers/hid/wacom_sys.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1336,6 +1336,7 @@ static int wacom_initialize_leds(struct wacom *wacom)
13361336
}
13371337

13381338
static enum power_supply_property wacom_battery_props[] = {
1339+
POWER_SUPPLY_PROP_MODEL_NAME,
13391340
POWER_SUPPLY_PROP_PRESENT,
13401341
POWER_SUPPLY_PROP_STATUS,
13411342
POWER_SUPPLY_PROP_SCOPE,
@@ -1350,6 +1351,9 @@ static int wacom_battery_get_property(struct power_supply *psy,
13501351
int ret = 0;
13511352

13521353
switch (psp) {
1354+
case POWER_SUPPLY_PROP_MODEL_NAME:
1355+
val->strval = battery->wacom->wacom_wac.name;
1356+
break;
13531357
case POWER_SUPPLY_PROP_PRESENT:
13541358
val->intval = battery->bat_connected;
13551359
break;
@@ -1392,6 +1396,8 @@ static int __wacom_initialize_battery(struct wacom *wacom,
13921396
if (!devres_open_group(dev, bat_desc, GFP_KERNEL))
13931397
return -ENOMEM;
13941398

1399+
battery->wacom = wacom;
1400+
13951401
n = atomic_inc_return(&battery_no) - 1;
13961402

13971403
bat_desc->properties = wacom_battery_props;
@@ -1863,6 +1869,9 @@ static void wacom_update_name(struct wacom *wacom, const char *suffix)
18631869
strlcpy(name, features->name, sizeof(name));
18641870
}
18651871

1872+
snprintf(wacom_wac->name, sizeof(wacom_wac->name), "%s%s",
1873+
name, suffix);
1874+
18661875
/* Append the device type to the name */
18671876
snprintf(wacom_wac->pen_name, sizeof(wacom_wac->pen_name),
18681877
"%s%s Pen", name, suffix);
@@ -2097,6 +2106,8 @@ static void wacom_wireless_work(struct work_struct *work)
20972106
goto fail;
20982107
}
20992108

2109+
strlcpy(wacom_wac->name, wacom_wac1->name,
2110+
sizeof(wacom_wac->name));
21002111
error = wacom_initialize_battery(wacom);
21012112
if (error)
21022113
goto fail;

drivers/hid/wacom_wac.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -226,6 +226,7 @@ struct wacom_remote_data {
226226
};
227227

228228
struct wacom_wac {
229+
char name[WACOM_NAME_MAX];
229230
char pen_name[WACOM_NAME_MAX];
230231
char touch_name[WACOM_NAME_MAX];
231232
char pad_name[WACOM_NAME_MAX];

0 commit comments

Comments
 (0)