summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorlaforge <laforge@e0336214-984f-0b4b-a45f-81c69e1f0ede>2006-08-16 00:19:20 +0000
committerlaforge <laforge@e0336214-984f-0b4b-a45f-81c69e1f0ede>2006-08-16 00:19:20 +0000
commit2b672c96e21b3f71bbc8c577f6536369adb30045 (patch)
treed7a6ef0910a5adae3c8133df0d770c4b0b1f933b
parent9a9ffcf0c1d9af9f4ce7298827927f3fa4c06b2e (diff)
- more verbose/precise debug messages
- don't close usb before closing reader handle git-svn-id: https://svn.gnumonks.org/trunk/librfid@1861 e0336214-984f-0b4b-a45f-81c69e1f0ede
-rw-r--r--src/rfid_reader_openpcd.c23
1 files changed, 10 insertions, 13 deletions
diff --git a/src/rfid_reader_openpcd.c b/src/rfid_reader_openpcd.c
index 500428d..11e0f3c 100644
--- a/src/rfid_reader_openpcd.c
+++ b/src/rfid_reader_openpcd.c
@@ -110,13 +110,7 @@ static int openpcd_reg_write(struct rfid_asic_transport_handle *rath,
ret = openpcd_send_command(OPENPCD_CMD_WRITE_REG, reg, value, 0, NULL);
if (ret < 0)
- DEBUGPC("ERROR\n");
- else
- DEBUGPC("OK\n");
-
- ret = openpcd_recv_reply();
- if (ret < 0)
- DEBUGPC("ERROR\n");
+ DEBUGPC("ERROR sending command\n");
else
DEBUGPC("OK\n");
@@ -133,13 +127,13 @@ static int openpcd_reg_read(struct rfid_asic_transport_handle *rath,
ret = openpcd_send_command(OPENPCD_CMD_READ_REG, reg, 0, 0, NULL);
if (ret < 0) {
- DEBUGPC("ERROR\n");
+ DEBUGPC("ERROR sending command\n");
return ret;
}
ret = openpcd_recv_reply();
if (ret < 0) {
- DEBUGPC("ERROR\n");
+ DEBUGPC("ERROR receiving reply\n");
return ret;
}
@@ -159,17 +153,19 @@ static int openpcd_fifo_read(struct rfid_asic_transport_handle *rath,
ret = openpcd_send_command(OPENPCD_CMD_READ_FIFO, 0x00, num_bytes, 0, NULL);
if (ret < 0) {
- DEBUGPC("ERROR\n");
+ DEBUGPC("ERROR sending command\n");
return ret;
}
ret = openpcd_recv_reply();
if (ret < 0) {
- DEBUGPC("ERROR\n");
+ DEBUGPC("ERROR receiving reply\n");
return ret;
}
memcpy(buf, rcv_hdr->data, rcv_hdr->len);
+ DEBUGPC("len=%u val=%s: OK\n", rcv_hdr->len,
+ rfid_hexdump(rcv_hdr->data, rcv_hdr->len));
return ret;
}
@@ -181,6 +177,7 @@ static int openpcd_fifo_write(struct rfid_asic_transport_handle *rath,
{
int ret;
+ DEBUGP("len=%u, data=%s\n", len, rfid_hexdump(bytes, len));
ret = openpcd_send_command(OPENPCD_CMD_WRITE_FIFO, 0, 0, len, bytes);
return ret;
@@ -352,11 +349,11 @@ openpcd_close(struct rfid_reader_handle *rh)
{
struct rfid_asic_transport_handle *rath = rh->ah->rath;
- usb_close(hdl);
-
rc632_close(rh->ah);
free(rath);
free(rh);
+
+ usb_close(hdl);
}
struct rfid_reader rfid_reader_openpcd = {
personal git repositories of Harald Welte. Your mileage may vary