summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--pegoda/Makefile4
-rw-r--r--pegoda/pegoda.c81
-rw-r--r--pegoda/pegoda.h141
3 files changed, 164 insertions, 62 deletions
diff --git a/pegoda/Makefile b/pegoda/Makefile
index bd4a205..7310022 100644
--- a/pegoda/Makefile
+++ b/pegoda/Makefile
@@ -1,4 +1,8 @@
+all: pegoda
pegoda: pegoda.o
$(CC) -lusb -o $@ $^
+
+clean:
+ rm -f pegoda *.o
diff --git a/pegoda/pegoda.c b/pegoda/pegoda.c
index b044a15..ab41136 100644
--- a/pegoda/pegoda.c
+++ b/pegoda/pegoda.c
@@ -1,3 +1,21 @@
+/*
+ * (C) 2005 by Harald Welte <laforge@gnumonks.org>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2
+ * as published by the Free Software Foundation
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+
#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
@@ -5,68 +23,7 @@
#include <errno.h>
#include <usb.h>
-
-#define USB_VENDOR_PHILIPS 0x0742
-#define USB_DEVICE_PEGODA 0xff01
-
-/* header of a pegoda usb command packet */
-struct pegoda_cmd_hdr {
- u_int8_t seq;
- u_int8_t cmd;
- u_int16_t len;
-};
-
-enum {
- PEGODA_CMD_WRITE_RC = 0x01,
- PEGODA_CMD_READ_RC = 0x02,
- PEGODA_CMD_EXCHANGE_BYTESTREAM = 0x03,
- PEGODA_CMD_WRITE_MULTIPLE = 0x04,
- PEGODA_CMD_READ_MULTIPLE = 0x05,
-
- PEGODA_CMD_PCD_CONFIG = 0x10,
- PEGODA_CMD_PICC_REQUEST = 0x11,
- PEGODA_CMD_PICC_ANTICOLL = 0x12,
- PEGODA_CMD_PICC_SELECT = 0x13,
- PEGODA_CMD_PICC_AUTH = 0x14,
- PEGODA_CMD_PICC_AUTH_E2 = 0x15,
- PEGODA_CMD_LOAD_KEY_E2 = 0x17,
- PEGODA_CMD_PICC_AUTH_KEY = 0x18,
- PEGODA_CMD_PICC_READ = 0x19,
- PEGODA_CMD_PICC_WRITE = 0x1a,
- PEGODA_CMD_PICC_VALUE = 0x1b,
- PEGODA_CMD_PICC_VALUE_DEBIT = 0x1c,
- PEGODA_CMD_PICC_HALT = 0x1d,
- PEGODA_CMD_PICC_WRITE4 = 0x1e,
- PEGODA_CMD_PICC_COMMON_WRITE = 0x1f,
-
- PEGODA_CMD_PCD_RF_RESET = 0x21,
- PEGODA_CMD_PCD_RESET = 0x21,
- PEGODA_CMD_PCD_GET_SNR = 0x22,
- PEGODA_CMD_PCD_READ_E2 = 0x23,
- PEGODA_CMD_PCD_SET_TMO = 0x27,
- PEGODA_CMD_PICC_COMMON_READ = 0x28,
- PEGODA_CMD_ACTIVE_ANTENNA_MASTER = 0x2a,
- PEGODA_CMD_ACTIVE_ANTENNA_SLAVE = 0x2b,
-
- PEGODA_CMD_PICC_COMMON_REQUEST = 0x40,
- PEGODA_CMD_PICC_CASC_ANTICOLL = 0x41,
- PEGODA_CMD_PICC_CASC_SELECT = 0x42,
- PEGODA_CMD_PICC_ACTIVATE_IDLE = 0x43,
- PEGODA_CMD_ACTIVATE_WAKEUP = 0x44,
-
- PEGODA_CMD_PICC_ACTIVATE_WAKEUP = 0x44,
- PEGODA_CMD_PCD_SET_DEFAULT_ATTRIB = 0x45,
- PEGODA_CMD_PCD_SET_ATTRIB = 0x46,
- PEGODA_CMD_PCD_GET_ATTRIB = 0x47,
- PEGODA_CMD_PICC_EXCHANGE_BLOCK = 0x48,
- PEGODA_CMD_PICC_ACTIVATE_IDLE_LOOP = 0x49,
- PEGODA_CMD_PICC_ACTTIVATION = 0x4a,
-
-
- PEGODA_CMD_GET_FW_VERSION = 0x63,
- PEGODA_CMD_GET_RIC_VERSION = 0x64,
- PEGODA_CMD_ENABLE_DEBUG_PINS = 0x65,
-};
+#include "pegoda.h"
const char *
rfid_hexdump(const void *data, unsigned int len)
diff --git a/pegoda/pegoda.h b/pegoda/pegoda.h
new file mode 100644
index 0000000..b957899
--- /dev/null
+++ b/pegoda/pegoda.h
@@ -0,0 +1,141 @@
+#ifndef _PEGODA_H
+#define _PEGODA_H
+/*
+ * (C) 2005 by Harald Welte <laforge@gnumonks.org>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2
+ * as published by the Free Software Foundation
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#define USB_VENDOR_PHILIPS 0x0742
+#define USB_DEVICE_PEGODA 0xff01
+
+/* header of a pegoda usb command packet */
+struct pegoda_cmd_hdr {
+ u_int8_t seq;
+ u_int8_t cmd;
+ u_int16_t len;
+};
+
+enum {
+ PEGODA_CMD_WRITE_RC = 0x01,
+ PEGODA_CMD_READ_RC = 0x02,
+ PEGODA_CMD_EXCHANGE_BYTESTREAM = 0x03,
+ PEGODA_CMD_WRITE_MULTIPLE = 0x04,
+ PEGODA_CMD_READ_MULTIPLE = 0x05,
+ PEGODA_CMD_READ_WORD = 0x06,
+
+
+ PEGODA_CMD_PCD_CONFIG = 0x10,
+ PEGODA_CMD_PICC_REQUEST = 0x11,
+ PEGODA_CMD_PICC_ANTICOLL = 0x12,
+ PEGODA_CMD_PICC_SELECT = 0x13,
+ PEGODA_CMD_PICC_AUTH = 0x14,
+ PEGODA_CMD_PICC_AUTH_E2 = 0x15,
+ PEGODA_CMD_LOAD_KEY_E2 = 0x17,
+ PEGODA_CMD_PICC_AUTH_KEY = 0x18,
+ PEGODA_CMD_PICC_READ = 0x19,
+ PEGODA_CMD_PICC_WRITE = 0x1a,
+ PEGODA_CMD_PICC_VALUE = 0x1b,
+ PEGODA_CMD_PICC_VALUE_DEBIT = 0x1c,
+ PEGODA_CMD_PICC_HALT = 0x1d,
+ PEGODA_CMD_PICC_WRITE4 = 0x1e,
+ PEGODA_CMD_PICC_COMMON_WRITE = 0x1f,
+
+ PEGODA_CMD_PCD_RF_RESET = 0x20,
+ PEGODA_CMD_PCD_RESET = 0x21,
+ PEGODA_CMD_PCD_GET_SNR = 0x22,
+ PEGODA_CMD_PCD_READ_E2 = 0x23,
+ PEGODA_CMD_PCD_SET_TMO = 0x27,
+ PEGODA_CMD_PICC_COMMON_READ = 0x28,
+ PEGODA_CMD_PCD_INITIALIZE_E2 = 0x29,
+ PEGODA_CMD_ACTIVE_ANTENNA_MASTER = 0x2a,
+ PEGODA_CMD_ACTIVE_ANTENNA_SLAVE = 0x2b,
+
+ PEGODA_CMD_HOST_TRANS_TMR_START = 0x30,
+ PEGODA_CMD_HOST_TRANS_TMR_STOP = 0x31,
+ PEGODA_CMD_HOST_GET_EXEC_TIME = 0x32,
+
+ PEGODA_CMD_PICC_COMMON_REQUEST = 0x40,
+ PEGODA_CMD_PICC_CASC_ANTICOLL = 0x41,
+ PEGODA_CMD_PICC_CASC_SELECT = 0x42,
+ PEGODA_CMD_PICC_ACTIVATE_IDLE = 0x43,
+ PEGODA_CMD_PICC_ACTIVATE_WAKEUP = 0x44,
+ PEGODA_CMD_PCD_SET_DEFAULT_ATTRIB = 0x45,
+ PEGODA_CMD_PCD_SET_ATTRIB = 0x46,
+ PEGODA_CMD_PCD_GET_ATTRIB = 0x47,
+ PEGODA_CMD_PICC_EXCHANGE_BLOCK = 0x48,
+ PEGODA_CMD_PICC_ACTIVATE_IDLE_LOOP = 0x49,
+ PEGODA_CMD_PICC_ACTTIVATION = 0x4a,
+ PEGODA_CMD_PCD_ENABLE_HIGH_BAUD_RATES = 0x4b,
+
+
+ PEGODA_CMD_SWITCH_LED = 0x60,
+ PEGODA_CMD_TEST_FLASH_NR = 0x61,
+ PEGODA_CMD_START_DOWNLOAD = 0x62,
+ PEGODA_CMD_GET_FW_VERSION = 0x63,
+ PEGODA_CMD_GET_RIC_VERSION = 0x64,
+ PEGODA_CMD_ENABLE_DEBUG_PINS = 0x65,
+ PEGODA_CMD_MIRROR_DATA = 0x66,
+ PEGODA_CMD_TEST_CMDS = 0x67,
+
+ PEGODA_CMD_TEST_PCD = 0x70,
+ PEGODA_CMD_TEST_PICC = 0x71,
+ PEGODA_CMD_GET_ONLINE_STATUS = 0x72,
+
+ PEGODA_CMD_I1_PCD_CONFIG = 0x80,
+ PEGODA_CMD_I1_INIT_STD_MODE = 0x81,
+ PEGODA_CMD_I1_CALC_TSE_HASH = 0x82,
+ PEGODA_CMD_I1_INIT_FAST_MODE = 0x83,
+ PEGODA_CMD_I1_OUTPUT_READ = 0x85,
+ PEGODA_CMD_I1_OUTPUT_ANTICOL_SELECT = 0x86,
+ PEGODA_CMD_I1_OUTPUT_WRITE = 0x87,
+ PEGODA_CMD_I1_OUTPUT_HALT = 0x88,
+ PEGODA_CMD_I1_OUTPUT_EAS = 0x89,
+ PEGODA_CMD_I1_RESET_QUIET = 0x8a,
+ PEGODA_CMD_I1_PCD_RF_RESET = 0x8b,
+ PEGODA_CMD_I1_SET_BIT_PHASE = 0x8c,
+
+ PEGODA_CMD_I2_INIT_STD_MODE = 0x90,
+ PEGODA_CMD_I2_INIT_FAST_MODE = 0x91,
+ PEGODA_CMD_15693_READ_SM = 0x92,
+ PEGODA_CMD_15693_INVENTORY = 0x93,
+ PEGODA_CMD_15693_WRITE_SM = 0x94,
+ PEGODA_CMD_15693_STAY_QUIET = 0x95,
+ PEGODA_CMD_15693_LOCK_BLOCK = 0x96,
+ PEGODA_CMD_15693_SELECT = 0x97,
+ PEGODA_CMD_15693_RESET_TO_READY = 0x98,
+ PEGODA_CMD_15693_WRITE_AFI = 0x99,
+ PEGODA_CMD_15693_LOCK_AFI = 0x9a,
+ PEGODA_CMD_15693_WRITE_DSFID = 0x9b,
+ PEGODA_CMD_15693_LOCK_DSFID = 0x9c,
+ PEGODA_CMD_15693_GET_SYSTEM_INFO = 0x9d,
+ PEGODA_CMD_15693_GET_MULTI_BLOCK_SEC = 0x9e,
+ PEGODA_CMD_15693_INVENTORY_READ = 0x9f,
+ PEGODA_CMD_15693_FAST_INVENTORY_READ = 0xa0,
+ PEGODA_CMD_15693_SET_EAS = 0xa1,
+ PEGODA_CMD_15693_RESET_EAS = 0xa2,
+ PEGODA_CMD_15693_LOCK_EAS = 0xa3,
+ PEGODA_CMD_15693_EAS_ALARM = 0xa4,
+
+ PEGODA_CMD_PC_PCD_CONFIG = 0xb0,
+ PEGODA_CMD_PC_BEGIN_ROUND = 0xb1,
+ PEGODA_CMD_PC_WRITE = 0xb3,
+
+ PEGODA_CMD_UID_PCD_CONFIG = 0xb8,
+ PEGODA_CMD_UID_BEGIN_ROUND = 0xb9,
+ PEGODA_CMD_UID_WRITE = 0xba,
+ PEGODA_CMD_UID_DESTROY = 0xbb,
+};
+
+#endif
personal git repositories of Harald Welte. Your mileage may vary