Open FlorianUekermann opened 8 years ago
Hi @MaVo159 !
We should add guards also to interface creation, so it would not be available in release
binary even when nothing is printed there. Additional interfaces could make device blocked on VM environments.
That is definitely the plan. I would like to wait with that until I have time to merge the two branches though, since I'll need to do something more elegant for the device descriptor anyway. Unless there are immediate plans to release a new version firmware version of course. I wouldn't expect VM problems, because this is not an HID interface. Or have you encountered VMs that don't forward devices for other reasons.
OK! As for VMs I have not heard about other block causes, just blind guess.
Adds two simple functions for debugging.
Debugf works exactly like printf. Debug takes an array of bytes and a length. Example code on device:
Output on host:
Debugging is disabled by default. Both functions do nothing unless debugging in is enabled by uncommenting line 8 in debug.h (this should be done via make target at some point)
To try it uncomment line 8 in src/inc/debug.h and run "python debug.py" in the repository root. Then plug in the Nitrokey HSM. You should see this as soon as the device is done with the basic setup:
This code should have no side effects and be compatible with the master branch as well. As long as pyusb is installed it should work on every OS ('apt-get install python-usb'). More extensive documentation in debug.py and debug.h.
Don't use floating point math (that means don't print them either).