Test and improve homegrown USB driver
See original GitHub issueVersion 0.2.0-beta.1 is the first version using a homegrown USB driver! 🎉
Before I push this driver into the official release, I’ll ask for your feedback. The driver will have to be tested against a variety of devices, especially with different firmware versions, to tackle the remaining corner cases. I you’re willing to help, please let me know below.
DISCLAIMER Be aware that this driver is mostly untested. Well, actually it was tested against my own device, which has no firmware version (probably an old-ish revision of the device), and it would be great if someone with a more recent revision could test it. The USB communication is, in theory, very close to what the official driver does, and I would be very surprised if it bricked a device : it only writes to the SD card, never to the internal Flash memory which holds the firmware, and the Luniistore does a great job at restoring story packs when a error occurs. However, please acknowledge that there is no such thing as zero risk.
How to test the new driver
If you did try this beta version, please comment on this issue, whether you encountered errors or things worked perfectly. If you are running a device with firmware 1.1, I’m even more curious to know how things went!
YOU DON’T HAVE TO FOLLOW ALL THESE STEPS if you don’t feel like it, any feedback will be greatly appreciated.
Just use the application
First and foremost, you can simply use the application and see how it behaves regarding the following operations involving the device:
- Get device infos (uuid, firmware version, S/N, total space and free/used space, error code)
- Get the list of story packs
- Extract a story pack to the local library
- Add a story pack from the local library
- Remove a story pack
- Reorder story packs
Does everything work as usual? Are you seeing the same informations about your device?
Please make sure to unplug and check that everything is OK on the device after each operation involving a change in packs list (any of the last 3 operations), as it is important to check the device is OK with the changes made by the driver.
If you are comfortable with it, here are the corresponding curl commands:
curl -v -X GET http://localhost:8080/api/device/infos
curl -v -X GET http://localhost:8080/api/device/packs
curl -v -X POST -H 'Content-Type: application/json' -d '{"uuid":"12345678-1234-1234-1234-1234567890ab"}' http://localhost:8080/api/device/addToLibrary
curl -v -X POST -H 'Content-Type: application/json' -d '{"uuid":"12345678-1234-1234-1234-1234567890ab","path":"file_name_in_library_folder.pack"}' http://localhost:8080/api/device/addFromLibrary
curl -v -X POST -H 'Content-Type: application/json' -d '{"uuid":"12345678-1234-1234-1234-1234567890ab"}' http://localhost:8080/api/device/removeFromDevice
curl -v -X POST -H 'Content-Type: application/json' -d '{"uuids":["11111111-1111-1111-1111-111111111111","33333333-3333-3333-3333-333333333333","22222222-2222-2222-2222-222222222222"]}' http://localhost:8080/api/device/reorder
Gather data
If you are seeing incorrect behaviour, I’d love to get a bit more data. Here is what you can do to collect the good bits.
1) Enable debug logs
Download and extract log4j2-debug.xml
here and copy it in the same folder as the studio launch script.
Edit the script to add, right after java
in the last line:
-Dlog4j2.configurationFile=$STUDIO_PATH/log4j2-debug.xml
on Linux and macOS-Dlog4j2.configurationFile=%STUDIO_PATH%/log4j2-debug.xml
on Windows
The last line should look like this:
java -Dlog4j2.configurationFile=$STUDIO_PATH/log4j2-debug.xml -Dvertx.disableDnsResolver=true -Djava.util.logging.manager=org.apache.logging.log4j.jul.LogManager -Dvertx.logger-delegate-factory-class-name=io.vertx.core.logging.Log4j2LogDelegateFactory -Dfile.encoding=UTF-8 -cp $STUDIO_PATH/studio-web-ui-0.2.0-beta.1.jar:$STUDIO_PATH/lib/*:. io.vertx.core.Launcher run studio.webui.MainVerticle
Your studio-latest.log
will contain much more valuable data.
You can run the script again.
2a) Execute problematic operations in the browser
In your browser:
- If you are comfortable with it, look for errors in the console, and open the network tab to monitor the HTTP calls
- Perform operations involving the device
- If you opened the network tab, look for errors. You can also export the whole traffic to an HAR file.
It will be easier to follow if you can also explain in a few words what operations you did during this test.
2b) Execute problematic operations with curl
You can execute the above curl commands if you wish, this will give you clean JSON responses on the console.
3) Dump important sectors from the device
If you are familiar with curl (or a similar tool), you can execute this request to dump a few relevant sectors from the device into a local folder of your choice. These sectors contain the device infos, the packs index, and the first, second and last sector of each pack, along with their addresses.
curl -v -X POST -H 'Content-Type: application/json' -d '{"outputPath":"/absolute/path/to/a/new/folder"}' http://localhost:8080/api/device/dump
4) Share the data
You can either post the results on this issue, or let me know if you prefer to share privately. The logs, JSON payloads and sector dump will contain information that you may find sensitive, such as your device identifiers, the identifier/name of all packs in your device and in your local library. I can open and assign you to a “security advisory”, which will only be visible to you and me.
5) ???
6) Profit!
Issue Analytics
- State:
- Created 3 years ago
- Comments:18 (8 by maintainers)
Top GitHub Comments
@MathieuIko Thanks for the feedback. I moved your comment to a new issue (#158) as this one relates to the usb driver.
@m.iko : there is no “create from scratch button” (to my knowledge).
But if you switch to the editor view (icon in the top right of the window) it will open the sample pack (Marc / Julie) that is meant to be modified to make new pack.
Hope this help.
Le ven. 8 janv. 2021 à 00:25, m.iko notifications@github.com a écrit :