1 /* $OpenBSD: hidmsvar.h,v 1.1 2016/01/08 15:54:13 jcs 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 36 struct tsscale { 37 int minx, maxx; 38 int miny, maxy; 39 int swapxy; 40 int resx, resy; 41 }; 42 43 struct hidms { 44 int sc_enabled; 45 int sc_flags; /* device configuration */ 46 #define HIDMS_SPUR_BUT_UP 0x001 /* spurious button up events */ 47 #define HIDMS_Z 0x002 /* Z direction available */ 48 #define HIDMS_REVZ 0x004 /* Z-axis is reversed */ 49 #define HIDMS_W 0x008 /* W direction available */ 50 #define HIDMS_REVW 0x010 /* W-axis is reversed */ 51 #define HIDMS_LEADINGBYTE 0x020 /* Unknown leading byte */ 52 #define HIDMS_ABSX 0x040 /* X-axis is absolute */ 53 #define HIDMS_ABSY 0x080 /* Y-axis is absolute */ 54 #define HIDMS_TIP 0x100 /* Tip switch on a digitiser pen */ 55 #define HIDMS_BARREL 0x200 /* Barrel switch on a digitiser pen */ 56 #define HIDMS_ERASER 0x400 /* Eraser switch on a digitiser pen */ 57 #define HIDMS_MS_BAD_CLASS 0x800 /* Mouse doesn't identify properly */ 58 59 int sc_num_buttons; 60 u_int32_t sc_buttons; /* mouse button status */ 61 62 struct device *sc_device; 63 struct device *sc_wsmousedev; 64 65 /* locators */ 66 struct hid_location sc_loc_x; 67 struct hid_location sc_loc_y; 68 struct hid_location sc_loc_z; 69 struct hid_location sc_loc_w; 70 struct hid_location sc_loc_btn[MAX_BUTTONS]; 71 72 struct tsscale sc_tsscale; 73 int sc_rawmode; 74 }; 75 76 void hidms_attach(struct hidms *, const struct wsmouse_accessops *); 77 int hidms_detach(struct hidms *, int); 78 void hidms_disable(struct hidms *); 79 int hidms_enable(struct hidms *); 80 void hidms_input(struct hidms *, uint8_t *, u_int); 81 int hidms_ioctl(struct hidms *, u_long, caddr_t, int, struct proc *); 82 int hidms_setup(struct device *, struct hidms *, uint32_t, int, void *, 83 int); 84