marcus905 / libnfc

Automatically exported from code.google.com/p/libnfc
GNU Lesser General Public License v3.0
0 stars 0 forks source link

PN53x USB enumeration broken after wake-up #163

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
There is a known bug in PN533 hardware (probably PN531 too, to be checked):

USB descriptors get easily overwritten in XRAM, which renders USB enumeration 
impossible after sleep/wake-up.
This is critical when device is going to be e.g. embedded in a laptop, you 
cannot just plug it again to reset it.

The trick is to save descriptors as soon as the device is discovered the first 
time and to restore them just before going to sleep.

Concerned data is XRAM between 0x0019 & 0x0055.

So, to save them: (don't try to read too many at once or you'll already trigger 
the bug & overwrite XRAM...)
d4 06 00 19 00 1a 00 1b 00 1c
...
d4 06 00 51 00 52 00 53 00 54
d4 06 00 55

and to restore them:
d4 08 00 19 xx 00 1a xx 00 1b xx 00 1c xx
...
d4 08 00 51 xx 00 52 xx 00 53 xx 00 54 xx
d4 08 00 55 xx

Ok that's for the theory, now in practice libnfc is not a driver so it won't 
run from discovery till sleep and it's overkilling to save/restore this XRAM at 
each single libnfc usage...

Maybe we should limit ourselves to providing a pn53x-usbdesc-save and 
pn53x-usbdesc-restore commands in the examples, and saving them to a file and 
propose hooks in udev & acpi to call them?

Original issue reported on code.google.com by yob...@gmail.com on 2 Apr 2011 at 7:59

GoogleCodeExporter commented 9 years ago

Original comment by yob...@gmail.com on 2 Apr 2011 at 8:00

GoogleCodeExporter commented 9 years ago

Original comment by yob...@gmail.com on 2 Apr 2011 at 8:01