Lines Matching +full:ctrl +full:- +full:ids
1 /*-
2 * SPDX-License-Identifier: BSD-2-Clause
31 * Digitizer configuration top-level collection support.
32 …tps://docs.microsoft.com/en-us/windows-hardware/design/component-guidelines/windows-precision-touc…
57 "Digitizer configuration top-level collection");
143 ("impossible ctrl id %d", ctrl_id)); in hconf_set_feature_control()
144 fc = &sc->feature_controls[ctrl_id]; in hconf_set_feature_control()
145 if (fc->rlen <= 1) in hconf_set_feature_control()
148 fbuf = malloc(fc->rlen, M_TEMP, M_WAITOK | M_ZERO); in hconf_set_feature_control()
149 sx_xlock(&sc->lock); in hconf_set_feature_control()
152 * Assume the report is write-only. Then we have to check for other in hconf_set_feature_control()
155 bzero(fbuf + 1, fc->rlen - 1); in hconf_set_feature_control()
156 for (i = 0; i < nitems(sc->feature_controls); i++) { in hconf_set_feature_control()
157 struct feature_control *ofc = &sc->feature_controls[i]; in hconf_set_feature_control()
159 /* Skip unrelated report IDs. */ in hconf_set_feature_control()
160 if (ofc->rid != fc->rid) in hconf_set_feature_control()
162 KASSERT(fc->rlen == ofc->rlen, in hconf_set_feature_control()
164 fc->rid, fc->rlen, ofc->rlen)); in hconf_set_feature_control()
165 hid_put_udata(fbuf + 1, ofc->rlen - 1, &ofc->loc, in hconf_set_feature_control()
166 i == ctrl_id ? val : ofc->val); in hconf_set_feature_control()
169 fbuf[0] = fc->rid; in hconf_set_feature_control()
171 error = hid_set_report(sc->dev, fbuf, fc->rlen, in hconf_set_feature_control()
172 HID_FEATURE_REPORT, fc->rid); in hconf_set_feature_control()
174 fc->val = val; in hconf_set_feature_control()
176 sx_unlock(&sc->lock); in hconf_set_feature_control()
194 fc = &sc->feature_controls[ctrl_id]; in hconf_feature_control_handler()
195 value = fc->val; in hconf_feature_control_handler()
197 if (error != 0 || req->newptr == NULL) in hconf_feature_control_handler()
216 hid_feature, tlc_index, 0, &fc->loc, &flags, &fc->rid, NULL)) in hconf_parse_feature()
222 fc->rlen = hid_report_size(d_ptr, d_len, hid_feature, fc->rid); in hconf_parse_feature()
259 sc->dev = dev; in hconf_attach()
260 sx_init(&sc->lock, device_get_nameunit(dev)); in hconf_attach()
263 for (i = 0; i < nitems(sc->feature_controls); i++) { in hconf_attach()
264 (void)hconf_parse_feature(&sc->feature_controls[i], tlc_index, in hconf_attach()
266 if (sc->feature_controls[i].rlen > 1) { in hconf_attach()
273 sc->feature_controls[i].val = feature_control_descrs[i].value; in hconf_attach()
284 sx_destroy(&sc->lock); in hconf_detach()
296 for (i = 0; i < nitems(sc->feature_controls); i++) { in hconf_resume()
297 if (sc->feature_controls[i].rlen < 2) in hconf_resume()
300 if (sc->feature_controls[i].val == in hconf_resume()
304 sc->feature_controls[i].val); in hconf_resume()