2 * (C) 2006 by Frank Zirkelbach <hackbard@hackdaworld.org>
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2
6 * as published by the Free Software Foundation
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
13 * You should have received a copy of the GNU General Public License
14 * along with this program; if not, write to the Free Software
15 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 #define USB_VENDOR_GEMTAG 0x1394
22 #define USB_DEVICE_X501 0x0501
24 struct gemtag_handle {
25 struct usb_dev_handle *handle;
28 unsigned char serial[4];
31 #define GEMTAG_CAP_CRC 0x01
32 #define GEMTAG_CAP_VERB_TRANSMIT 0x02
34 struct gemtag_cmd_hdr {
39 } __attribute__ ((packed));
42 #define SEQ_MISMATCH 0x02
43 #define SHORT_ANSWER 0x03
44 #define CMD_FAILED 0x04
45 #define AUTH_FAILED 0x05
46 #define READ_FAILED 0x06
48 #define PICC_SELECT_ERROR 0x08
52 #define GEMTAG_CMD_PCD_CONFIG 0x10
53 #define GEMTAG_CMD_PICC_ANTICOLL 0x12
54 #define GEMTAG_CMD_PICC_SELECT 0x13
56 #define GEMTAG_CMD_PICC_AUTH 0x14
57 #define GEMTAG_CMD_PICC_AUTH_E2 0x15
58 #define GEMTAG_CMD_HOST_CODE_KEY 0x16
59 #define GEMTAG_CMD_PCD_LOAD_KEY_E2 0x17
60 #define GEMTAG_CMD_PICC_AUTH_KEY 0x18
61 #define GEMTAG_PICC_AUTHENT1A
62 #define GEMTAG_PICC_AUTHENT1B
64 #define GEMTAG_CMD_PICC_READ 0x19
65 #define GEMTAG_CMD_PICC_WRITE 0x1a
66 #define GEMTAG_CMD_PICC_VALUE 0x1b
67 #define GEMTAG_CMD_PICC_VALUE_DEBIT 0x1c
68 #define GEMTAG_CMD_PICC_HALT 0x1d
69 #define GEMTAG_CMD_PICC_WRITE4 0x1e
70 #define GEMTAG_CMD_COMMON_WRITE 0x1f
71 #define GEMTAG_CMD_PCD_RF_RESET 0x20
72 #define GEMTAG_CMD_GET_SERIAL_NUMBER 0x22
73 #define GEMTAG_CMD_PCD_READ_E2 0x23
74 #define GEMTAG_CMD_PCD_WRITE_E2 0x24
75 #define GEMTAG_CMD_PICC_COMMON_READ 0x28
76 #define GEMTAG_PICC_DECREMENT
77 #define GEMTAG_PICC_INCREMENT
78 #define GEMTAG_PICC_READ16
79 #define GEMTAG_PICC_RESTORE
80 #define GEMTAG_PICC_WRITE16
81 #define GEMTAG_PICC_WRITE4
83 #define GEMTAG_CMD_PICC_REQUEST 0x40
84 #define GEMTAG_PICC_REQIDL 0x26
85 #define GEMTAG_CMD_PCD_SET_TMO 0x27
87 #define GEMTAG_CMD_PICC_CASC_ANTICOLL 0x41
88 #define GEMTAG_CMD_PICC_CASC_SELECT 0x42
89 #define GEMTAG_PICC_STD_SELECT_CODE 0x93
90 #define GEMTAG_PICC_CASC_LEVEL1 0x95
91 #define GEMTAG_PICC_CASC_LEVEL2 0x97
93 #define GEMTAG_CMD_PICC_ACTIVATE_IDLE 0x43
94 #define GEMTAG_CMD_PICC_ACTIVATE_WAKEUP 0x44
95 #define GEMTAG_CMD_SET_DFLT_ATTRIBUTES 0x45
96 #define GEMTAG_CMD_SET_ATTRIBUTES 0x46
97 #define GEMTAG_CMD_PICC_EXCHANGE_BLOCK 0x48
98 #define GEMTAG_PICC_REQALL 0x52
100 #define GEMTAG_CMD_SWITCH_LED 0x60
101 #define GEMTAG_LED_OFF 0x00
102 #define GEMTAG_LED_ON 0x01
104 #define GEMTAG_CMD_GET_FW_VERSION 0x63
105 #define GEMTAG_CMD_GET_RIC_VERSION 0x64
106 #define GEMTAG_CMD_SET_DEFAULT_BAUDRATE 0x81
107 #define GEMTAG_CMD_SET_ONLINE_BAUDRATE 0x82
108 #define GEMTAG_CMD_SET_CPU_TIMEOUT 0x88
110 #define GEMTAG_CMD_DETECT_CARD 0x92
111 #define GEMTAG_CMD_DETECT_ISO15693_CARD 0x93
112 #define GEMTAG_CMD_PPS_REQUEST 0xa0
113 #define GEMTAG_CMD_DESELECT 0xa1