hidmsvar.h revision 1.2
1/* $OpenBSD: hidmsvar.h,v 1.2 2021/01/10 16:32:48 thfr Exp $ */ 2/* $NetBSD: ums.c,v 1.60 2003/03/11 16:44:00 augustss Exp $ */ 3 4/* 5 * Copyright (c) 1998 The NetBSD Foundation, Inc. 6 * All rights reserved. 7 * 8 * This code is derived from software contributed to The NetBSD Foundation 9 * by Lennart Augustsson (lennart@augustsson.net) at 10 * Carlstedt Research & Technology. 11 * 12 * Redistribution and use in source and binary forms, with or without 13 * modification, are permitted provided that the following conditions 14 * are met: 15 * 1. Redistributions of source code must retain the above copyright 16 * notice, this list of conditions and the following disclaimer. 17 * 2. Redistributions in binary form must reproduce the above copyright 18 * notice, this list of conditions and the following disclaimer in the 19 * documentation and/or other materials provided with the distribution. 20 * 21 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 22 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 23 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 24 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 25 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 26 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 27 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 28 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 29 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 30 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 31 * POSSIBILITY OF SUCH DAMAGE. 32 */ 33 34#define MAX_BUTTONS 31 /* must not exceed size of sc_buttons */ 35 36struct tsscale { 37 int minx, maxx; 38 int miny, maxy; 39 int swapxy; 40 int resx, resy; 41}; 42 43struct hidms { 44 int sc_enabled; 45 int sc_flags; /* device configuration */ 46#define HIDMS_SPUR_BUT_UP 0x0001 /* spurious button up events */ 47#define HIDMS_Z 0x0002 /* Z direction available */ 48#define HIDMS_REVZ 0x0004 /* Z-axis is reversed */ 49#define HIDMS_W 0x0008 /* W direction available */ 50#define HIDMS_REVW 0x0010 /* W-axis is reversed */ 51#define HIDMS_LEADINGBYTE 0x0020 /* Unknown leading byte */ 52#define HIDMS_ABSX 0x0040 /* X-axis is absolute */ 53#define HIDMS_ABSY 0x0080 /* Y-axis is absolute */ 54#define HIDMS_TIP 0x0100 /* Tip switch on a digitiser pen */ 55#define HIDMS_BARREL 0x0200 /* Barrel switch on a digitiser pen */ 56#define HIDMS_ERASER 0x0400 /* Eraser switch on a digitiser pen */ 57#define HIDMS_MS_BAD_CLASS 0x0800 /* Mouse doesn't identify properly */ 58#define HIDMS_VENDOR_BUTTONS 0x1000 /* extra buttons in vendor page */ 59 60 int sc_num_buttons; 61 u_int32_t sc_buttons; /* mouse button status */ 62 63 struct device *sc_device; 64 struct device *sc_wsmousedev; 65 66 /* locators */ 67 struct hid_location sc_loc_x; 68 struct hid_location sc_loc_y; 69 struct hid_location sc_loc_z; 70 struct hid_location sc_loc_w; 71 struct hid_location sc_loc_btn[MAX_BUTTONS]; 72 73 struct tsscale sc_tsscale; 74 int sc_rawmode; 75}; 76 77void hidms_attach(struct hidms *, const struct wsmouse_accessops *); 78int hidms_detach(struct hidms *, int); 79void hidms_disable(struct hidms *); 80int hidms_enable(struct hidms *); 81void hidms_input(struct hidms *, uint8_t *, u_int); 82int hidms_ioctl(struct hidms *, u_long, caddr_t, int, struct proc *); 83int hidms_setup(struct device *, struct hidms *, uint32_t, int, void *, 84 int); 85