Skip to content

Commit 3352f47

Browse files
committed
uclogic: Add support for bitmap dials
1 parent 3630d38 commit 3352f47

2 files changed

Lines changed: 21 additions & 1 deletion

File tree

hid-uclogic-core.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -394,6 +394,13 @@ static int uclogic_raw_event_frame(
394394
}
395395
}
396396

397+
/* If need to, and can, transform the bitmap dial reports */
398+
if (frame->bitmap_dial_byte > 0 && frame->bitmap_dial_byte < size) {
399+
if (data[frame->bitmap_dial_byte] == 2) {
400+
data[frame->bitmap_dial_byte] = -1;
401+
}
402+
}
403+
397404
return 0;
398405
}
399406

hid-uclogic-params.h

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,13 @@ struct uclogic_params_frame {
153153
* Zero if no reversal should be done.
154154
*/
155155
__s8 touch_ring_flip_at;
156+
/*
157+
* Offset of the bitmap dial byte, in the report. Zero if not present.
158+
* Only valid if "id" is not zero. A bitmap dial sends reports with a
159+
* dedicated bit per direction: 1 means clockwise rotation, 2 means
160+
* counterclockwise, as opposed to the normal 1 and -1.
161+
*/
162+
unsigned int bitmap_dial_byte;
156163
};
157164

158165
/*
@@ -230,6 +237,7 @@ extern int uclogic_params_init(struct uclogic_params *params,
230237
"\t\t.touch_ring_byte = %u\n" \
231238
"\t\t.touch_ring_max = %hhd\n" \
232239
"\t\t.touch_ring_flip_at = %hhd\n" \
240+
"\t\t.bitmap_dial_byte = %u\n" \
233241
"\t},\n" \
234242
"\t{\n" \
235243
"\t\t.desc_ptr = %p\n" \
@@ -241,6 +249,7 @@ extern int uclogic_params_init(struct uclogic_params *params,
241249
"\t\t.touch_ring_byte = %u\n" \
242250
"\t\t.touch_ring_max = %hhd\n" \
243251
"\t\t.touch_ring_flip_at = %hhd\n" \
252+
"\t\t.bitmap_dial_byte = %u\n" \
244253
"\t},\n" \
245254
"\t{\n" \
246255
"\t\t.desc_ptr = %p\n" \
@@ -252,6 +261,7 @@ extern int uclogic_params_init(struct uclogic_params *params,
252261
"\t\t.touch_ring_byte = %u\n" \
253262
"\t\t.touch_ring_max = %hhd\n" \
254263
"\t\t.touch_ring_flip_at = %hhd\n" \
264+
"\t\t.bitmap_dial_byte = %u\n" \
255265
"\t},\n" \
256266
"}\n"
257267

@@ -281,6 +291,7 @@ extern int uclogic_params_init(struct uclogic_params *params,
281291
(_params)->frame_list[0].touch_ring_byte, \
282292
(_params)->frame_list[0].touch_ring_max, \
283293
(_params)->frame_list[0].touch_ring_flip_at, \
294+
(_params)->frame_list[0].bitmap_dial_byte, \
284295
(_params)->frame_list[1].desc_ptr, \
285296
(_params)->frame_list[1].desc_size, \
286297
(_params)->frame_list[1].id, \
@@ -290,6 +301,7 @@ extern int uclogic_params_init(struct uclogic_params *params,
290301
(_params)->frame_list[1].touch_ring_byte, \
291302
(_params)->frame_list[1].touch_ring_max, \
292303
(_params)->frame_list[1].touch_ring_flip_at, \
304+
(_params)->frame_list[1].bitmap_dial_byte, \
293305
(_params)->frame_list[2].desc_ptr, \
294306
(_params)->frame_list[2].desc_size, \
295307
(_params)->frame_list[2].id, \
@@ -298,7 +310,8 @@ extern int uclogic_params_init(struct uclogic_params *params,
298310
(_params)->frame_list[2].dev_id_byte, \
299311
(_params)->frame_list[2].touch_ring_byte, \
300312
(_params)->frame_list[2].touch_ring_max, \
301-
(_params)->frame_list[2].touch_ring_flip_at
313+
(_params)->frame_list[2].touch_ring_flip_at, \
314+
(_params)->frame_list[2].bitmap_dial_byte
302315

303316
/* Get a replacement report descriptor for a tablet's interface. */
304317
extern int uclogic_params_get_desc(const struct uclogic_params *params,

0 commit comments

Comments
 (0)