aboutsummaryrefslogtreecommitdiffstats
path: root/recipes/librfid
diff options
context:
space:
mode:
authorDenys Dmytriyenko <denis@denix.org>2009-03-17 14:32:59 -0400
committerDenys Dmytriyenko <denis@denix.org>2009-03-17 14:32:59 -0400
commit709c4d66e0b107ca606941b988bad717c0b45d9b (patch)
tree37ee08b1eb308f3b2b6426d5793545c38396b838 /recipes/librfid
parentfa6cd5a3b993f16c27de4ff82b42684516d433ba (diff)
downloadopenembedded-709c4d66e0b107ca606941b988bad717c0b45d9b.tar.gz
rename packages/ to recipes/ per earlier agreement
See links below for more details: http://thread.gmane.org/gmane.comp.handhelds.openembedded/21326 http://thread.gmane.org/gmane.comp.handhelds.openembedded/21816 Signed-off-by: Denys Dmytriyenko <denis@denix.org> Acked-by: Mike Westerhof <mwester@dls.net> Acked-by: Philip Balister <philip@balister.org> Acked-by: Khem Raj <raj.khem@gmail.com> Acked-by: Marcin Juszkiewicz <hrw@openembedded.org> Acked-by: Koen Kooi <koen@openembedded.org> Acked-by: Frans Meulenbroeks <fransmeulenbroeks@gmail.com>
Diffstat (limited to 'recipes/librfid')
-rw-r--r--recipes/librfid/files/010-rc632-definitions-fix.patch15
-rw-r--r--recipes/librfid/files/011-rc632-define-fixes-followups.patch182
-rw-r--r--recipes/librfid/files/012-rc632-error-reg-ro-2.patch25
-rw-r--r--recipes/librfid/files/013-zero-UID.patch31
-rw-r--r--recipes/librfid/files/015-no_segfault.patch16
-rw-r--r--recipes/librfid/files/librfid.rules1
-rw-r--r--recipes/librfid/files/soos01-set_clear_bits.patch119
-rw-r--r--recipes/librfid/files/soos02-check-errors.patch36
-rw-r--r--recipes/librfid/files/soos03-no_hang-openpcd.patch19
-rw-r--r--recipes/librfid/files/spidev.patch24
-rw-r--r--recipes/librfid/librfid_svn.bb38
11 files changed, 506 insertions, 0 deletions
diff --git a/recipes/librfid/files/010-rc632-definitions-fix.patch b/recipes/librfid/files/010-rc632-definitions-fix.patch
new file mode 100644
index 0000000000..bfb70229b2
--- /dev/null
+++ b/recipes/librfid/files/010-rc632-definitions-fix.patch
@@ -0,0 +1,15 @@
+Index: librfid-svn/src/rc632.h
+===================================================================
+--- librfid-svn.orig/src/rc632.h 2008-01-31 13:27:49.000000000 -0500
++++ librfid-svn/src/rc632.h 2008-02-23 19:18:51.000000000 -0500
+@@ -70,8 +70,8 @@
+ enum rc632_reg_status {
+ RC632_STAT_LOALERT = 0x01,
+ RC632_STAT_HIALERT = 0x02,
+- RC632_STAT_IRQ = 0x04,
+- RC632_STAT_ERR = 0x08,
++ RC632_STAT_ERR = 0x04,
++ RC632_STAT_IRQ = 0x08,
+ #define RC632_STAT_MODEM_MASK 0x70
+ RC632_STAT_MODEM_IDLE = 0x00,
+ RC632_STAT_MODEM_TXSOF = 0x10,
diff --git a/recipes/librfid/files/011-rc632-define-fixes-followups.patch b/recipes/librfid/files/011-rc632-define-fixes-followups.patch
new file mode 100644
index 0000000000..633121d70e
--- /dev/null
+++ b/recipes/librfid/files/011-rc632-define-fixes-followups.patch
@@ -0,0 +1,182 @@
+Index: librfid/include/librfid/rfid_asic_rc632.h
+===================================================================
+--- librfid.orig/include/librfid/rfid_asic_rc632.h 2008-04-21 19:13:06.000000000 +0200
++++ librfid/include/librfid/rfid_asic_rc632.h 2008-12-22 23:56:49.000000000 +0100
+@@ -60,7 +60,7 @@
+ const struct iso15693_anticol_cmd *acf,
+ unsigned int acf_len,
+ struct iso15693_anticol_resp *resp,
+- unsigned int *rx_len, char *bit_of_col);
++ unsigned int *rx_len, unsigned char *bit_of_col);
+ } iso15693;
+ struct {
+ int (*setkey)(struct rfid_asic_handle *h,
+@@ -143,8 +143,8 @@
+ DEBUGPC(", mTXsof"); \
+ DEBUGPC("\n"); } while (0);
+
+-#define DEBUGP_INTERRUPT_FLAG(foo) do {\
+- DEBUGP("interrupt_flag: 0x%0.2x",foo); \
++#define DEBUGP_INTERRUPT_FLAG(txt,foo) do {\
++ DEBUGP("%s: 0x%0.2x",txt,foo); \
+ if (foo & RC632_INT_HIALERT) \
+ DEBUGPC(", HiA"); \
+ if (foo & RC632_INT_LOALERT) \
+Index: librfid/src/rfid_asic_rc632.c
+===================================================================
+--- librfid.orig/src/rfid_asic_rc632.c 2008-04-21 19:13:06.000000000 +0200
++++ librfid/src/rfid_asic_rc632.c 2008-12-22 23:57:21.000000000 +0100
+@@ -240,7 +240,7 @@
+ u_int64_t timeout)
+ {
+ int ret;
+- u_int8_t prescaler, divisor;
++ u_int8_t prescaler, divisor, irq;
+
+ timeout *= TIMER_RELAX_FACTOR;
+
+@@ -255,7 +255,14 @@
+ RC632_TMR_START_TX_END|RC632_TMR_STOP_RX_BEGIN);
+
+ /* clear timer irq bit */
+- ret = rc632_set_bits(handle, RC632_REG_INTERRUPT_RQ, RC632_IRQ_TIMER);
++ /*FIXME: is this right? maybe use write function and set bit 8 to zero and timer_bit to 1 to clear*/
++ //ret = rc632_set_bits(handle, RC632_REG_INTERRUPT_RQ, RC632_IRQ_TIMER);
++ //ret = rc632_reg_write(handle, RC632_REG_INTERRUPT_RQ, RC632_IRQ_TIMER);
++ ret = rc632_clear_irqs(handle, RC632_IRQ_TIMER);
++
++ /* enable timer IRQ */
++ //ret |= rc632_set_bits(handle, RC632_REG_INTERRUPT_EN, RC632_IRQ_TIMER);
++ ret |= rc632_reg_write(handle, RC632_REG_INTERRUPT_EN, RC632_IRQ_SET | RC632_IRQ_TIMER);
+
+ ret |= rc632_reg_write(handle, RC632_REG_TIMER_RELOAD, divisor);
+
+@@ -268,6 +275,18 @@
+ int ret;
+ u_int8_t stat, irq, cmd;
+
++ ret = rc632_reg_read(handle, RC632_REG_INTERRUPT_EN, &irq);
++ if (ret < 0)
++ return ret;
++ DEBUGP_INTERRUPT_FLAG("irq_en",irq);
++
++ ret = rc632_reg_write(handle, RC632_REG_INTERRUPT_EN, RC632_IRQ_SET
++ | RC632_IRQ_TIMER
++ | RC632_IRQ_IDLE
++ | RC632_IRQ_RX );
++ if (ret < 0)
++ return ret;
++
+ while (1) {
+ rc632_reg_read(handle, RC632_REG_PRIMARY_STATUS, &stat);
+ DEBUGP_STATUS_FLAG(stat);
+@@ -278,17 +297,20 @@
+ if (err & (RC632_ERR_FLAG_COL_ERR |
+ RC632_ERR_FLAG_PARITY_ERR |
+ RC632_ERR_FLAG_FRAMING_ERR |
+- RC632_ERR_FLAG_CRC_ERR))
++ /*FIXME: why get we CRC errors in CL2 anticol at iso14443a operation with mifare UL? */
++ /* RC632_ERR_FLAG_CRC_ERR | */
++ 0))
+ return -EIO;
+ }
+ if (stat & RC632_STAT_IRQ) {
+ ret = rc632_reg_read(handle, RC632_REG_INTERRUPT_RQ, &irq);
+ if (ret < 0)
+ return ret;
+- DEBUGP_INTERRUPT_FLAG(irq);
++ DEBUGP_INTERRUPT_FLAG("irq_rq",irq);
+
+ if (irq & RC632_IRQ_TIMER && !(irq & RC632_IRQ_RX)) {
+ DEBUGP("timer expired before RX!!\n");
++ rc632_clear_irqs(handle, RC632_IRQ_TIMER);
+ return -ETIMEDOUT;
+ }
+ }
+@@ -297,8 +319,10 @@
+ if (ret < 0)
+ return ret;
+
+- if (cmd == 0)
++ if (cmd == 0){
++ rc632_clear_irqs(handle, RC632_IRQ_RX);
+ return 0;
++ }
+
+ /* poll every millisecond */
+ usleep(1000);
+@@ -333,7 +357,7 @@
+ /* check if IRQ has occurred (IRQ flag set)*/
+ if (foo & RC632_STAT_IRQ) {
+ ret = rc632_reg_read(handle, RC632_REG_INTERRUPT_RQ, &foo);
+- DEBUGP_INTERRUPT_FLAG(foo);
++ DEBUGP_INTERRUPT_FLAG("irq_rq",foo);
+ /* clear all interrupts */
+ rc632_clear_irqs(handle, 0xff);
+ }
+@@ -1578,6 +1602,12 @@
+ }, {
+ .reg = RC632_REG_CRC_PRESET_MSB,
+ .val = 0xff,
++ /*}, {
++ .reg = RC632_REG_INTERRUPT_EN,
++ .val = RC632_INT_IDLE |
++ RC632_INT_TIMER |
++ RC632_INT_RX |
++ RC632_INT_TX, */
+ }
+ };
+
+@@ -1732,7 +1762,7 @@
+ const struct iso15693_anticol_cmd *acf,
+ unsigned int acf_len,
+ struct iso15693_anticol_resp *resp,
+- unsigned int *rx_len, char *bit_of_col)
++ unsigned int *rx_len, unsigned char *bit_of_col)
+ {
+ u_int8_t error_flag, boc;
+ //u_int8_t rx_len;
+@@ -1757,12 +1787,15 @@
+ return ret;
+ DEBUGP_ERROR_FLAG(error_flag);
+
++ //FIXME: check for framing and crc errors...
+ if (error_flag & RC632_ERR_FLAG_COL_ERR) {
+ /* retrieve bit of collission */
+ ret = rc632_reg_read(handle, RC632_REG_COLL_POS, &boc);
+ if (ret < 0)
+ return ret;
+ *bit_of_col = boc;
++ }else{
++ *bit_of_col = 0;
+ }
+
+ return 0;
+Index: librfid/src/rfid_layer2_iso14443a.c
+===================================================================
+--- librfid.orig/src/rfid_layer2_iso14443a.c 2008-02-18 19:28:59.000000000 +0100
++++ librfid/src/rfid_layer2_iso14443a.c 2008-12-22 23:57:42.000000000 +0100
+@@ -170,6 +170,7 @@
+ iso14443a_code_nvb_bits(&acf.nvb, 16);
+
+ ret = iso14443a_transceive_acf(handle, &acf, &bit_of_col);
++ DEBUGP("tran_acf->%d boc: %d\n",ret,bit_of_col);
+ if (ret < 0)
+ return ret;
+
+@@ -198,6 +199,7 @@
+ switch (acf.sel_code) {
+ case ISO14443A_AC_SEL_CODE_CL1:
+ /* cascading from CL1 to CL2 */
++ DEBUGP("cascading from CL1 to CL2\n");
+ if (acf.uid_bits[0] != 0x88) {
+ DEBUGP("Cascade bit set, but UID0 != 0x88\n");
+ return -1;
+@@ -208,6 +210,7 @@
+ break;
+ case ISO14443A_AC_SEL_CODE_CL2:
+ /* cascading from CL2 to CL3 */
++ DEBUGP("cascading from CL2 to CL3\n");
+ memcpy(&handle->uid[3], &acf.uid_bits[1], 3);
+ acf.sel_code = ISO14443A_AC_SEL_CODE_CL3;
+ h->level = ISO14443A_LEVEL_CL3;
diff --git a/recipes/librfid/files/012-rc632-error-reg-ro-2.patch b/recipes/librfid/files/012-rc632-error-reg-ro-2.patch
new file mode 100644
index 0000000000..02920b86d0
--- /dev/null
+++ b/recipes/librfid/files/012-rc632-error-reg-ro-2.patch
@@ -0,0 +1,25 @@
+Index: librfid-svn/src/rfid_asic_rc632.c
+===================================================================
+--- librfid-svn.orig/src/rfid_asic_rc632.c 2008-02-26 10:18:00.000000000 -0500
++++ librfid-svn/src/rfid_asic_rc632.c 2008-02-26 10:26:10.000000000 -0500
+@@ -453,18 +453,15 @@
+ cur_tx_len = tx_len;
+
+
+- ret = rc632_reg_write(handle, RC632_REG_COMMAND, 0x00);
++ ret = rc632_reg_write(handle, RC632_REG_COMMAND, RC632_CMD_IDLE);
+ /* clear all interrupts */
+- ret = rc632_reg_write(handle, RC632_REG_INTERRUPT_RQ, 0x7f);
+- ret = rc632_reg_write(handle, RC632_REG_ERROR_FLAG, 0xff);
++ ret = rc632_reg_write(handle, RC632_REG_INTERRUPT_RQ, 0x3f);
+
+ { u_int8_t tmp;
+ rc632_reg_read(handle, RC632_REG_PRIMARY_STATUS, &tmp);
+ DEBUGP_STATUS_FLAG(tmp);
+ rc632_reg_read(handle, RC632_REG_PRIMARY_STATUS, &tmp);
+ DEBUGP_STATUS_FLAG(tmp);
+- rc632_reg_read(handle, RC632_REG_PRIMARY_STATUS, &tmp);
+- DEBUGP_STATUS_FLAG(tmp);
+ rc632_reg_read(handle, RC632_REG_ERROR_FLAG, &tmp);
+ DEBUGP_ERROR_FLAG(tmp);
+ }
diff --git a/recipes/librfid/files/013-zero-UID.patch b/recipes/librfid/files/013-zero-UID.patch
new file mode 100644
index 0000000000..30e09099c4
--- /dev/null
+++ b/recipes/librfid/files/013-zero-UID.patch
@@ -0,0 +1,31 @@
+Index: librfid-svn/src/rfid_asic_rc632.c
+===================================================================
+--- librfid-svn.orig/src/rfid_asic_rc632.c 2008-02-27 16:47:21.000000000 -0500
++++ librfid-svn/src/rfid_asic_rc632.c 2008-02-28 12:56:31.000000000 -0500
+@@ -529,7 +529,7 @@
+ rc632_reg_read(handle, RC632_REG_CHANNEL_REDUNDANCY, &tmp);
+
+ //return 0;
+- return -1;
++ return -EIO;
+ }
+
+ return rc632_fifo_read(handle, *rx_len, rx_buf);
+@@ -1777,7 +1777,7 @@
+ ret = rc632_transceive(handle, (u_int8_t *)acf, acf_len,
+ (u_int8_t *) resp, rx_len,
+ iso15693_timing[rate][ISO15693_T1], 0);
+- if (ret == -ETIMEDOUT)
++ if (ret == -ETIMEDOUT || ret == -EIO)
+ return ret;
+
+ /* determine whether there was a collission */
+@@ -1795,6 +1795,8 @@
+ *bit_of_col = boc;
+ }else{
+ *bit_of_col = 0;
++ if (error_flag & RC632_ERR_FLAG_CRC_ERR)
++ return -EIO;
+ }
+
+ return 0;
diff --git a/recipes/librfid/files/015-no_segfault.patch b/recipes/librfid/files/015-no_segfault.patch
new file mode 100644
index 0000000000..3df1c96f24
--- /dev/null
+++ b/recipes/librfid/files/015-no_segfault.patch
@@ -0,0 +1,16 @@
+Index: utils/librfid-tool.c
+===================================================================
+--- x/utils/librfid-tool.c (revision 2089)
++++ x/utils/librfid-tool.c (working copy)
+@@ -456,6 +456,10 @@
+
+ if (rh->reader->l2_supported & (1 << layer2)) {
+ l2h = rfid_layer2_init(rh, layer2);
++ if (!l2h) {
++ printf("error during layer2(%d)_init (0=14a,1=14b,3=15)\n",layer2);
++ return;
++ }
+ printf("Layer2 init ok\n");
+ rc = rfid_layer2_open(l2h);
+ } else {
+
diff --git a/recipes/librfid/files/librfid.rules b/recipes/librfid/files/librfid.rules
new file mode 100644
index 0000000000..82c635a113
--- /dev/null
+++ b/recipes/librfid/files/librfid.rules
@@ -0,0 +1 @@
+KERNEL=="spidev*", SYMLINK+="spidev"
diff --git a/recipes/librfid/files/soos01-set_clear_bits.patch b/recipes/librfid/files/soos01-set_clear_bits.patch
new file mode 100644
index 0000000000..31cf37bf13
--- /dev/null
+++ b/recipes/librfid/files/soos01-set_clear_bits.patch
@@ -0,0 +1,119 @@
+Index: librfid-svn/src/rfid_asic_rc632.c
+===================================================================
+--- librfid-svn.orig/src/rfid_asic_rc632.c 2008-03-12 13:02:52.000000000 +0100
++++ librfid-svn/src/rfid_asic_rc632.c 2008-03-12 15:15:34.000000000 +0100
+@@ -149,9 +149,15 @@
+ }
+
+ static int
+-rc632_clear_irqs(struct rfid_asic_handle *handle, u_int8_t bits)
++rc632_clear_spec_bits(struct rfid_asic_handle *handle, u_int8_t reg, u_int8_t bits)
+ {
+- return rc632_reg_write(handle, RC632_REG_INTERRUPT_RQ, (~RC632_INT_SET)&bits);
++ return rc632_reg_write(handle, reg, (0x3f)&bits);
++}
++
++static int
++rc632_set_spec_bits(struct rfid_asic_handle *handle, u_int8_t reg, u_int8_t bits)
++{
++ return rc632_reg_write(handle, reg, (0x80)|bits);
+ }
+
+ static int
+@@ -258,13 +264,10 @@
+
+ /* clear timer irq bit */
+ /*FIXME: is this right? maybe use write function and set bit 8 to zero and timer_bit to 1 to clear*/
+- //ret = rc632_set_bits(handle, RC632_REG_INTERRUPT_RQ, RC632_IRQ_TIMER);
+- //ret = rc632_reg_write(handle, RC632_REG_INTERRUPT_RQ, RC632_IRQ_TIMER);
+- ret = rc632_clear_irqs(handle, RC632_IRQ_TIMER);
++ ret = rc632_clear_spec_bits(handle, RC632_REG_INTERRUPT_RQ, RC632_IRQ_TIMER);
+
+ /* enable timer IRQ */
+- //ret |= rc632_set_bits(handle, RC632_REG_INTERRUPT_EN, RC632_IRQ_TIMER);
+- ret |= rc632_reg_write(handle, RC632_REG_INTERRUPT_EN, RC632_IRQ_SET | RC632_IRQ_TIMER);
++ ret |= rc632_set_spec_bits(handle, RC632_REG_INTERRUPT_EN, RC632_IRQ_TIMER);
+
+ ret |= rc632_reg_write(handle, RC632_REG_TIMER_RELOAD, divisor);
+
+@@ -282,10 +285,10 @@
+ return ret;
+ DEBUGP_INTERRUPT_FLAG("irq_en",irq);
+
+- ret = rc632_reg_write(handle, RC632_REG_INTERRUPT_EN, RC632_IRQ_SET
+- | RC632_IRQ_TIMER
++ ret = rc632_set_spec_bits(handle, RC632_REG_INTERRUPT_EN, RC632_IRQ_TIMER
+ | RC632_IRQ_IDLE
+- | RC632_IRQ_RX );
++ | RC632_IRQ_RX
++ );
+ if (ret < 0)
+ return ret;
+
+@@ -312,7 +315,7 @@
+
+ if (irq & RC632_IRQ_TIMER && !(irq & RC632_IRQ_RX)) {
+ DEBUGP("timer expired before RX!!\n");
+- rc632_clear_irqs(handle, RC632_IRQ_TIMER);
++ rc632_clear_spec_bits(handle, RC632_REG_INTERRUPT_RQ, RC632_IRQ_TIMER);
+ return -ETIMEDOUT;
+ }
+ }
+@@ -322,7 +325,7 @@
+ return ret;
+
+ if (cmd == 0){
+- rc632_clear_irqs(handle, RC632_IRQ_RX);
++ rc632_clear_spec_bits(handle, RC632_REG_INTERRUPT_RQ, RC632_IRQ_RX);
+ return 0;
+ }
+
+@@ -361,7 +364,7 @@
+ ret = rc632_reg_read(handle, RC632_REG_INTERRUPT_RQ, &foo);
+ DEBUGP_INTERRUPT_FLAG("irq_rq",foo);
+ /* clear all interrupts */
+- rc632_clear_irqs(handle, 0xff);
++ rc632_clear_spec_bits(handle, RC632_REG_INTERRUPT_RQ, RC632_IRQ_ALL);
+ }
+ }
+ if (cmd == 0) {
+@@ -455,7 +458,7 @@
+
+ ret = rc632_reg_write(handle, RC632_REG_COMMAND, RC632_CMD_IDLE);
+ /* clear all interrupts */
+- ret = rc632_reg_write(handle, RC632_REG_INTERRUPT_RQ, 0x3f);
++ rc632_clear_spec_bits(handle, RC632_REG_INTERRUPT_RQ, RC632_INT_ALL);
+
+ { u_int8_t tmp;
+ rc632_reg_read(handle, RC632_REG_PRIMARY_STATUS, &tmp);
+@@ -549,7 +552,7 @@
+ DEBUGP("timeout=%u, rx_len=%u\n", timer, *rx_len);
+ ret = rc632_reg_write(handle, RC632_REG_COMMAND, 0x00); /* IDLE */
+ /* clear all interrupts */
+- ret = rc632_reg_write(handle, RC632_REG_INTERRUPT_RQ, 0x7f);
++ rc632_clear_spec_bits(handle, RC632_REG_INTERRUPT_RQ, RC632_INT_ALL);
+
+ ret = rc632_timer_set(handle, timer);
+ if (ret < 0)
+Index: librfid-svn/src/rfid_asic_rc632.h
+===================================================================
+--- librfid-svn.orig/src/rc632.h 2008-03-12 13:01:43.000000000 +0100
++++ librfid-svn/src/rc632.h 2008-03-12 12:42:59.000000000 +0100
+@@ -106,6 +106,8 @@
+ RC632_INT_RX = 0x08,
+ RC632_INT_TX = 0x10,
+ RC632_INT_TIMER = 0x20,
++ RC632_INT_ALL = 0x3f,
++
+ RC632_INT_SET = 0x80,
+ };
+
+@@ -261,6 +263,7 @@
+ RC632_IRQ_RX = 0x08,
+ RC632_IRQ_TX = 0x10,
+ RC632_IRQ_TIMER = 0x20,
++ RC632_IRQ_ALL = 0x3f,
+
+ RC632_IRQ_SET = 0x80,
+ };
+
diff --git a/recipes/librfid/files/soos02-check-errors.patch b/recipes/librfid/files/soos02-check-errors.patch
new file mode 100644
index 0000000000..6c40516336
--- /dev/null
+++ b/recipes/librfid/files/soos02-check-errors.patch
@@ -0,0 +1,36 @@
+diff --git a/src/rfid_asic_rc632.c b/src/rfid_asic_rc632.c
+index b9b1aff..f0948c6 100644
+--- a/src/rfid_asic_rc632.c
++++ b/src/rfid_asic_rc632.c
+@@ -297,7 +297,9 @@ static int rc632_wait_idle_timer(struct rfid_asic_handle *handle)
+ DEBUGP_STATUS_FLAG(stat);
+ if (stat & RC632_STAT_ERR) {
+ u_int8_t err;
+- rc632_reg_read(handle, RC632_REG_ERROR_FLAG, &err);
++ ret = rc632_reg_read(handle, RC632_REG_ERROR_FLAG, &err);
++ if (ret < 0)
++ return ret;
+ DEBUGP_ERROR_FLAG(err);
+ if (err & (RC632_ERR_FLAG_COL_ERR |
+ RC632_ERR_FLAG_PARITY_ERR |
+@@ -457,14 +459,16 @@ rc632_transceive(struct rfid_asic_handle *handle,
+
+
+ ret = rc632_reg_write(handle, RC632_REG_COMMAND, RC632_CMD_IDLE);
++ if (ret < 0)
++ return ret;
+ /* clear all interrupts */
+- rc632_clear_spec_bits(handle, RC632_REG_INTERRUPT_RQ, RC632_INT_ALL);
++ ret = rc632_clear_spec_bits(handle, RC632_REG_INTERRUPT_RQ, RC632_INT_ALL);
++ if (ret < 0)
++ return ret;
+
+ { u_int8_t tmp;
+ rc632_reg_read(handle, RC632_REG_PRIMARY_STATUS, &tmp);
+ DEBUGP_STATUS_FLAG(tmp);
+- rc632_reg_read(handle, RC632_REG_PRIMARY_STATUS, &tmp);
+- DEBUGP_STATUS_FLAG(tmp);
+ rc632_reg_read(handle, RC632_REG_ERROR_FLAG, &tmp);
+ DEBUGP_ERROR_FLAG(tmp);
+ }
+
diff --git a/recipes/librfid/files/soos03-no_hang-openpcd.patch b/recipes/librfid/files/soos03-no_hang-openpcd.patch
new file mode 100644
index 0000000000..cfe5d027a9
--- /dev/null
+++ b/recipes/librfid/files/soos03-no_hang-openpcd.patch
@@ -0,0 +1,19 @@
+diff --git a/src/rfid_asic_rc632.c b/src/rfid_asic_rc632.c
+index f0948c6..fbc4c2a 100644
+--- a/src/rfid_asic_rc632.c
++++ b/src/rfid_asic_rc632.c
+@@ -285,13 +285,6 @@ static int rc632_wait_idle_timer(struct rfid_asic_handle *handle)
+ return ret;
+ DEBUGP_INTERRUPT_FLAG("irq_en",irq);
+
+- ret = rc632_set_spec_bits(handle, RC632_REG_INTERRUPT_EN, RC632_IRQ_TIMER
+- | RC632_IRQ_IDLE
+- | RC632_IRQ_RX
+- );
+- if (ret < 0)
+- return ret;
+-
+ while (1) {
+ rc632_reg_read(handle, RC632_REG_PRIMARY_STATUS, &stat);
+ DEBUGP_STATUS_FLAG(stat);
+
diff --git a/recipes/librfid/files/spidev.patch b/recipes/librfid/files/spidev.patch
new file mode 100644
index 0000000000..29c3a171ea
--- /dev/null
+++ b/recipes/librfid/files/spidev.patch
@@ -0,0 +1,24 @@
+Index: librfid-0.2.0/utils/common.c
+===================================================================
+--- librfid-0.2.0.orig/utils/common.c
++++ librfid-0.2.0/utils/common.c
+@@ -72,15 +72,11 @@ struct rfid_protocol_handle *ph;
+
+ int reader_init(void)
+ {
+- printf("opening reader handle OpenPCD, CM5x21\n");
+- rh = rfid_reader_open(NULL, RFID_READER_OPENPCD);
++ printf("opening reader handle SPIDEV\n");
++ rh = rfid_reader_open("/dev/spidev", RFID_READER_SPIDEV);
+ if (!rh) {
+- fprintf(stderr, "No OpenPCD found\n");
+- rh = rfid_reader_open(NULL, RFID_READER_CM5121);
+- if (!rh) {
+- fprintf(stderr, "No Omnikey Cardman 5x21 found\n");
+- return -1;
+- }
++ fprintf(stderr, "No spidev RFID found\n");
++ return -1;
+ }
+ return 0;
+ }
diff --git a/recipes/librfid/librfid_svn.bb b/recipes/librfid/librfid_svn.bb
new file mode 100644
index 0000000000..78800de3eb
--- /dev/null
+++ b/recipes/librfid/librfid_svn.bb
@@ -0,0 +1,38 @@
+DESCRIPTION = "RFID library"
+SECTION = "devel"
+PRIORITY = "optional"
+LICENSE = "GPL"
+DEPENDS = "libusb"
+SRCNAME = "librfid"
+
+PV = "0.2.0+svnr${SRCREV}"
+PR = "r5"
+
+SRC_URI = "svn://svn.gnumonks.org/trunk;module=${SRCNAME};proto=http \
+ file://010-rc632-definitions-fix.patch;patch=1 \
+ file://011-rc632-define-fixes-followups.patch;patch=1 \
+ file://012-rc632-error-reg-ro-2.patch;patch=1 \
+ file://013-zero-UID.patch;patch=1 \
+ file://015-no_segfault.patch;patch=1 \
+ file://soos01-set_clear_bits.patch;patch=1 \
+ file://soos02-check-errors.patch;patch=1 \
+ file://soos03-no_hang-openpcd.patch;patch=1 \
+ file://librfid.rules \
+ "
+
+SRC_URI_append_boc01 = "file://spidev.patch;patch=1"
+PACKAGE_ARCH_boc01 = "boc01"
+EXTRA_OECONF_boc01 += "--enable-spidev"
+
+S = "${WORKDIR}/${SRCNAME}"
+
+inherit autotools
+
+do_install_append() {
+ install -d ${D}/${sysconfdir}/udev/rules.d
+ install -m 0644 ${WORKDIR}/librfid.rules ${D}/${sysconfdir}/udev/rules.d/70-librfid.rules
+}
+
+do_stage() {
+ autotools_stage_all
+}