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>
This commit is contained in:
parent
251b427566
commit
eecb5b845b
|
@ -117,8 +117,8 @@ static void uclogic_params_pen_cleanup(struct uclogic_params_pen *pen)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* uclogic_params_pen_init() - initialize tablet interface pen
|
* uclogic_params_pen_init_v1() - initialize tablet interface pen
|
||||||
* input and retrieve its parameters from the device.
|
* input and retrieve its parameters from the device, using v1 protocol.
|
||||||
*
|
*
|
||||||
* @pen: Pointer to the pen parameters to initialize (to be
|
* @pen: Pointer to the pen parameters to initialize (to be
|
||||||
* cleaned up with uclogic_params_pen_cleanup()). Not modified in
|
* cleaned up with uclogic_params_pen_cleanup()). Not modified in
|
||||||
|
@ -132,9 +132,9 @@ static void uclogic_params_pen_cleanup(struct uclogic_params_pen *pen)
|
||||||
* Returns:
|
* Returns:
|
||||||
* Zero, if successful. A negative errno code on error.
|
* Zero, if successful. A negative errno code on error.
|
||||||
*/
|
*/
|
||||||
static int uclogic_params_pen_init(struct uclogic_params_pen *pen,
|
static int uclogic_params_pen_init_v1(struct uclogic_params_pen *pen,
|
||||||
bool *pfound,
|
bool *pfound,
|
||||||
struct hid_device *hdev)
|
struct hid_device *hdev)
|
||||||
{
|
{
|
||||||
int rc;
|
int rc;
|
||||||
bool found = false;
|
bool found = false;
|
||||||
|
@ -202,8 +202,8 @@ static int uclogic_params_pen_init(struct uclogic_params_pen *pen,
|
||||||
* Generate pen report descriptor
|
* Generate pen report descriptor
|
||||||
*/
|
*/
|
||||||
desc_ptr = uclogic_rdesc_template_apply(
|
desc_ptr = uclogic_rdesc_template_apply(
|
||||||
uclogic_rdesc_pen_template_arr,
|
uclogic_rdesc_pen_v1_template_arr,
|
||||||
uclogic_rdesc_pen_template_size,
|
uclogic_rdesc_pen_v1_template_size,
|
||||||
desc_params, ARRAY_SIZE(desc_params));
|
desc_params, ARRAY_SIZE(desc_params));
|
||||||
if (desc_ptr == NULL) {
|
if (desc_ptr == NULL) {
|
||||||
rc = -ENOMEM;
|
rc = -ENOMEM;
|
||||||
|
@ -216,8 +216,8 @@ static int uclogic_params_pen_init(struct uclogic_params_pen *pen,
|
||||||
memset(pen, 0, sizeof(*pen));
|
memset(pen, 0, sizeof(*pen));
|
||||||
pen->desc_ptr = desc_ptr;
|
pen->desc_ptr = desc_ptr;
|
||||||
desc_ptr = NULL;
|
desc_ptr = NULL;
|
||||||
pen->desc_size = uclogic_rdesc_pen_template_size;
|
pen->desc_size = uclogic_rdesc_pen_v1_template_size;
|
||||||
pen->id = UCLOGIC_RDESC_PEN_ID;
|
pen->id = UCLOGIC_RDESC_PEN_V1_ID;
|
||||||
pen->inrange = UCLOGIC_PARAMS_PEN_INRANGE_INVERTED;
|
pen->inrange = UCLOGIC_PARAMS_PEN_INRANGE_INVERTED;
|
||||||
found = true;
|
found = true;
|
||||||
finish:
|
finish:
|
||||||
|
@ -280,8 +280,8 @@ static int uclogic_params_frame_init_with_desc(
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* uclogic_params_frame_init_buttonpad() - initialize abstract buttonpad
|
* uclogic_params_frame_init_v1_buttonpad() - initialize abstract buttonpad
|
||||||
* on a tablet interface.
|
* on a v1 tablet interface.
|
||||||
*
|
*
|
||||||
* @frame: Pointer to the frame parameters to initialize (to be cleaned
|
* @frame: Pointer to the frame parameters to initialize (to be cleaned
|
||||||
* up with uclogic_params_frame_cleanup()). Not modified in case
|
* up with uclogic_params_frame_cleanup()). Not modified in case
|
||||||
|
@ -295,7 +295,7 @@ static int uclogic_params_frame_init_with_desc(
|
||||||
* Returns:
|
* Returns:
|
||||||
* Zero, if successful. A negative errno code on error.
|
* Zero, if successful. A negative errno code on error.
|
||||||
*/
|
*/
|
||||||
static int uclogic_params_frame_init_buttonpad(
|
static int uclogic_params_frame_init_v1_buttonpad(
|
||||||
struct uclogic_params_frame *frame,
|
struct uclogic_params_frame *frame,
|
||||||
bool *pfound,
|
bool *pfound,
|
||||||
struct hid_device *hdev)
|
struct hid_device *hdev)
|
||||||
|
@ -335,9 +335,9 @@ static int uclogic_params_frame_init_buttonpad(
|
||||||
hid_dbg(hdev, "generic buttons enabled\n");
|
hid_dbg(hdev, "generic buttons enabled\n");
|
||||||
rc = uclogic_params_frame_init_with_desc(
|
rc = uclogic_params_frame_init_with_desc(
|
||||||
frame,
|
frame,
|
||||||
uclogic_rdesc_buttonpad_arr,
|
uclogic_rdesc_buttonpad_v1_arr,
|
||||||
uclogic_rdesc_buttonpad_size,
|
uclogic_rdesc_buttonpad_v1_size,
|
||||||
UCLOGIC_RDESC_BUTTONPAD_ID);
|
UCLOGIC_RDESC_BUTTONPAD_V1_ID);
|
||||||
if (rc != 0)
|
if (rc != 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
found = true;
|
found = true;
|
||||||
|
@ -577,23 +577,23 @@ static int uclogic_params_huion_init(struct uclogic_params *params,
|
||||||
goto output;
|
goto output;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Try to probe pen parameters */
|
/* Try to probe v1 pen parameters */
|
||||||
rc = uclogic_params_pen_init(&p.pen, &found, hdev);
|
rc = uclogic_params_pen_init_v1(&p.pen, &found, hdev);
|
||||||
if (rc != 0) {
|
if (rc != 0) {
|
||||||
hid_err(hdev,
|
hid_err(hdev,
|
||||||
"failed probing pen parameters: %d\n", rc);
|
"failed probing pen v1 parameters: %d\n", rc);
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
} else if (found) {
|
} else if (found) {
|
||||||
hid_dbg(hdev, "pen parameters found\n");
|
hid_dbg(hdev, "pen v1 parameters found\n");
|
||||||
/* Try to probe buttonpad */
|
/* Try to probe v1 buttonpad */
|
||||||
rc = uclogic_params_frame_init_buttonpad(
|
rc = uclogic_params_frame_init_v1_buttonpad(
|
||||||
&p.frame,
|
&p.frame,
|
||||||
&found, hdev);
|
&found, hdev);
|
||||||
if (rc != 0) {
|
if (rc != 0) {
|
||||||
hid_err(hdev, "v1 buttonpad probing failed: %d\n", rc);
|
hid_err(hdev, "v1 buttonpad probing failed: %d\n", rc);
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
hid_dbg(hdev, "buttonpad parameters%s found\n",
|
hid_dbg(hdev, "buttonpad v1 parameters%s found\n",
|
||||||
(found ? "" : " not"));
|
(found ? "" : " not"));
|
||||||
if (found) {
|
if (found) {
|
||||||
/* Set bitmask marking frame reports */
|
/* Set bitmask marking frame reports */
|
||||||
|
@ -601,7 +601,7 @@ static int uclogic_params_huion_init(struct uclogic_params *params,
|
||||||
}
|
}
|
||||||
goto output;
|
goto output;
|
||||||
}
|
}
|
||||||
hid_dbg(hdev, "pen parameters not found\n");
|
hid_dbg(hdev, "pen v1 parameters not found\n");
|
||||||
|
|
||||||
uclogic_params_init_invalid(&p);
|
uclogic_params_init_invalid(&p);
|
||||||
|
|
||||||
|
@ -776,8 +776,8 @@ int uclogic_params_init(struct uclogic_params *params,
|
||||||
USB_DEVICE_ID_UGEE_TABLET_EX07S):
|
USB_DEVICE_ID_UGEE_TABLET_EX07S):
|
||||||
/* If this is the pen interface */
|
/* If this is the pen interface */
|
||||||
if (bInterfaceNumber == 1) {
|
if (bInterfaceNumber == 1) {
|
||||||
/* Probe pen parameters */
|
/* Probe v1 pen parameters */
|
||||||
rc = uclogic_params_pen_init(&p.pen, &found, hdev);
|
rc = uclogic_params_pen_init_v1(&p.pen, &found, hdev);
|
||||||
if (rc != 0) {
|
if (rc != 0) {
|
||||||
hid_err(hdev, "pen probing failed: %d\n", rc);
|
hid_err(hdev, "pen probing failed: %d\n", rc);
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
|
@ -531,8 +531,8 @@ __u8 uclogic_rdesc_twha60_fixed1_arr[] = {
|
||||||
const size_t uclogic_rdesc_twha60_fixed1_size =
|
const size_t uclogic_rdesc_twha60_fixed1_size =
|
||||||
sizeof(uclogic_rdesc_twha60_fixed1_arr);
|
sizeof(uclogic_rdesc_twha60_fixed1_arr);
|
||||||
|
|
||||||
/* Fixed report descriptor template for (tweaked) pen reports */
|
/* Fixed report descriptor template for (tweaked) v1 pen reports */
|
||||||
const __u8 uclogic_rdesc_pen_template_arr[] = {
|
const __u8 uclogic_rdesc_pen_v1_template_arr[] = {
|
||||||
0x05, 0x0D, /* Usage Page (Digitizer), */
|
0x05, 0x0D, /* Usage Page (Digitizer), */
|
||||||
0x09, 0x02, /* Usage (Pen), */
|
0x09, 0x02, /* Usage (Pen), */
|
||||||
0xA1, 0x01, /* Collection (Application), */
|
0xA1, 0x01, /* Collection (Application), */
|
||||||
|
@ -582,8 +582,8 @@ const __u8 uclogic_rdesc_pen_template_arr[] = {
|
||||||
0xC0 /* End Collection */
|
0xC0 /* End Collection */
|
||||||
};
|
};
|
||||||
|
|
||||||
const size_t uclogic_rdesc_pen_template_size =
|
const size_t uclogic_rdesc_pen_v1_template_size =
|
||||||
sizeof(uclogic_rdesc_pen_template_arr);
|
sizeof(uclogic_rdesc_pen_v1_template_arr);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Expand to the contents of a generic buttonpad report descriptor.
|
* Expand to the contents of a generic buttonpad report descriptor.
|
||||||
|
@ -631,12 +631,12 @@ const size_t uclogic_rdesc_pen_template_size =
|
||||||
0xC0, /* End Collection, */ \
|
0xC0, /* End Collection, */ \
|
||||||
0xC0 /* End Collection */
|
0xC0 /* End Collection */
|
||||||
|
|
||||||
/* Fixed report descriptor for (tweaked) buttonpad reports */
|
/* Fixed report descriptor for (tweaked) v1 buttonpad reports */
|
||||||
const __u8 uclogic_rdesc_buttonpad_arr[] = {
|
const __u8 uclogic_rdesc_buttonpad_v1_arr[] = {
|
||||||
UCLOGIC_RDESC_BUTTONPAD_BYTES(20)
|
UCLOGIC_RDESC_BUTTONPAD_BYTES(20)
|
||||||
};
|
};
|
||||||
const size_t uclogic_rdesc_buttonpad_size =
|
const size_t uclogic_rdesc_buttonpad_v1_size =
|
||||||
sizeof(uclogic_rdesc_buttonpad_arr);
|
sizeof(uclogic_rdesc_buttonpad_v1_arr);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* uclogic_rdesc_template_apply() - apply report descriptor parameters to a
|
* uclogic_rdesc_template_apply() - apply report descriptor parameters to a
|
||||||
|
|
|
@ -100,18 +100,18 @@ enum uclogic_rdesc_pen_ph_id {
|
||||||
#define UCLOGIC_RDESC_PEN_PH(_ID) \
|
#define UCLOGIC_RDESC_PEN_PH(_ID) \
|
||||||
UCLOGIC_RDESC_PH_HEAD, UCLOGIC_RDESC_PEN_PH_ID_##_ID
|
UCLOGIC_RDESC_PH_HEAD, UCLOGIC_RDESC_PEN_PH_ID_##_ID
|
||||||
|
|
||||||
/* Report ID for pen reports */
|
/* Report ID for v1 pen reports */
|
||||||
#define UCLOGIC_RDESC_PEN_ID 0x07
|
#define UCLOGIC_RDESC_PEN_V1_ID 0x07
|
||||||
|
|
||||||
/* Fixed report descriptor template for (tweaked) pen reports */
|
/* Fixed report descriptor template for (tweaked) v1 pen reports */
|
||||||
extern const __u8 uclogic_rdesc_pen_template_arr[];
|
extern const __u8 uclogic_rdesc_pen_v1_template_arr[];
|
||||||
extern const size_t uclogic_rdesc_pen_template_size;
|
extern const size_t uclogic_rdesc_pen_v1_template_size;
|
||||||
|
|
||||||
/* Fixed report descriptor for (tweaked) buttonpad reports */
|
/* Fixed report descriptor for (tweaked) v1 buttonpad reports */
|
||||||
extern const __u8 uclogic_rdesc_buttonpad_arr[];
|
extern const __u8 uclogic_rdesc_buttonpad_v1_arr[];
|
||||||
extern const size_t uclogic_rdesc_buttonpad_size;
|
extern const size_t uclogic_rdesc_buttonpad_v1_size;
|
||||||
|
|
||||||
/* Report ID for tweaked buttonpad reports */
|
/* Report ID for tweaked v1 buttonpad reports */
|
||||||
#define UCLOGIC_RDESC_BUTTONPAD_ID 0xf7
|
#define UCLOGIC_RDESC_BUTTONPAD_V1_ID 0xf7
|
||||||
|
|
||||||
#endif /* _HID_UCLOGIC_RDESC_H */
|
#endif /* _HID_UCLOGIC_RDESC_H */
|
||||||
|
|
Loading…
Reference in New Issue