usbwcm.h revision 692d834dec3070f47507bc0f44d3d92620b49cfa
/*
* Copyright 2010 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
/*
* Copyright (c) 2007, 2008 Bartosz Fabianowski <freebsd@chillt.de>
* All rights reserved.
*
* Financed by the "Irish Research Council for Science, Engineering and
* Technology: funded by the National Development Plan"
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions, and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
/*
* Copyright (c) 1998 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
* by Lennart Augustsson (lennart@augustsson.net) at
* Carlstedt Research & Technology.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the NetBSD
* Foundation, Inc. and its contributors.
* 4. Neither the name of The NetBSD Foundation nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef _SYS_USB_USBWCM_H
#define _SYS_USB_USBWCM_H
#ifdef __cplusplus
extern "C" {
#endif
#else
#endif
struct event_dev_id {
#define ID_BUS_USB 3
};
struct event_abs_axis {
};
struct event_input {
#else
#endif
};
#define EVT_SYN 0x0000
#define EVT_BTN 0x0001
#define EVT_REL 0x0002
#define EVT_ABS 0x0003
#define EVT_MSC 0x0004
#define EVT_USED 0x0005
#define EVT_MAX 0x001f
#define SYN_REPORT 0x0000
#define BTN_MISC_0 0x0100
#define BTN_MISC_1 0x0101
#define BTN_MISC_2 0x0102
#define BTN_MISC_3 0x0103
#define BTN_MISC_4 0x0104
#define BTN_MISC_5 0x0105
#define BTN_MISC_6 0x0106
#define BTN_MISC_7 0x0107
#define BTN_MISC_8 0x0108
#define BTN_LEFT 0x0110
#define BTN_RIGHT 0x0111
#define BTN_MIDDLE 0x0112
#define BTN_SIDE 0x0113
#define BTN_EXTRA 0x0114
#define BTN_TOOL_PEN 0x0140
#define BTN_TOOL_ERASER 0x0141
#define BTN_TOOL_PAD 0x0145
#define BTN_TOOL_MOUSE 0x0146
#define BTN_TIP 0x014a
#define BTN_STYLUS_1 0x014b
#define BTN_STYLUS_2 0x014c
#define BTN_USED 0x014d
#define BTN_MISC_UND 0x01ff
#define BTN_MAX 0x01ff
#define REL_WHEEL 0x0008
#define REL_MAX 0x000f
#define ABS_X 0x0000
#define ABS_Y 0x0001
#define ABS_Z 0x0002
#define ABS_RX 0x0003
#define ABS_RY 0x0004
#define ABS_RZ 0x0005
#define ABS_WHEEL 0x0008
#define ABS_PRESSURE 0x0018
#define ABS_DISTANCE 0x0019
#define ABS_TILT_X 0x001a
#define ABS_TILT_Y 0x001b
#define ABS_MISC 0x0028
#define ABS_USED 0x0029
#define ABS_MAX 0x003f
#define MSC_SERIAL 0x0000
#define MSC_MAX 0x0007
#ifdef _KERNEL
/* USB IDs */
#define USB_VENDOR_WACOM 0x056a
#define USB_PRODUCT_WACOM_GRAPHIRE 0x0010
#define USB_PRODUCT_WACOM_GRAPHIRE2_4X5 0x0011
#define USB_PRODUCT_WACOM_GRAPHIRE2_5X7 0x0012
#define USB_PRODUCT_WACOM_GRAPHIRE3_4X5 0x0013
#define USB_PRODUCT_WACOM_GRAPHIRE3_6X8 0x0014
#define USB_PRODUCT_WACOM_GRAPHIRE4_4X5 0x0015
#define USB_PRODUCT_WACOM_GRAPHIRE4_6X8 0x0016
#define USB_PRODUCT_WACOM_BAMBOO_FUN_4X5 0x0017
#define USB_PRODUCT_WACOM_BAMBOO_FUN_6X8 0x0018
#define USB_PRODUCT_WACOM_BAMBOO_ONE_6X8 0x0019
#define USB_PRODUCT_WACOM_CINTIQ_21UX 0x003f
#define USB_PRODUCT_WACOM_VOLITO 0x0060
#define USB_PRODUCT_WACOM_PENSTATION2 0x0061
#define USB_PRODUCT_WACOM_VOLITO2_4X5 0x0062
#define USB_PRODUCT_WACOM_VOLITO2_2X3 0x0063
#define USB_PRODUCT_WACOM_PENPARTNER2 0x0064
#define USB_PRODUCT_WACOM_BAMBOO 0x0065
#define USB_PRODUCT_WACOM_BAMBOO_ONE_4X5 0x0069
#define USB_PRODUCT_WACOM_INTUOS3_4X5 0x00b0
#define USB_PRODUCT_WACOM_INTUOS3_6X8 0x00b1
#define USB_PRODUCT_WACOM_INTUOS3_9X12 0x00b2
#define USB_PRODUCT_WACOM_INTUOS3_12X12 0x00b3
#define USB_PRODUCT_WACOM_INTUOS3_12X19 0x00b4
#define USB_PRODUCT_WACOM_INTUOS3_6X11 0x00b5
#define USB_PRODUCT_WACOM_INTUOS3_4X6 0x00b7
#define USB_PRODUCT_WACOM_INTUOS4_4X6 0x00b8
#define USB_PRODUCT_WACOM_INTUOS4_6X9 0x00b9
#define USB_PRODUCT_WACOM_INTUOS4_8X13 0x00ba
#define USB_PRODUCT_WACOM_INTUOS4_12X19 0x00bb
#define TOOL_ID_PEN 0x0002
#define TOOL_ID_MOUSE 0x0006
#define TOOL_ID_ERASER 0x000a
#define TOOL_ID_PAD 0x000f
#define SERIAL_PAD_INTUOS 0xffffffff
#define SERIAL_PAD_GRAPHIRE4 0x000000f0
#define EUWACOMGETVERSION 0x01
#define EUWACOMGETID 0x02
#define EUWACOMGETBM 0x20
#define EUWACOMGETABS 0x40
/* Protocols */
struct uwacom_protocol_type {
int packet_size;
int distance_max;
};
enum uwacom_protocol {
/* Graphire family */
GRAPHIRE = 0,
/* Intuos family */
};
struct uwacom_id {
};
/* Models */
struct uwacom_type {
enum uwacom_protocol protocol;
int x_max;
int y_max;
int pressure_max;
};
static const struct uwacom_protocol_type uwacom_protocols[] = {
{ 8, 63},
{ 8, 63},
{ 9, 63},
{10, 63},
{10, 63},
{10, 63},
{10, 63},
{10, 63}
};
struct uwacom_softc {
const struct uwacom_type *sc_type;
struct event_dev_id sc_id;
int *sc_btn;
struct event_abs_axis *sc_abs;
int sc_tool[2];
int sc_tool_id[2];
unsigned int sc_serial[2];
int sc_sync;
};
typedef struct usbwcm_state {
/* software state */
struct uwacom_softc usbwcm_softc;
/* device model data */
/*
* Is an ioctl fails because an mblk wasn't
* available, the mlbk is saved here.
*/
#define abs(x) ((x) < 0 ? -(x) : (x))
typedef struct usbwcm_copyin_s {
int state;
#define USBWCM_GETSTRUCT 1
#define USBWCM_GETRESULT 2
static const struct uwacom_type uwacom_devs[] = {
{
},
{
},
{
},
{
},
{
},
{
},
{
},
{
},
{
},
{
},
{
},
{
},
{
},
{
},
{
},
{
},
{
},
{
},
{
},
{
},
{
},
{
},
{
},
{
},
{
},
{
},
{
},
{
},
{
},
{{0, 0}, 0, 0, 0, 0}
};
#define PACKET_BITS(b, s, n) \
((packet[(b)]) >> (s))) & \
((n) == 32 ? 0xffffffff : (1 << (n)) - 1))
#define BM_SIZE(x) \
(((x) / (sizeof (long) * 8) + 1) * sizeof (long))
#define BM_SET_BIT(x, y) \
((x)[(y) / (sizeof (long) * 8)] |= (1ul << ((y) % (sizeof (long) * 8))))
};
#define PRINT_MASK_ALL 0xFFFFFFFF
#endif /* _KERNEL */
#ifdef __cplusplus
}
#endif
#endif /* _SYS_USB_USBWCM_H */