* values commonly reported.
*/
if (pen)
- features->device_type = BTN_TOOL_PEN;
+ features->device_type |= WACOM_DEVICETYPE_PEN;
else if (finger)
- features->device_type = BTN_TOOL_FINGER;
+ features->device_type |= WACOM_DEVICETYPE_TOUCH;
else
return;
if (features->type == HID_GENERIC)
return wacom_hid_set_device_mode(hdev);
- if (features->device_type == BTN_TOOL_FINGER) {
+ if (features->device_type & WACOM_DEVICETYPE_TOUCH) {
if (features->type > TABLETPC) {
/* MT Tablet PC touch */
return wacom_set_device_mode(hdev, 3, 4, 4);
else if (features->type == BAMBOO_PAD) {
return wacom_set_device_mode(hdev, 2, 2, 2);
}
- } else if (features->device_type == BTN_TOOL_PEN) {
+ } else if (features->device_type & WACOM_DEVICETYPE_PEN) {
if (features->type <= BAMBOO_PT && features->type != WIRELESS) {
return wacom_set_device_mode(hdev, 2, 2, 2);
}
*/
if (features->type == WIRELESS) {
if (intf->cur_altsetting->desc.bInterfaceNumber == 0) {
- features->device_type = 0;
+ features->device_type = WACOM_DEVICETYPE_NONE;
} else if (intf->cur_altsetting->desc.bInterfaceNumber == 2) {
- features->device_type = BTN_TOOL_FINGER;
+ features->device_type |= WACOM_DEVICETYPE_TOUCH;
features->pktlen = WACOM_PKGLEN_BBTOUCH3;
}
}
wacom_wac->shared = &data->shared;
- if (wacom_wac->features.device_type == BTN_TOOL_FINGER)
+ if (wacom_wac->features.device_type & WACOM_DEVICETYPE_TOUCH)
wacom_wac->shared->touch = hdev;
- else if (wacom_wac->features.device_type == BTN_TOOL_PEN)
+ else if (wacom_wac->features.device_type & WACOM_DEVICETYPE_PEN)
wacom_wac->shared->pen = hdev;
out:
case INTUOSPS:
case INTUOSPM:
case INTUOSPL:
- if (wacom->wacom_wac.features.device_type == BTN_TOOL_PEN) {
+ if (wacom->wacom_wac.features.device_type & WACOM_DEVICETYPE_PEN) {
wacom->led.select[0] = 0;
wacom->led.select[1] = 0;
wacom->led.llv = 32;
case INTUOSPS:
case INTUOSPM:
case INTUOSPL:
- if (wacom->wacom_wac.features.device_type == BTN_TOOL_PEN)
+ if (wacom->wacom_wac.features.device_type & WACOM_DEVICETYPE_PEN)
sysfs_remove_group(&wacom->hdev->dev.kobj,
&intuos5_led_attr_group);
break;
/* Stylus interface */
wacom_wac1->features =
*((struct wacom_features *)id->driver_data);
- wacom_wac1->features.device_type = BTN_TOOL_PEN;
+ wacom_wac1->features.device_type |= WACOM_DEVICETYPE_PEN;
snprintf(wacom_wac1->name, WACOM_NAME_MAX, "%s (WL) Pen",
wacom_wac1->features.name);
snprintf(wacom_wac1->pad_name, WACOM_NAME_MAX, "%s (WL) Pad",
wacom_wac2->features =
*((struct wacom_features *)id->driver_data);
wacom_wac2->features.pktlen = WACOM_PKGLEN_BBTOUCH3;
- wacom_wac2->features.device_type = BTN_TOOL_FINGER;
+ wacom_wac2->features.device_type |= WACOM_DEVICETYPE_TOUCH;
wacom_wac2->features.x_max = wacom_wac2->features.y_max = 4096;
if (wacom_wac2->features.touch_max)
snprintf(wacom_wac2->name, WACOM_NAME_MAX,
snprintf(wacom_wac->pad_name, sizeof(wacom_wac->pad_name),
"%s Pad", name);
- if (features->device_type == BTN_TOOL_PEN) {
+ if (features->device_type & WACOM_DEVICETYPE_PEN) {
snprintf(wacom_wac->name, sizeof(wacom_wac->name),
"%s Pen", name);
}
- else if (features->device_type == BTN_TOOL_FINGER) {
+ else if (features->device_type & WACOM_DEVICETYPE_TOUCH) {
if (features->touch_max)
snprintf(wacom_wac->name, sizeof(wacom_wac->name),
"%s Finger", name);
wacom_retrieve_hid_descriptor(hdev, features);
wacom_setup_device_quirks(wacom);
- if (!features->device_type && features->type != WIRELESS) {
+ if (features->device_type == WACOM_DEVICETYPE_NONE &&
+ features->type != WIRELESS) {
error = features->type == HID_GENERIC ? -ENODEV : 0;
dev_warn(&hdev->dev, "Unknown device_type for '%s'. %s.",
if (error)
goto fail_shared_data;
- features->device_type = BTN_TOOL_PEN;
+ features->device_type |= WACOM_DEVICETYPE_PEN;
}
wacom_calculate_res(features);
error = hid_hw_open(hdev);
if (wacom_wac->features.type == INTUOSHT && wacom_wac->features.touch_max) {
- if (wacom_wac->features.device_type == BTN_TOOL_FINGER)
+ if (wacom_wac->features.device_type & WACOM_DEVICETYPE_TOUCH)
wacom_wac->shared->touch_input = wacom_wac->input;
}
struct wacom_features *features = &wacom->wacom_wac.features;
/* touch device found but size is not defined. use default */
- if (features->device_type == BTN_TOOL_FINGER && !features->x_max) {
+ if (features->device_type & WACOM_DEVICETYPE_TOUCH && !features->x_max) {
features->x_max = 1023;
features->y_max = 1023;
}
if ((features->type >= INTUOS5S && features->type <= INTUOSHT) ||
(features->type == BAMBOO_PT)) {
if (features->pktlen == WACOM_PKGLEN_BBTOUCH3) {
- features->device_type = BTN_TOOL_FINGER;
+ features->device_type |= WACOM_DEVICETYPE_TOUCH;
features->x_max = 4096;
features->y_max = 4096;
* so rewrite this one to be of type BTN_TOOL_FINGER.
*/
if (features->type == BAMBOO_PAD)
- features->device_type = BTN_TOOL_FINGER;
+ features->device_type |= WACOM_DEVICETYPE_TOUCH;
if (wacom->hdev->bus == BUS_BLUETOOTH)
features->quirks |= WACOM_QUIRK_BATTERY;
features->quirks |= WACOM_QUIRK_NO_INPUT;
/* must be monitor interface if no device_type set */
- if (!features->device_type) {
+ if (features->device_type == WACOM_DEVICETYPE_NONE) {
features->quirks |= WACOM_QUIRK_MONITOR;
features->quirks |= WACOM_QUIRK_BATTERY;
}
{
struct wacom_features *features = &wacom_wac->features;
- if (features->device_type == BTN_TOOL_PEN) {
+ if (features->device_type & WACOM_DEVICETYPE_PEN) {
input_set_abs_params(input_dev, ABS_X, features->x_min,
features->x_max, features->x_fuzz, 0);
input_set_abs_params(input_dev, ABS_Y, features->y_min,
case INTUOSPS:
__set_bit(INPUT_PROP_POINTER, input_dev->propbit);
- if (features->device_type == BTN_TOOL_PEN) {
+ if (features->device_type & WACOM_DEVICETYPE_PEN) {
input_set_abs_params(input_dev, ABS_DISTANCE, 0,
features->distance_max,
0, 0);
input_abs_set_res(input_dev, ABS_Z, 287);
wacom_setup_intuos(wacom_wac);
- } else if (features->device_type == BTN_TOOL_FINGER) {
+ } else if (features->device_type & WACOM_DEVICETYPE_TOUCH) {
__clear_bit(ABS_MISC, input_dev->absbit);
input_set_abs_params(input_dev, ABS_MT_TOUCH_MAJOR,
break;
case WACOM_24HDT:
- if (features->device_type == BTN_TOOL_FINGER) {
+ if (features->device_type & WACOM_DEVICETYPE_TOUCH) {
input_set_abs_params(input_dev, ABS_MT_TOUCH_MAJOR, 0, features->x_max, 0, 0);
input_set_abs_params(input_dev, ABS_MT_WIDTH_MAJOR, 0, features->x_max, 0, 0);
input_set_abs_params(input_dev, ABS_MT_WIDTH_MINOR, 0, features->y_max, 0, 0);
case MTTPC:
case MTTPC_B:
case TABLETPC2FG:
- if (features->device_type == BTN_TOOL_FINGER && features->touch_max > 1)
+ if (features->device_type & WACOM_DEVICETYPE_TOUCH && features->touch_max > 1)
input_mt_init_slots(input_dev, features->touch_max, INPUT_MT_DIRECT);
/* fall through */
__set_bit(INPUT_PROP_DIRECT, input_dev->propbit);
- if (features->device_type != BTN_TOOL_PEN)
+ if (!(features->device_type & WACOM_DEVICETYPE_PEN))
break; /* no need to process stylus stuff */
/* fall through */
case INTUOSHT:
if (features->touch_max &&
- features->device_type == BTN_TOOL_FINGER) {
+ features->device_type & WACOM_DEVICETYPE_TOUCH) {
input_dev->evbit[0] |= BIT_MASK(EV_SW);
__set_bit(SW_MUTE_DEVICE, input_dev->swbit);
}
case BAMBOO_PT:
__clear_bit(ABS_MISC, input_dev->absbit);
- if (features->device_type == BTN_TOOL_FINGER) {
+ if (features->device_type & WACOM_DEVICETYPE_TOUCH) {
if (features->touch_max) {
if (features->pktlen == WACOM_PKGLEN_BBTOUCH3) {
/* PAD is setup by wacom_setup_pad_input_capabilities later */
return 1;
}
- } else if (features->device_type == BTN_TOOL_PEN) {
+ } else if (features->device_type & WACOM_DEVICETYPE_PEN) {
__set_bit(INPUT_PROP_POINTER, input_dev->propbit);
__set_bit(BTN_TOOL_RUBBER, input_dev->keybit);
__set_bit(BTN_TOOL_PEN, input_dev->keybit);
case INTUOS5S:
case INTUOSPS:
/* touch interface does not have the pad device */
- if (features->device_type != BTN_TOOL_PEN)
+ if (!(features->device_type & WACOM_DEVICETYPE_PEN))
return -ENODEV;
for (i = 0; i < 7; i++)
case INTUOSHT:
case BAMBOO_PT:
/* pad device is on the touch interface */
- if ((features->device_type != BTN_TOOL_FINGER) ||
+ if (!(features->device_type & WACOM_DEVICETYPE_TOUCH) ||
/* Bamboo Pen only tablet does not have pad */
((features->type == BAMBOO_PT) && !features->touch_max))
return -ENODEV;
#define WACOM_QUIRK_MONITOR 0x0004
#define WACOM_QUIRK_BATTERY 0x0008
+/* device types */
+#define WACOM_DEVICETYPE_NONE 0x0000
+#define WACOM_DEVICETYPE_PEN 0x0001
+#define WACOM_DEVICETYPE_TOUCH 0x0002
+
#define WACOM_VENDORDEFINED_PEN 0xff0d0001
#define WACOM_PEN_FIELD(f) (((f)->logical == HID_DG_STYLUS) || \