Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Running on linux #17

Open
albfan opened this issue Apr 16, 2023 · 0 comments
Open

Running on linux #17

albfan opened this issue Apr 16, 2023 · 0 comments

Comments

@albfan
Copy link

albfan commented Apr 16, 2023

latest version from:

https://www.deviationtx.com/downloads-new/category/161-dfu-usb-tool

is able to run on linux but something seems to be broken from usb4java

$ sudo dfu-util -l
dfu-util 0.11

Copyright 2005-2009 Weston Schmidt, Harald Welte and OpenMoko Inc.
Copyright 2010-2021 Tormod Volden and Stefan Schmidt
This program is Free Software and has ABSOLUTELY NO WARRANTY
Please report bugs to http://sourceforge.net/p/dfu-util/tickets/

Found DFU: [0483:df11] ver=0200, devnum=36, cfg=1, intf=0, path="1-6", alt=2, name="@SPI Flash: Library/0x00020000/030*064Kg", serial="DEVO-7E ??????Q"
Found DFU: [0483:df11] ver=0200, devnum=36, cfg=1, intf=0, path="1-6", alt=1, name="@SPI Flash: Config/0x00002000/030*04Kg", serial="DEVO-7E ??????Q"
Found DFU: [0483:df11] ver=0200, devnum=36, cfg=1, intf=0, path="1-6", alt=0, name="@Internal Flash  /0x08003000/00*001Ka,244*001Kg", serial="DEVO-7E ??????Q"

From journalctl the missing characters looks like chinese ones:

abr 16 16:25:15 fedora kernel: usb 1-6: new full-speed USB device number 37 using xhci_hcd
abr 16 16:25:15 fedora kernel: usb 1-6: New USB device found, idVendor=0483, idProduct=df11, bcdDevice= 2.00
abr 16 16:25:15 fedora kernel: usb 1-6: New USB device strings: Mfr=1, Product=2, SerialNumber=3
abr 16 16:25:15 fedora kernel: usb 1-6: Product: STM32 DFU
abr 16 16:25:15 fedora kernel: usb 1-6: Manufacturer: STMicroelectronics
abr 16 16:25:15 fedora kernel: usb 1-6: SerialNumber: DEVO-7E  ⅒䷿д㘅Q
abr 16 16:25:15 fedora mtp-probe[684507]: checking bus 1, device 37: "/sys/devices/pci0000:00/0000:00:14.0/usb1/1-6"
abr 16 16:25:15 fedora mtp-probe[684507]: bus: 1, device: 37 was not an MTP device
abr 16 16:25:15 fedora mtp-probe[684508]: checking bus 1, device 37: "/sys/devices/pci0000:00/0000:00:14.0/usb1/1-6"
abr 16 16:25:15 fedora mtp-probe[684508]: bus: 1, device: 37 was not an MTP device

I try to build from sources but something is broken about the local jars on libs/

$ mvn clean package
[INFO] Scanning for projects...
[INFO] 
[INFO] ------------------< DeviationUpload:DeviationUpload >-------------------
[INFO] Building Deviation Uploader 0.11.0
[INFO] --------------------------------[ jar ]---------------------------------
[INFO] 
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ DeviationUpload ---
[INFO] Deleting /home/alberto/projects/java/deviation-upload/target
[INFO] 
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ DeviationUpload ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 5 resources
[INFO] 
[INFO] --- maven-compiler-plugin:2.5.1:compile (default-compile) @ DeviationUpload ---
[INFO] Compiling 57 source files to /home/alberto/projects/java/deviation-upload/target/classes
[INFO] -------------------------------------------------------------
[ERROR] COMPILATION ERROR : 
[INFO] -------------------------------------------------------------
[ERROR] error: error reading /home/alberto/.m2/repository/de-ailis/usb4java/1.0.0/usb4java-1.0.0.jar; invalid END header (bad central directory offset)
[ERROR] error: error reading /home/alberto/.m2/repository/org-apache-commons/commons-lang3/3.1/commons-lang3-3.1.jar; invalid END header (bad central directory offset)
[INFO] 2 errors 
[INFO] -------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  0.554 s
[INFO] Finished at: 2023-04-16T16:26:39+02:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.5.1:compile (default-compile) on project DeviationUpload: Compilation failure: Compilation failure: 
[ERROR] error: error reading /home/alberto/.m2/repository/de-ailis/usb4java/1.0.0/usb4java-1.0.0.jar; invalid END header (bad central directory offset)
[ERROR] error: error reading /home/alberto/.m2/repository/org-apache-commons/commons-lang3/3.1/commons-lang3-3.1.jar; invalid END header (bad central directory offset)
[ERROR] -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException

I create an uberjar from latest jar and that allows to build and debug (see branch https://github.com/albfan/deviation-upload/tree/build):

and found the read for device data is wrong:

diff --git i/src/deviation/gui/DeviationUploadGUI.java w/src/deviation/gui/DeviationUploadGUI.java
index d101d4e..83c9a70 100644
--- i/src/deviation/gui/DeviationUploadGUI.java
+++ w/src/deviation/gui/DeviationUploadGUI.java
@@ -255,13 +255,17 @@ public class DeviationUploadGUI {
                 public Object getValueAt(int row, int col) {
                     DfuMemory mem = devMemory.get(row);
                     Sector sector = mem.find((int)mem.findStartingAddress());
-                    switch(col) {
-                    case 0: return mem.name();
-                    case 1: return String.format("0x%08x", sector.start());
-                    case 2: return String.valueOf(sector.size() * sector.count() / 1024) + " kb";
-                    case 3: return sector.count();
-                    case 4: return String.valueOf(sector.size() / 1024) + " kb";
-                    default: return "";
+                    try {
+                        switch(col) {
+                        case 0: return mem.name();
+                        case 1: return String.format("0x%08x", sector.start());
+                        case 2: return String.valueOf(sector.size() * sector.count() / 1024) + " kb";
+                        case 3: return sector.count();
+                        case 4: return String.valueOf(sector.size() / 1024) + " kb";
+                        default: return "";
+                        }
+                    } catch (Exception e) {
+                        return "error reading";
                     }
                 }
             };

I hae zero to none idea of how to use usb4java but llooks this project:

https://github.com/rusefi/dfu_java

has a vailid implementation over last version of usb4java.

I will try to rework this project on top of that to have a GUI on linux.

NOTE: probably use dfu-util and copy contents for firmware in usb mode is enough to update firmware, but is interesting to have linux suppport for this app.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant