View | Details | Raw Unified | Return to bug 257992 | Differences between
and this patch

Collapse All | Expand All

(-)b/sys/dev/hid/hmt.c (-13 / +15 lines)
Lines 300-306 hmt_attach(device_t dev) Link Here
300
	const struct hid_device_info *hw = hid_get_device_info(dev);
300
	const struct hid_device_info *hw = hid_get_device_info(dev);
301
	void *d_ptr;
301
	void *d_ptr;
302
	uint8_t *fbuf = NULL;
302
	uint8_t *fbuf = NULL;
303
	hid_size_t d_len, fsize;
303
	hid_size_t d_len, fsize, rsize;
304
	uint32_t cont_count_max;
304
	uint32_t cont_count_max;
305
	int nbuttons, btn;
305
	int nbuttons, btn;
306
	size_t i;
306
	size_t i;
Lines 321-329 hmt_attach(device_t dev) Link Here
321
321
322
	/* Fetch and parse "Contact count maximum" feature report */
322
	/* Fetch and parse "Contact count maximum" feature report */
323
	if (sc->cont_max_rlen > 1) {
323
	if (sc->cont_max_rlen > 1) {
324
		err = hid_get_report(dev, fbuf, sc->cont_max_rlen, NULL,
324
		err = hid_get_report(dev, fbuf, sc->cont_max_rlen, &rsize,
325
		    HID_FEATURE_REPORT, sc->cont_max_rid);
325
		    HID_FEATURE_REPORT, sc->cont_max_rid);
326
		if (err == 0) {
326
		if (err == 0 && (rsize - 1) * 8 >=
327
		    sc->cont_max_loc.pos + sc->cont_max_loc.size) {
327
			cont_count_max = hid_get_udata(fbuf + 1,
328
			cont_count_max = hid_get_udata(fbuf + 1,
328
			    sc->cont_max_rlen - 1, &sc->cont_max_loc);
329
			    sc->cont_max_rlen - 1, &sc->cont_max_loc);
329
			/*
330
			/*
Lines 334-356 hmt_attach(device_t dev) Link Here
334
				sc->cont_count_max = cont_count_max;
335
				sc->cont_count_max = cont_count_max;
335
		} else
336
		} else
336
			DPRINTF("hid_get_report error=%d\n", err);
337
			DPRINTF("hid_get_report error=%d\n", err);
337
	} else
338
	}
338
		DPRINTF("Feature report %hhu size invalid: %u\n",
339
	if (sc->cont_count_max == 0)
339
		    sc->cont_max_rid, sc->cont_max_rlen);
340
		sc->cont_count_max = sc->type == HMT_TYPE_TOUCHSCREEN ? 10 : 5;
340
341
341
	/* Fetch and parse "Button type" feature report */
342
	/* Fetch and parse "Button type" feature report */
342
	if (sc->btn_type_rlen > 1 && sc->btn_type_rid != sc->cont_max_rid) {
343
	if (sc->btn_type_rlen > 1 && sc->btn_type_rid != sc->cont_max_rid) {
343
		bzero(fbuf, fsize);
344
		bzero(fbuf, fsize);
344
		err = hid_get_report(dev, fbuf, sc->btn_type_rlen, NULL,
345
		err = hid_get_report(dev, fbuf, sc->btn_type_rlen, &rsize,
345
		    HID_FEATURE_REPORT, sc->btn_type_rid);
346
		    HID_FEATURE_REPORT, sc->btn_type_rid);
346
	}
347
		if (err != 0)
347
	if (sc->btn_type_rlen > 1) {
348
		if (err == 0)
349
			sc->is_clickpad = hid_get_udata(fbuf + 1,
350
			    sc->btn_type_rlen - 1, &sc->btn_type_loc) == 0;
351
		else
352
			DPRINTF("hid_get_report error=%d\n", err);
348
			DPRINTF("hid_get_report error=%d\n", err);
353
	}
349
	}
350
	if (sc->btn_type_rlen > 1 && err == 0 && (rsize - 1) * 8 >=
351
	    sc->btn_type_loc.pos + sc->btn_type_loc.size)
352
		sc->is_clickpad = hid_get_udata(fbuf + 1, sc->btn_type_rlen - 1,
353
		    &sc->btn_type_loc) == 0;
354
	else
355
		sc->is_clickpad = sc->max_button == 0 && sc->has_int_button;
354
356
355
	/* Fetch THQA certificate to enable some devices like WaveShare */
357
	/* Fetch THQA certificate to enable some devices like WaveShare */
356
	if (sc->thqa_cert_rlen > 1 && sc->thqa_cert_rid != sc->cont_max_rid)
358
	if (sc->thqa_cert_rlen > 1 && sc->thqa_cert_rid != sc->cont_max_rid)

Return to bug 257992