1 /* $OpenBSD: hidmtvar.h,v 1.8 2019/11/08 01:20:22 yasuoka Exp $ */ 2 /* 3 * Copyright (c) 2016 joshua stein <jcs@openbsd.org> 4 * 5 * Permission to use, copy, modify, and distribute this software for any 6 * purpose with or without fee is hereby granted, provided that the above 7 * copyright notice and this permission notice appear in all copies. 8 * 9 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 10 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 11 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 12 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 13 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 14 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 15 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 16 */ 17 18 struct hidmt_data { 19 int32_t usage; 20 struct hid_location loc; 21 SIMPLEQ_ENTRY(hidmt_data) entry; 22 }; 23 24 struct hidmt_contact { 25 int x; 26 int y; 27 int width; 28 int height; 29 int tip; 30 int confidence; 31 int contactid; 32 33 int seen; 34 }; 35 36 struct hidmt { 37 int sc_enabled; 38 uint32_t sc_flags; 39 #define HIDMT_REVY 0x0001 /* Y-axis is reversed ("natural" scrolling) */ 40 41 struct device *sc_device; 42 int (*hidev_report_type_conv)(int); 43 int (*hidev_get_report)(struct device *, int, int, void *, 44 int); 45 int (*hidev_set_report)(struct device *, int, int, void *, 46 int); 47 48 int sc_rep_input; 49 int sc_rep_input_size; 50 int sc_rep_config; 51 int sc_rep_cap; 52 53 SIMPLEQ_HEAD(, hidmt_data) sc_inputs; 54 55 struct device *sc_wsmousedev; 56 57 int sc_clickpad; 58 int sc_num_contacts; 59 #define HIDMT_MAX_CONTACTS 5 60 int sc_minx, sc_maxx; 61 int sc_miny, sc_maxy; 62 int sc_resx, sc_resy; 63 64 struct hidmt_contact sc_contacts[HIDMT_MAX_CONTACTS]; 65 int sc_cur_contactcount; 66 int sc_buttons; 67 }; 68 69 int hidmt_set_input_mode(struct hidmt *, uint16_t); 70 #define HIDMT_INPUT_MODE_MT_TOUCHSCREEN 0x2 71 #define HIDMT_INPUT_MODE_MT_TOUCHPAD 0x3 72 73 void hidmt_attach(struct hidmt *, const struct wsmouse_accessops *); 74 int hidmt_detach(struct hidmt *, int); 75 void hidmt_disable(struct hidmt *); 76 int hidmt_enable(struct hidmt *); 77 void hidmt_input(struct hidmt *, uint8_t *, u_int); 78 int hidmt_ioctl(struct hidmt *, u_long, caddr_t, int, struct proc *); 79 int hidmt_setup(struct device *, struct hidmt *, void *, int); 80