xref: /openbsd/sys/dev/hid/hidmtvar.h (revision 08b9c650)
1*08b9c650Sjcs /* $OpenBSD: hidmtvar.h,v 1.3 2017/10/10 20:27:12 jcs 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 
18*08b9c650Sjcs struct hidmt_data {
1928b578b5Sjcs 	int32_t			usage;
2028b578b5Sjcs 	struct hid_location	loc;
21*08b9c650Sjcs 	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;
4228b578b5Sjcs 	int		(*hidev_get_report)(struct device *, int, int, void *,
4328b578b5Sjcs 			    int);
4428b578b5Sjcs 	int		(*hidev_set_report)(struct device *, int, int, void *,
4528b578b5Sjcs 			    int);
4628b578b5Sjcs 
4728b578b5Sjcs 	int		sc_rep_input;
4828b578b5Sjcs 	int		sc_rep_input_size;
4928b578b5Sjcs 	int		sc_rep_config;
5028b578b5Sjcs 	int		sc_rep_cap;
5128b578b5Sjcs 
52*08b9c650Sjcs 	SIMPLEQ_HEAD(, hidmt_data) sc_inputs;
5328b578b5Sjcs 
5428b578b5Sjcs 	struct device	*sc_wsmousedev;
5528b578b5Sjcs 
5628b578b5Sjcs 	int		sc_clickpad;
5728b578b5Sjcs 	int		sc_num_contacts;
5828b578b5Sjcs #define HIDMT_MAX_CONTACTS	5
5928b578b5Sjcs 	int		sc_minx, sc_maxx;
6028b578b5Sjcs 	int		sc_miny, sc_maxy;
61b965eceaSbru 	int		sc_resx, sc_resy;
6228b578b5Sjcs 
6328b578b5Sjcs 	struct hidmt_contact sc_contacts[HIDMT_MAX_CONTACTS];
6428b578b5Sjcs 	int		sc_button;
6528b578b5Sjcs };
6628b578b5Sjcs 
6728b578b5Sjcs int	hidmt_set_input_mode(struct hidmt *, int);
6828b578b5Sjcs #define HIDMT_INPUT_MODE_MT	0x3
6928b578b5Sjcs 
7028b578b5Sjcs void	hidmt_attach(struct hidmt *, const struct wsmouse_accessops *);
7128b578b5Sjcs int	hidmt_detach(struct hidmt *, int);
7228b578b5Sjcs void	hidmt_disable(struct hidmt *);
7328b578b5Sjcs int	hidmt_enable(struct hidmt *);
7428b578b5Sjcs void	hidmt_input(struct hidmt *, uint8_t *, u_int);
7528b578b5Sjcs int	hidmt_ioctl(struct hidmt *, u_long, caddr_t, int, struct proc *);
7628b578b5Sjcs int	hidmt_setup(struct device *, struct hidmt *, void *, int);
77