📄 xf86dmc.h
字号:
/* * Copyright (c) 2004 DMC Co., Ltd. * * Copyright (c) 1999 Machine Vision Holdings Incorporated * Author: Mayk Langer <langer@vsys.de> * * Template driver used: Copyright (c) 1998 Metro Link Incorporated * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. * * Except as contained in this notice, the name of the Metro Link shall not be * used in advertising or otherwise to promote the sale, use or other dealings * in this Software without prior written authorization from Metro Link. * *//* $XFree86: xc/programs/Xserver/hw/xfree86/input/dmc/xf86DMC.h,v 1.1 2001/08/17 13:27:55 dawes Exp $ */#ifndef _DMC_H_#define _DMC_H_/****************************************************************************** * Definitions * structs, typedefs, #defines, enums *****************************************************************************/#define DMC_PACKET_SIZE 5typedef enum{ DMC_byte0, DMC_byte1, DMC_byte2, DMC_byte3, DMC_byte4, DMC_Response0,DMC_Response1}DMCState;typedef struct uPoint{ int x,y;} uPoint;typedef struct uRect{ uPoint lefttop; uPoint leftbottom; uPoint righttop; uPoint rightbottom;} uRect;#include <linux/types.h>//typedef int64_t NTIME;typedef __s64 NTIME;typedef struct _DMCPrivateRec{ int usb_dev; int fd; int min_x; /* Minimum x reported by calibration */ int max_x; /* Maximum x */ int min_y; /* Minimum y reported by calibration */ int max_y; /* Maximum y */ Bool button_down; /* is the "button" currently down */ int button_number; /* which button to report */ int reporting_mode; /* TS_Raw or TS_Scaled */ NTIME reporting_time; int screen_num; /* Screen associated with the device */ int screen_width; /* Width of the associated X screen */ int screen_height; /* Height of the screen */ int proximity; int swap_xy; int tp_state;#define B_BELL_DOWN 1#define B_BELL_UP 2#define B_SELECT_LEFT 0x10#define B_SELECT_MID 0x20#define B_SELECT_RIGHT 0x40#define MASK_SELECT 0x70 int samp_rate;#define START_S_RATE 0#define END_S_RATE 5 XISBuffer *buffer; unsigned char packet[DMC_PACKET_SIZE]; /* packet being/just read */ DMCState lex_mode; char pen_down; /* ...................calibration data */ int eeprom_read_ok; int calib_raw_x; int calib_raw_y; int calib_point;#define MAX_CALIB_POINT 9#define MAX_DATA 4 int do_calib; unsigned int calib_raw_data[16][2]; unsigned int calib_data[16][MAX_DATA]; uRect calib_run_raw_r[4]; uRect calib_run_adj_r[4]; /* ...................calibration temopary data */ int calib_temp_point; int calib_temp_nibble; unsigned int calib_temp_data[16][MAX_DATA]; uRect calib_temp_run_raw_r[4]; uRect calib_temp_run_adj_r[4]; /**/ long test; char *save_file;}DMCPrivateRec, *DMCPrivatePtr;typedef struct Pkt_Calib { unsigned short rawx,rawy; unsigned short refx,refy;} Pkt_Calib;typedef struct Pkt_W_EEPROM { unsigned char x; unsigned char y; Pkt_Calib x00; // +---------------+ Pkt_Calib x01; // | x00 x01 x02 | Pkt_Calib x02; // | x10 x11 x12 | Pkt_Calib x10; // | x20 x21 x22 | Pkt_Calib x11; // +---------------+ Pkt_Calib x12; Pkt_Calib x20; Pkt_Calib x21; Pkt_Calib x22; unsigned short max_x; unsigned short max_y;} Pkt_W_EEPROM; typedef struct Pkt_R_EEPROM { unsigned char x; unsigned char y; Pkt_Calib x00; // +---------------+---------+ Pkt_Calib x01; // | x00 x01 x02 | x03 x04 | Pkt_Calib x02; // | x10 x11 x12 | x13 x14 | Pkt_Calib x03; // | x20 x21 x22 | x23 x24 | Pkt_Calib x04; // +---------------+---------+ Pkt_Calib x10; // | x30 x31 x32 | x33 x34 | Pkt_Calib x11; // | x40 x41 x42 | x43 x44 | Pkt_Calib x12; // +---------------+---------+ Pkt_Calib x13; Pkt_Calib x14; Pkt_Calib x20; Pkt_Calib x21; Pkt_Calib x22; Pkt_Calib x23; Pkt_Calib x24; Pkt_Calib x30; Pkt_Calib x31; Pkt_Calib x32; Pkt_Calib x33; Pkt_Calib x34; Pkt_Calib x40; Pkt_Calib x41; Pkt_Calib x42; Pkt_Calib x43; Pkt_Calib x44; unsigned short max_x; unsigned short max_y;} Pkt_R_EEPROM; /****************************************************************************** * Declarations *****************************************************************************//* * tbcalib's calib point mark size */#define ADJ_X 15#define ADJ_Y 15#define W_MARK 20#define H_MARK 20static Bool DeviceControl (DeviceIntPtr, int);static void ReadInput (InputInfoPtr);static int ControlProc (InputInfoPtr, xDeviceCtl *);static void CloseProc (InputInfoPtr);static int SwitchMode (ClientPtr, DeviceIntPtr, int);#define SELCT_CMD_start 0xa0#define SELCT_LEFT_CMD (SELCT_CMD_start+0)#define SELCT_MID_CMD (SELCT_CMD_start+1)#define SELCT_RIGHT_CMD (SELCT_CMD_start+2)#define GET_SELCT_LEFT_CMD (SELCT_CMD_start+3)#define GET_SELCT_MID_CMD (SELCT_CMD_start+4)#define GET_SELCT_RIGHT_CMD (SELCT_CMD_start+5)#define SELCT_CMD_end (SELCT_CMD_start+5)#define S_RATE_CMD 0xB0 /* S_RATE_CMD+n : n=d2-d0 bit=rate */#define S_RATE_MASK 0x07#define BEEP_ON_UP_CMD 0xB8#define BEEP_OFF_UP_CMD 0xB9#define BEEP_ON_DOWN_CMD 0xBA#define BEEP_OFF_DOWN_CMD 0xBB#define RESET_CMD 0xBC// c0-c8 ,d0-df,cd,ce,cf#define CALIB_CMD_RANGE_S 0xc0#define CALIB_CMD_RANGE_E 0xdf#define CALIB_MASK 0x0f#define CALIB_ADJ_DAT_CMD 0xc0 /* CALIB_ADJ_DAT_CMD+n : n=d3-d0 bit=calib point */#define CALIB_1_DAT 0xd0 /* CALIB_1_DAT+n : n=d3-d0 bit=calib data(nibble) */#define CALIB_PRE_FIRST_CMD 0xca#define CALIB_FIRST_CMD 0xcb#define CALIB_NEXT_CMD 0xcc#define CALIB_END_CMD 0xcd#define CALIB_OK_CMD 0xce#define CALIB_CANCEL_CMD 0xcfstatic Bool ConvertProc (InputInfoPtr, int, int, int, int, int, int, int, int, int *, int *);static Bool QueryHardware (DMCPrivatePtr);static Bool DMCGetPacket (DMCPrivatePtr priv);static Bool DMCSendPacket (DMCPrivatePtr priv, unsigned char *buf, int len );static InputInfoPtr DMCPreInit(InputDriverPtr drv, IDevPtr dev, int flags);static void DMCPtrCtrl(DeviceIntPtr device, PtrCtrl *ctrl);#endif /* _DMC_H_ */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -