wacom_sys.c (35f473864f1dcfdd04a247fb2b2f7e44449102d4) wacom_sys.c (eeeec27d68204701cc5d49d79f7ba811e8438109)
1// SPDX-License-Identifier: GPL-2.0-or-later
2/*
1// SPDX-License-Identifier: GPL-2.0-or-later
2/*
3 * drivers/input/tablet/wacom_sys.c
4 *
3 * USB Wacom tablet support - system specific code
4 */
5
5 * USB Wacom tablet support - system specific code
6 */
7
8/*
9 */
10
6#include "wacom_wac.h"
7#include "wacom.h"
8#include <linux/input/mt.h>
9
10#define WAC_MSG_RETRIES 5
11#define WAC_CMD_RETRIES 10
12
13#define DEV_ATTR_RW_PERM (S_IRUGO | S_IWUSR | S_IWGRP)

--- 2202 unchanged lines hidden (view full) ---

2216 }
2217
2218 if (wacom->hdev->bus == BUS_I2C) {
2219 snprintf(name, sizeof(name), "%s %X",
2220 features->name, wacom->hdev->product);
2221 } else if (strstr(product_name, "Wacom") ||
2222 strstr(product_name, "wacom") ||
2223 strstr(product_name, "WACOM")) {
11#include "wacom_wac.h"
12#include "wacom.h"
13#include <linux/input/mt.h>
14
15#define WAC_MSG_RETRIES 5
16#define WAC_CMD_RETRIES 10
17
18#define DEV_ATTR_RW_PERM (S_IRUGO | S_IWUSR | S_IWGRP)

--- 2202 unchanged lines hidden (view full) ---

2221 }
2222
2223 if (wacom->hdev->bus == BUS_I2C) {
2224 snprintf(name, sizeof(name), "%s %X",
2225 features->name, wacom->hdev->product);
2226 } else if (strstr(product_name, "Wacom") ||
2227 strstr(product_name, "wacom") ||
2228 strstr(product_name, "WACOM")) {
2224 strlcpy(name, product_name, sizeof(name));
2229 strscpy(name, product_name, sizeof(name));
2225 } else {
2226 snprintf(name, sizeof(name), "Wacom %s", product_name);
2227 }
2228
2229 /* strip out excess whitespaces */
2230 while (1) {
2231 char *gap = strstr(name, " ");
2232 if (gap == NULL)
2233 break;
2234 /* shift everything including the terminator */
2235 memmove(gap, gap+1, strlen(gap));
2236 }
2237
2238 /* get rid of trailing whitespace */
2239 if (name[strlen(name)-1] == ' ')
2240 name[strlen(name)-1] = '\0';
2241 } else {
2230 } else {
2231 snprintf(name, sizeof(name), "Wacom %s", product_name);
2232 }
2233
2234 /* strip out excess whitespaces */
2235 while (1) {
2236 char *gap = strstr(name, " ");
2237 if (gap == NULL)
2238 break;
2239 /* shift everything including the terminator */
2240 memmove(gap, gap+1, strlen(gap));
2241 }
2242
2243 /* get rid of trailing whitespace */
2244 if (name[strlen(name)-1] == ' ')
2245 name[strlen(name)-1] = '\0';
2246 } else {
2242 strlcpy(name, features->name, sizeof(name));
2247 strscpy(name, features->name, sizeof(name));
2243 }
2244
2245 snprintf(wacom_wac->name, sizeof(wacom_wac->name), "%s%s",
2246 name, suffix);
2247
2248 /* Append the device type to the name */
2249 snprintf(wacom_wac->pen_name, sizeof(wacom_wac->pen_name),
2250 "%s%s Pen", name, suffix);

--- 248 unchanged lines hidden (view full) ---

2499 *((struct wacom_features *)id->driver_data);
2500 wacom_wac2->pid = wacom_wac->pid;
2501 hid_hw_stop(hdev2);
2502 error = wacom_parse_and_register(wacom2, true);
2503 if (error)
2504 goto fail;
2505 }
2506
2248 }
2249
2250 snprintf(wacom_wac->name, sizeof(wacom_wac->name), "%s%s",
2251 name, suffix);
2252
2253 /* Append the device type to the name */
2254 snprintf(wacom_wac->pen_name, sizeof(wacom_wac->pen_name),
2255 "%s%s Pen", name, suffix);

--- 248 unchanged lines hidden (view full) ---

2504 *((struct wacom_features *)id->driver_data);
2505 wacom_wac2->pid = wacom_wac->pid;
2506 hid_hw_stop(hdev2);
2507 error = wacom_parse_and_register(wacom2, true);
2508 if (error)
2509 goto fail;
2510 }
2511
2507 strlcpy(wacom_wac->name, wacom_wac1->name,
2512 strscpy(wacom_wac->name, wacom_wac1->name,
2508 sizeof(wacom_wac->name));
2509 error = wacom_initialize_battery(wacom);
2510 if (error)
2511 goto fail;
2512 }
2513
2514 return;
2515

--- 355 unchanged lines hidden ---
2513 sizeof(wacom_wac->name));
2514 error = wacom_initialize_battery(wacom);
2515 if (error)
2516 goto fail;
2517 }
2518
2519 return;
2520

--- 355 unchanged lines hidden ---