ndef: Workaround buggy Nokia BH-505 handover implementation
authorSzymon Janc <szymon.janc@tieto.com>
Wed, 31 Oct 2012 11:22:23 +0000 (12:22 +0100)
committerSamuel Ortiz <sameo@linux.intel.com>
Wed, 14 Nov 2012 10:36:16 +0000 (11:36 +0100)
According to BT Core Specification 4.0 length field in OOB EIR contains
the length of the entire OOB data block including the length field
itself.

Some Nokia BH-505 devices reports OOB EIR length without length field
size. Correct size before sending EIR to agent.

src/ndef.c

index e9da81e..31677fc 100644 (file)
@@ -1369,6 +1369,15 @@ static void correct_eir_len(struct bt_data *data)
                data->data[0] = data->data[1];
                data->data[1] = 0;
        }
+
+       /*
+        * Some Nokia BH-505 report total OOB block length without length field
+        * size.
+        */
+       if (data->data[0] == data->size - 2) {
+               DBG("EIR length without length field size");
+               data->data[0] += 2;
+       }
 }
 
 static struct near_ndef_mime_payload *