question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Test and improve homegrown USB driver

See original GitHub issue

Version 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:closed
  • Created 3 years ago
  • Comments:18 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
marian-m12lcommented, Jan 8, 2021

@MathieuIko Thanks for the feedback. I moved your comment to a new issue (#158) as this one relates to the usb driver.

1reaction
agademercommented, Jan 8, 2021

@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 :

I just started to use and test this wonderful application! An impressive work, and a great tool to get full control on existing and custom stories. May thanks to the developers! 👍

I haven’t found how to create a new pack (from scratch). There seems to be no button or link on neither of the two main pages (Pack library or Pack editor). In case this button/link was just hidden, I checked the DOM, but no “create”-something on neither of the two pages. Did I miss something?

I will continue testing the app. For now, I successfully:

  • mounted my Lunii in STUdio ;
  • downloaded the two packs from my Lunii to STUdio (the two packs being the official default pack, with metadata, and a custom story created on the Android app) ;
  • open these two packs in the Pack editor, and test/simulate them in STUdio (listen and interact).

I haven’t tried yet to add/remove nodes in a pack, nor upload a created/edited pack back to my Lunii.

My environment:

  • Lunii v2 with firmware version 2.20
  • STUdio 0.3.0-alpha.3-SNAPSHOT (cloned the repo and built few hours ago)
  • (X)Ubuntu 20.04.1 (64 bits)
  • Mozilla Firefox 84.0.1

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/marian-m12l/studio/issues/97#issuecomment-756447535, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABZ27KYMHMMZFH4YYIUCUL3SYY7HZANCNFSM4M7FNZYA .

Read more comments on GitHub >

github_iconTop Results From Across the Web

Driver Install Tests (Device Fundamentals) - Windows
The tests are designed to improve the overall experience for end users who need to install and reinstall a device driver or a...
Read more >
Building a Simple USB Driver | Apple Developer Documentation
This sample USB driver works by detecting when a USB device is plugged into a Mac and logging the event. The test device...
Read more >
Best Desktop Computers of 2022 - Consumer Reports
In this review of the best desktop computers of 2022, Consumer Reports highlights all-in-one, compact, and tower models from Acer, Apple, ...
Read more >
Dish's $25-a-month Boost Infinite plan is now out in beta
For one, Genesis is meant to test out Dish's homegrown network, which it's legally required to build out for reasons I explain here....
Read more >
Truck drivers for Seattle sandwich maker Homegrown asked ...
Drivers asked for better vehicle maintenance — their complaints vary from broken headlights to brake issues that could make the truck unsafe to ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found