135
135
InitializeTouch(InputInfoPtr pInfo)
137
SynapticsPrivate *priv = (SynapticsPrivate *)pInfo->private;
138
struct eventcomm_proto_data *proto_data = (struct eventcomm_proto_data*)priv->proto_data;
137
SynapticsPrivate *priv = (SynapticsPrivate *) pInfo->private;
138
struct eventcomm_proto_data *proto_data =
139
(struct eventcomm_proto_data *) priv->proto_data;
141
142
if (!priv->has_touch)
144
145
proto_data->mtdev = mtdev_new_open(pInfo->fd);
145
if (!proto_data->mtdev)
146
if (!proto_data->mtdev) {
147
147
xf86IDrvMsg(pInfo, X_WARNING,
148
148
"failed to create mtdev instance, ignoring touch events\n");
152
152
proto_data->cur_slot = proto_data->mtdev->caps.slot.value;
153
153
proto_data->num_touches = 0;
155
proto_data->last_mt_vals = calloc(priv->num_slots,
156
sizeof(ValuatorMask *));
157
if (!proto_data->last_mt_vals)
155
proto_data->last_mt_vals = calloc(priv->num_slots, sizeof(ValuatorMask *));
156
if (!proto_data->last_mt_vals) {
159
157
xf86IDrvMsg(pInfo, X_WARNING,
160
158
"failed to allocate MT last values mask array\n");
161
159
UninitializeTouch(pInfo);
165
for (i = 0; i < priv->num_slots; i++)
163
for (i = 0; i < priv->num_slots; i++) {
169
166
proto_data->last_mt_vals[i] = valuator_mask_new(4 + priv->num_mt_axes);
170
if (!proto_data->last_mt_vals[i])
167
if (!proto_data->last_mt_vals[i]) {
172
168
xf86IDrvMsg(pInfo, X_WARNING,
173
169
"failed to allocate MT last values mask\n");
174
170
UninitializeTouch(pInfo);
189
EventDeviceOnHook(InputInfoPtr pInfo, SynapticsParameters *para)
185
EventDeviceOnHook(InputInfoPtr pInfo, SynapticsParameters * para)
191
SynapticsPrivate *priv = (SynapticsPrivate *)pInfo->private;
192
struct eventcomm_proto_data *proto_data = (struct eventcomm_proto_data*)priv->proto_data;
187
SynapticsPrivate *priv = (SynapticsPrivate *) pInfo->private;
188
struct eventcomm_proto_data *proto_data =
189
(struct eventcomm_proto_data *) priv->proto_data;
194
191
if (para->grab_event_device) {
195
/* Try to grab the event device so that data don't leak to /dev/input/mice */
197
SYSCALL(ret = ioctl(pInfo->fd, EVIOCGRAB, (pointer)1));
199
xf86IDrvMsg(pInfo, X_WARNING, "can't grab event device, errno=%d\n",
192
/* Try to grab the event device so that data don't leak to /dev/input/mice */
195
SYSCALL(ret = ioctl(pInfo->fd, EVIOCGRAB, (pointer) 1));
197
xf86IDrvMsg(pInfo, X_WARNING, "can't grab event device, errno=%d\n",
205
203
proto_data->need_grab = FALSE;
255
252
SYSCALL(rc = ioctl(fd, EVIOCGBIT(0, sizeof(evbits)), evbits));
258
255
if (!TEST_BIT(EV_SYN, evbits) ||
259
!TEST_BIT(EV_ABS, evbits) ||
260
!TEST_BIT(EV_KEY, evbits))
256
!TEST_BIT(EV_ABS, evbits) || !TEST_BIT(EV_KEY, evbits))
263
259
SYSCALL(rc = ioctl(fd, EVIOCGBIT(EV_ABS, sizeof(absbits)), absbits));
266
if (!TEST_BIT(ABS_X, absbits) ||
267
!TEST_BIT(ABS_Y, absbits))
262
if (!TEST_BIT(ABS_X, absbits) || !TEST_BIT(ABS_Y, absbits))
270
265
SYSCALL(rc = ioctl(fd, EVIOCGBIT(EV_KEY, sizeof(keybits)), keybits));
274
269
/* we expect touchpad either report raw pressure or touches */
275
270
if (!TEST_BIT(ABS_PRESSURE, absbits) && !TEST_BIT(BTN_TOUCH, keybits))
277
272
/* all Synaptics-like touchpad report BTN_TOOL_FINGER */
278
273
if (!TEST_BIT(BTN_TOOL_FINGER, keybits))
280
275
if (TEST_BIT(BTN_TOOL_PEN, keybits))
281
goto unwind; /* Don't match wacom tablets */
276
goto unwind; /* Don't match wacom tablets */
287
SYSCALL(ioctl(fd, EVIOCGRAB, (pointer)0));
282
SYSCALL(ioctl(fd, EVIOCGRAB, (pointer) 0));
289
284
return (ret == TRUE);
295
enum TouchpadModel model;
290
enum TouchpadModel model;
296
291
} model_lookup_t;
297
293
#define PRODUCT_ANY 0x0000
299
295
static model_lookup_t model_lookup_table[] = {
300
{0x0002, 0x0007, MODEL_SYNAPTICS},
301
{0x0002, 0x0008, MODEL_ALPS},
302
{0x05ac, PRODUCT_ANY, MODEL_APPLETOUCH},
303
{0x0002, 0x000e, MODEL_ELANTECH},
296
{0x0002, 0x0007, MODEL_SYNAPTICS},
297
{0x0002, 0x0008, MODEL_ALPS},
298
{0x05ac, PRODUCT_ANY, MODEL_APPLETOUCH},
299
{0x0002, 0x000e, MODEL_ELANTECH},
356
355
int *min, int *max, int *fuzz, int *res)
359
struct input_absinfo abs = {0};
358
struct input_absinfo abs = { 0 };
361
360
SYSCALL(rc = ioctl(fd, EVIOCGABS(code), &abs));
363
xf86IDrvMsg(pInfo, X_ERROR, "%s EVIOCGABS error on %d (%s)\n",
364
__func__, code, strerror(errno));
362
xf86IDrvMsg(pInfo, X_ERROR, "%s EVIOCGABS error on %d (%s)\n",
363
__func__, code, strerror(errno));
368
367
*min = abs.minimum;
369
368
*max = abs.maximum;
370
369
/* We dont trust a zero fuzz as it probably is just a lazy value */
371
370
if (fuzz && abs.fuzz > 0)
373
372
#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,30)
375
*res = abs.resolution;
374
*res = abs.resolution;
382
380
/* Query device for axis ranges */
384
382
event_query_axis_ranges(InputInfoPtr pInfo)
386
SynapticsPrivate *priv = (SynapticsPrivate *)pInfo->private;
384
SynapticsPrivate *priv = (SynapticsPrivate *) pInfo->private;
387
385
struct eventcomm_proto_data *proto_data = priv->proto_data;
388
unsigned long absbits[NBITS(ABS_MAX)] = {0};
389
unsigned long keybits[NBITS(KEY_MAX)] = {0};
386
unsigned long absbits[NBITS(ABS_MAX)] = { 0 };
387
unsigned long keybits[NBITS(KEY_MAX)] = { 0 };
388
char buf[256] = { 0 };
393
391
/* The kernel's fuzziness concept seems a bit weird, but it can more or
394
392
* less be applied as hysteresis directly, i.e. no factor here. */
395
393
event_get_abs(pInfo, pInfo->fd, ABS_X, &priv->minx, &priv->maxx,
396
&priv->synpara.hyst_x, &priv->resx);
394
&priv->synpara.hyst_x, &priv->resx);
398
396
event_get_abs(pInfo, pInfo->fd, ABS_Y, &priv->miny, &priv->maxy,
399
&priv->synpara.hyst_y, &priv->resy);
397
&priv->synpara.hyst_y, &priv->resy);
401
399
priv->has_pressure = FALSE;
402
400
priv->has_width = FALSE;
403
401
SYSCALL(rc = ioctl(pInfo->fd, EVIOCGBIT(EV_ABS, sizeof(absbits)), absbits));
406
priv->has_pressure = (TEST_BIT(ABS_PRESSURE, absbits) != 0);
407
priv->has_width = (TEST_BIT(ABS_TOOL_WIDTH, absbits) != 0);
403
priv->has_pressure = (TEST_BIT(ABS_PRESSURE, absbits) != 0);
404
priv->has_width = (TEST_BIT(ABS_TOOL_WIDTH, absbits) != 0);
410
xf86IDrvMsg(pInfo, X_ERROR, "failed to query ABS bits (%s)\n", strerror(errno));
407
xf86IDrvMsg(pInfo, X_ERROR, "failed to query ABS bits (%s)\n",
412
410
if (priv->has_pressure)
413
event_get_abs(pInfo, pInfo->fd, ABS_PRESSURE, &priv->minp, &priv->maxp,
411
event_get_abs(pInfo, pInfo->fd, ABS_PRESSURE, &priv->minp, &priv->maxp,
416
414
if (priv->has_width)
417
event_get_abs(pInfo, pInfo->fd, ABS_TOOL_WIDTH,
418
&priv->minw, &priv->maxw,
415
event_get_abs(pInfo, pInfo->fd, ABS_TOOL_WIDTH,
416
&priv->minw, &priv->maxw, NULL, NULL);
421
418
#if HAVE_MULTITOUCH
419
if (priv->has_touch) {
424
420
int st_minx = priv->minx;
425
421
int st_maxx = priv->maxx;
426
422
int st_miny = priv->miny;
443
439
SYSCALL(rc = ioctl(pInfo->fd, EVIOCGBIT(EV_KEY, sizeof(keybits)), keybits));
446
priv->has_left = (TEST_BIT(BTN_LEFT, keybits) != 0);
447
priv->has_right = (TEST_BIT(BTN_RIGHT, keybits) != 0);
448
priv->has_middle = (TEST_BIT(BTN_MIDDLE, keybits) != 0);
449
priv->has_double = (TEST_BIT(BTN_TOOL_DOUBLETAP, keybits) != 0);
450
priv->has_triple = (TEST_BIT(BTN_TOOL_TRIPLETAP, keybits) != 0);
441
priv->has_left = (TEST_BIT(BTN_LEFT, keybits) != 0);
442
priv->has_right = (TEST_BIT(BTN_RIGHT, keybits) != 0);
443
priv->has_middle = (TEST_BIT(BTN_MIDDLE, keybits) != 0);
444
priv->has_double = (TEST_BIT(BTN_TOOL_DOUBLETAP, keybits) != 0);
445
priv->has_triple = (TEST_BIT(BTN_TOOL_TRIPLETAP, keybits) != 0);
452
if ((TEST_BIT(BTN_0, keybits) != 0) ||
453
(TEST_BIT(BTN_1, keybits) != 0) ||
454
(TEST_BIT(BTN_2, keybits) != 0) ||
455
(TEST_BIT(BTN_3, keybits) != 0))
456
priv->has_scrollbuttons = 1;
447
if ((TEST_BIT(BTN_0, keybits) != 0) ||
448
(TEST_BIT(BTN_1, keybits) != 0) ||
449
(TEST_BIT(BTN_2, keybits) != 0) || (TEST_BIT(BTN_3, keybits) != 0))
450
priv->has_scrollbuttons = 1;
459
453
/* Now print the device information */
460
454
xf86IDrvMsg(pInfo, X_PROBED, "x-axis range %d - %d\n",
461
priv->minx, priv->maxx);
455
priv->minx, priv->maxx);
462
456
xf86IDrvMsg(pInfo, X_PROBED, "y-axis range %d - %d\n",
463
priv->miny, priv->maxy);
457
priv->miny, priv->maxy);
464
458
if (priv->has_pressure)
465
xf86IDrvMsg(pInfo, X_PROBED, "pressure range %d - %d\n",
466
priv->minp, priv->maxp);
459
xf86IDrvMsg(pInfo, X_PROBED, "pressure range %d - %d\n",
460
priv->minp, priv->maxp);
468
xf86IDrvMsg(pInfo, X_INFO,
469
"device does not report pressure, will use touch data.\n");
462
xf86IDrvMsg(pInfo, X_INFO,
463
"device does not report pressure, will use touch data.\n");
470
464
if (priv->has_width)
471
xf86IDrvMsg(pInfo, X_PROBED, "finger width range %d - %d\n",
472
priv->minw, priv->maxw);
465
xf86IDrvMsg(pInfo, X_PROBED, "finger width range %d - %d\n",
466
priv->minw, priv->maxw);
474
xf86IDrvMsg(pInfo, X_INFO,
475
"device does not report finger width.\n");
468
xf86IDrvMsg(pInfo, X_INFO, "device does not report finger width.\n");
477
470
if (priv->has_left)
478
strcat(buf, " left");
471
strcat(buf, " left");
479
472
if (priv->has_right)
480
strcat(buf, " right");
473
strcat(buf, " right");
481
474
if (priv->has_middle)
482
strcat(buf, " middle");
475
strcat(buf, " middle");
483
476
if (priv->has_double)
484
strcat(buf, " double");
477
strcat(buf, " double");
485
478
if (priv->has_triple)
486
strcat(buf, " triple");
479
strcat(buf, " triple");
487
480
if (priv->has_scrollbuttons)
488
strcat(buf, " scroll-buttons");
481
strcat(buf, " scroll-buttons");
490
483
xf86IDrvMsg(pInfo, X_PROBED, "buttons:%s\n", buf);
517
511
#ifdef HAVE_MULTITOUCH
518
512
if (proto_data->mtdev)
519
513
len = mtdev_get(proto_data->mtdev, pInfo->fd, ev, 1) *
520
sizeof(struct input_event);
514
sizeof(struct input_event);
523
517
len = read(pInfo->fd, ev, sizeof(*ev));
526
519
/* We use X_NONE here because it doesn't alloc */
527
520
if (errno != EAGAIN)
528
xf86MsgVerb(X_NONE, 0, "%s: Read error %s\n", pInfo->name, strerror(errno));
521
xf86MsgVerb(X_NONE, 0, "%s: Read error %s\n", pInfo->name,
530
} else if (len % sizeof(*ev)) {
531
xf86MsgVerb(X_NONE, 0, "%s: Read error, invalid number of bytes.", pInfo->name);
525
else if (len % sizeof(*ev)) {
526
xf86MsgVerb(X_NONE, 0, "%s: Read error, invalid number of bytes.",
586
579
xf86IDrvMsg(pInfo, X_WARNING,
587
580
"Attempted to copy values from out-of-range "
588
581
"slot, touch events may be incorrect.\n");
591
584
hw->slot_state[slot_index] = SLOTSTATE_CLOSE;
592
585
proto_data->num_touches--;
596
589
int map = proto_data->axis_map[ev->code - ABS_MT_TOUCH_MAJOR];
597
591
valuator_mask_set(hw->mt_mask[slot_index], map, ev->value);
592
if (slot_index >= 0) {
600
593
ValuatorMask *mask = proto_data->last_mt_vals[slot_index];
601
594
int last_val = valuator_mask_get(mask, map);
603
if (EventTouchSlotPreviouslyOpen(priv, slot_index))
596
if (EventTouchSlotPreviouslyOpen(priv, slot_index)) {
605
597
if (ev->code == ABS_MT_POSITION_X)
606
598
hw->cumulative_dx += ev->value - last_val;
607
599
else if (ev->code == ABS_MT_POSITION_Y)
648
640
static inline double
649
641
apply_st_scaling(struct eventcomm_proto_data *proto_data, int value, int axis)
651
return value * proto_data->st_to_mt_scale[axis] + proto_data->st_to_mt_offset[axis];
643
return value * proto_data->st_to_mt_scale[axis] +
644
proto_data->st_to_mt_offset[axis];
655
648
EventReadHwState(InputInfoPtr pInfo,
656
struct CommData *comm, struct SynapticsHwState *hwRet)
649
struct CommData *comm, struct SynapticsHwState *hwRet)
658
651
struct input_event ev;
660
653
struct SynapticsHwState *hw = comm->hwState;
661
SynapticsPrivate *priv = (SynapticsPrivate *)pInfo->private;
654
SynapticsPrivate *priv = (SynapticsPrivate *) pInfo->private;
662
655
SynapticsParameters *para = &priv->synpara;
663
656
struct eventcomm_proto_data *proto_data = priv->proto_data;
665
658
SynapticsResetTouchHwState(hw, FALSE);
667
660
/* Reset cumulative values if buttons were not previously pressed */
668
if (!hw->left && !hw->right && !hw->middle)
661
if (!hw->left && !hw->right && !hw->middle) {
670
662
hw->cumulative_dx = hw->x;
671
663
hw->cumulative_dy = hw->y;
674
666
while (SynapticsReadEvent(pInfo, &ev)) {
679
hw->numFingers = count_fingers(pInfo, comm);
680
hw->millis = 1000 * ev.time.tv_sec + ev.time.tv_usec / 1000;
681
SynapticsCopyHwState(hwRet, hw);
686
v = (ev.value ? TRUE : FALSE);
727
case BTN_TOOL_FINGER:
730
case BTN_TOOL_DOUBLETAP:
731
comm->twoFingers = v;
733
case BTN_TOOL_TRIPLETAP:
734
comm->threeFingers = v;
737
if (!priv->has_pressure)
738
hw->z = v ? para->finger_high + 1 : 0;
743
if (ev.code < ABS_MT_SLOT) {
746
hw->x = apply_st_scaling(proto_data, ev.value, 0);
749
hw->y = apply_st_scaling(proto_data, ev.value, 1);
755
hw->fingerWidth = ev.value;
759
EventProcessTouchEvent(pInfo, hw, &ev);
671
hw->numFingers = count_fingers(pInfo, comm);
672
hw->millis = 1000 * ev.time.tv_sec + ev.time.tv_usec / 1000;
673
SynapticsCopyHwState(hwRet, hw);
678
v = (ev.value ? TRUE : FALSE);
719
case BTN_TOOL_FINGER:
722
case BTN_TOOL_DOUBLETAP:
723
comm->twoFingers = v;
725
case BTN_TOOL_TRIPLETAP:
726
comm->threeFingers = v;
729
if (!priv->has_pressure)
730
hw->z = v ? para->finger_high + 1 : 0;
735
if (ev.code < ABS_MT_SLOT) {
738
hw->x = apply_st_scaling(proto_data, ev.value, 0);
741
hw->y = apply_st_scaling(proto_data, ev.value, 1);
747
hw->fingerWidth = ev.value;
752
EventProcessTouchEvent(pInfo, hw, &ev);
766
759
/* filter for the AutoDevProbe scandir on /dev/input */
767
static int EventDevOnly(const struct dirent *dir) {
768
return strncmp(EVENT_DEV_NAME, dir->d_name, 5) == 0;
761
EventDevOnly(const struct dirent *dir)
763
return strncmp(EVENT_DEV_NAME, dir->d_name, 5) == 0;
771
766
#ifdef HAVE_MULTITOUCH
773
768
event_query_touch(InputInfoPtr pInfo)
775
SynapticsPrivate *priv = (SynapticsPrivate *)pInfo->private;
770
SynapticsPrivate *priv = (SynapticsPrivate *) pInfo->private;
776
771
SynapticsParameters *para = &priv->synpara;
777
772
struct eventcomm_proto_data *proto_data = priv->proto_data;
778
773
struct mtdev *mtdev;
786
781
#ifdef EVIOCGPROP
787
782
SYSCALL(rc = ioctl(pInfo->fd, EVIOCGPROP(sizeof(prop)), &prop));
788
if (rc >= 0 && BitIsOn(&prop, INPUT_PROP_SEMI_MT))
783
if (rc >= 0 && BitIsOn(&prop, INPUT_PROP_SEMI_MT)) {
790
784
xf86IDrvMsg(pInfo, X_INFO,
791
785
"ignoring touch events for semi-multitouch device\n");
792
786
priv->has_semi_mt = TRUE;
795
if (rc >= 0 && BitIsOn(&prop, INPUT_PROP_BUTTONPAD))
789
if (rc >= 0 && BitIsOn(&prop, INPUT_PROP_BUTTONPAD)) {
797
790
xf86IDrvMsg(pInfo, X_INFO, "found clickpad property\n");
798
791
para->clickpad = TRUE;
802
795
mtdev = mtdev_new_open(pInfo->fd);
805
797
xf86IDrvMsg(pInfo, X_WARNING,
806
798
"failed to open mtdev when querying touch capabilities\n");
810
for (i = 0; i < MT_ABS_SIZE; i++)
812
if (mtdev->caps.has_abs[i])
802
for (i = 0; i < MT_ABS_SIZE; i++) {
803
if (mtdev->caps.has_abs[i]) {
816
805
/* X and Y axis info is handed by synaptics already */
817
case ABS_MT_POSITION_X - ABS_MT_TOUCH_MAJOR:
818
case ABS_MT_POSITION_Y - ABS_MT_TOUCH_MAJOR:
806
case ABS_MT_POSITION_X - ABS_MT_TOUCH_MAJOR:
807
case ABS_MT_POSITION_Y - ABS_MT_TOUCH_MAJOR:
819
808
/* Skip tracking ID info */
820
case ABS_MT_TRACKING_ID - ABS_MT_TOUCH_MAJOR:
809
case ABS_MT_TRACKING_ID - ABS_MT_TOUCH_MAJOR:
826
815
priv->has_touch = TRUE;
819
if (priv->has_touch) {
833
static const char *labels[] =
822
static const char *labels[] = {
835
823
AXIS_LABEL_PROP_ABS_MT_TOUCH_MAJOR,
836
824
AXIS_LABEL_PROP_ABS_MT_TOUCH_MINOR,
837
825
AXIS_LABEL_PROP_ABS_MT_WIDTH_MAJOR,
848
836
if (mtdev->caps.slot.maximum > 0)
849
837
priv->max_touches = mtdev->caps.slot.maximum -
850
mtdev->caps.slot.minimum + 1;
838
mtdev->caps.slot.minimum + 1;
852
840
priv->touch_axes = malloc(priv->num_mt_axes *
853
841
sizeof(SynapticsTouchAxisRec));
854
if (!priv->touch_axes)
842
if (!priv->touch_axes) {
856
843
priv->has_touch = FALSE;
861
for (i = 0; i < MT_ABS_SIZE; i++)
863
if (mtdev->caps.has_abs[i])
848
for (i = 0; i < MT_ABS_SIZE; i++) {
849
if (mtdev->caps.has_abs[i]) {
867
851
/* X and Y axis info is handed by synaptics already, we just
868
852
* need to map the evdev codes to the valuator numbers */
869
case ABS_MT_POSITION_X - ABS_MT_TOUCH_MAJOR:
870
proto_data->axis_map[i] = 0;
853
case ABS_MT_POSITION_X - ABS_MT_TOUCH_MAJOR:
854
proto_data->axis_map[i] = 0;
873
case ABS_MT_POSITION_Y - ABS_MT_TOUCH_MAJOR:
874
proto_data->axis_map[i] = 1;
857
case ABS_MT_POSITION_Y - ABS_MT_TOUCH_MAJOR:
858
proto_data->axis_map[i] = 1;
877
861
/* Skip tracking ID info */
878
case ABS_MT_TRACKING_ID - ABS_MT_TOUCH_MAJOR:
862
case ABS_MT_TRACKING_ID - ABS_MT_TOUCH_MAJOR:
882
priv->touch_axes[axnum].label = labels[i];
883
priv->touch_axes[axnum].min =
884
mtdev->caps.abs[i].minimum;
885
priv->touch_axes[axnum].max =
886
mtdev->caps.abs[i].maximum;
887
/* Kernel provides units/mm, X wants units/m */
888
priv->touch_axes[axnum].res =
889
mtdev->caps.abs[i].resolution * 1000;
890
/* Valuators 0-3 are used for X, Y, and scrolling */
891
proto_data->axis_map[i] = 4 + axnum;
866
priv->touch_axes[axnum].label = labels[i];
867
priv->touch_axes[axnum].min = mtdev->caps.abs[i].minimum;
868
priv->touch_axes[axnum].max = mtdev->caps.abs[i].maximum;
869
/* Kernel provides units/mm, X wants units/m */
870
priv->touch_axes[axnum].res =
871
mtdev->caps.abs[i].resolution * 1000;
872
/* Valuators 0-3 are used for X, Y, and scrolling */
873
proto_data->axis_map[i] = 4 + axnum;
900
882
mtdev_close(mtdev);
922
905
proto_data->cur_slot = -1;
925
if (event_query_is_touchpad(pInfo->fd, (proto_data) ? proto_data->need_grab : TRUE))
908
if (event_query_is_touchpad
909
(pInfo->fd, (proto_data) ? proto_data->need_grab : TRUE)) {
927
910
#ifdef HAVE_MULTITOUCH
928
911
event_query_touch(pInfo);
930
913
event_query_axis_ranges(pInfo);
932
event_query_model(pInfo->fd, &priv->model, &priv->id_vendor, &priv->id_product);
915
event_query_model(pInfo->fd, &priv->model, &priv->id_vendor,
934
918
xf86IDrvMsg(pInfo, X_PROBED, "Vendor %#hx Product %#hx\n",
935
919
priv->id_vendor, priv->id_product);
945
929
struct dirent **namelist;
949
SYSCALL(fd = open(device, O_RDONLY));
952
touchpad_found = event_query_is_touchpad(fd, TRUE);
934
SYSCALL(fd = open(device, O_RDONLY));
936
touchpad_found = event_query_is_touchpad(fd, TRUE);
955
939
/* if a device is set and not a touchpad (or already grabbed),
956
940
* we must return FALSE. Otherwise, we'll add a device that
957
941
* wasn't requested for and repeat
958
942
* f5687a6741a19ef3081e7fd83ac55f6df8bcd5c2. */
959
return touchpad_found;
943
return touchpad_found;
963
947
i = scandir(DEV_INPUT_EVENT, &namelist, EventDevOnly, alphasort);
965
xf86IDrvMsg(pInfo, X_ERROR, "Couldn't open %s\n", DEV_INPUT_EVENT);
949
xf86IDrvMsg(pInfo, X_ERROR, "Couldn't open %s\n", DEV_INPUT_EVENT);
968
952
else if (i == 0) {
969
xf86IDrvMsg(pInfo, X_ERROR, "The /dev/input/event* device nodes seem to be missing\n");
953
xf86IDrvMsg(pInfo, X_ERROR,
954
"The /dev/input/event* device nodes seem to be missing\n");
978
if (!touchpad_found) {
979
sprintf(fname, "%s/%s", DEV_INPUT_EVENT, namelist[i]->d_name);
980
SYSCALL(fd = open(fname, O_RDONLY));
984
if (event_query_is_touchpad(fd, TRUE)) {
985
touchpad_found = TRUE;
986
xf86IDrvMsg(pInfo, X_PROBED, "auto-dev sets device to %s\n",
989
xf86ReplaceStrOption(pInfo->options, "Device", fname);
963
if (!touchpad_found) {
964
sprintf(fname, "%s/%s", DEV_INPUT_EVENT, namelist[i]->d_name);
965
SYSCALL(fd = open(fname, O_RDONLY));
969
if (event_query_is_touchpad(fd, TRUE)) {
970
touchpad_found = TRUE;
971
xf86IDrvMsg(pInfo, X_PROBED, "auto-dev sets device to %s\n",
974
xf86ReplaceStrOption(pInfo->options, "Device", fname);
998
983
if (!touchpad_found) {
999
xf86IDrvMsg(pInfo, X_ERROR, "no synaptics event device found\n");
984
xf86IDrvMsg(pInfo, X_ERROR, "no synaptics event device found\n");