xref: /openbsd/sys/dev/hid/hidmtvar.h (revision 43056ea1)
1*43056ea1Syasuoka /* $OpenBSD: hidmtvar.h,v 1.8 2019/11/08 01:20:22 yasuoka Exp $ */
228b578b5Sjcs /*
328b578b5Sjcs  * Copyright (c) 2016 joshua stein <jcs@openbsd.org>
428b578b5Sjcs  *
528b578b5Sjcs  * Permission to use, copy, modify, and distribute this software for any
628b578b5Sjcs  * purpose with or without fee is hereby granted, provided that the above
728b578b5Sjcs  * copyright notice and this permission notice appear in all copies.
828b578b5Sjcs  *
928b578b5Sjcs  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
1028b578b5Sjcs  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
1128b578b5Sjcs  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
1228b578b5Sjcs  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
1328b578b5Sjcs  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
1428b578b5Sjcs  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
1528b578b5Sjcs  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
1628b578b5Sjcs  */
1728b578b5Sjcs 
1808b9c650Sjcs struct hidmt_data {
1928b578b5Sjcs 	int32_t			usage;
2028b578b5Sjcs 	struct hid_location	loc;
2108b9c650Sjcs 	SIMPLEQ_ENTRY(hidmt_data) entry;
2228b578b5Sjcs };
2328b578b5Sjcs 
2428b578b5Sjcs struct hidmt_contact {
2528b578b5Sjcs 	int		x;
2628b578b5Sjcs 	int		y;
2728b578b5Sjcs 	int		width;
2828b578b5Sjcs 	int		height;
2928b578b5Sjcs 	int		tip;
3028b578b5Sjcs 	int		confidence;
3128b578b5Sjcs 	int		contactid;
3228b578b5Sjcs 
3328b578b5Sjcs 	int		seen;
3428b578b5Sjcs };
3528b578b5Sjcs 
3628b578b5Sjcs struct hidmt {
3728b578b5Sjcs 	int		sc_enabled;
3828b578b5Sjcs 	uint32_t	sc_flags;
3928b578b5Sjcs #define HIDMT_REVY	0x0001	/* Y-axis is reversed ("natural" scrolling) */
4028b578b5Sjcs 
4128b578b5Sjcs 	struct device	*sc_device;
42253b28d0Sjcs 	int		(*hidev_report_type_conv)(int);
4328b578b5Sjcs 	int		(*hidev_get_report)(struct device *, int, int, void *,
4428b578b5Sjcs 			    int);
4528b578b5Sjcs 	int		(*hidev_set_report)(struct device *, int, int, void *,
4628b578b5Sjcs 			    int);
4728b578b5Sjcs 
4828b578b5Sjcs 	int		sc_rep_input;
4928b578b5Sjcs 	int		sc_rep_input_size;
5028b578b5Sjcs 	int		sc_rep_config;
5128b578b5Sjcs 	int		sc_rep_cap;
5228b578b5Sjcs 
5308b9c650Sjcs 	SIMPLEQ_HEAD(, hidmt_data) sc_inputs;
5428b578b5Sjcs 
5528b578b5Sjcs 	struct device	*sc_wsmousedev;
5628b578b5Sjcs 
5728b578b5Sjcs 	int		sc_clickpad;
5828b578b5Sjcs 	int		sc_num_contacts;
5928b578b5Sjcs #define HIDMT_MAX_CONTACTS	5
6028b578b5Sjcs 	int		sc_minx, sc_maxx;
6128b578b5Sjcs 	int		sc_miny, sc_maxy;
62b965eceaSbru 	int		sc_resx, sc_resy;
6328b578b5Sjcs 
6428b578b5Sjcs 	struct hidmt_contact sc_contacts[HIDMT_MAX_CONTACTS];
65b072a09dSjcs 	int		sc_cur_contactcount;
66*43056ea1Syasuoka 	int		sc_buttons;
6728b578b5Sjcs };
6828b578b5Sjcs 
69d7bb4ae7Sjcs int	hidmt_set_input_mode(struct hidmt *, uint16_t);
70737d705bSjcs #define HIDMT_INPUT_MODE_MT_TOUCHSCREEN	0x2
71737d705bSjcs #define HIDMT_INPUT_MODE_MT_TOUCHPAD	0x3
7228b578b5Sjcs 
7328b578b5Sjcs void	hidmt_attach(struct hidmt *, const struct wsmouse_accessops *);
7428b578b5Sjcs int	hidmt_detach(struct hidmt *, int);
7528b578b5Sjcs void	hidmt_disable(struct hidmt *);
7628b578b5Sjcs int	hidmt_enable(struct hidmt *);
7728b578b5Sjcs void	hidmt_input(struct hidmt *, uint8_t *, u_int);
7828b578b5Sjcs int	hidmt_ioctl(struct hidmt *, u_long, caddr_t, int, struct proc *);
7928b578b5Sjcs int	hidmt_setup(struct device *, struct hidmt *, void *, int);
80