development release: Using usb4java 1.2.0 to check if it works @ macOS 'High Sierra'

This commit is contained in:
Dmitry Isaenko 2019-03-13 17:04:14 +03:00
parent d1b3067575
commit bda316abbb
3 changed files with 21 additions and 30 deletions

16
pom.xml
View file

@ -8,7 +8,7 @@
<name>NS-USBloader</name> <name>NS-USBloader</name>
<artifactId>ns-usbloader</artifactId> <artifactId>ns-usbloader</artifactId>
<version>0.2.3_DEVELOPMENT-SNAPSHOT</version> <version>0.2.3_DEV-SNAPSHOT</version>
<url>https://github.com/developersu/ns-usbloader/</url> <url>https://github.com/developersu/ns-usbloader/</url>
<description> <description>
@ -140,7 +140,7 @@
<dependency> <dependency>
<groupId>org.usb4java</groupId> <groupId>org.usb4java</groupId>
<artifactId>usb4java</artifactId> <artifactId>usb4java</artifactId>
<version>1.3.0</version> <version>1.2.0</version>
<scope>compile</scope> <scope>compile</scope>
</dependency> </dependency>
</dependencies> </dependencies>
@ -155,6 +155,18 @@
<target>1.8</target> <target>1.8</target>
</configuration> </configuration>
</plugin> </plugin>
<!-- Don't generate default JAR without dependencies -->
<plugin>
<artifactId>maven-jar-plugin</artifactId>
<version>2.4</version>
<executions>
<execution>
<id>default-jar</id>
<phase>none</phase>
</execution>
</executions>
</plugin>
<!-- Generate JAR with dependencies -->
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId> <artifactId>maven-assembly-plugin</artifactId>

View file

@ -12,7 +12,7 @@ import java.util.Locale;
import java.util.ResourceBundle; import java.util.ResourceBundle;
public class NSLMain extends Application { public class NSLMain extends Application {
public static final String appVersion = "v0.2.3_DEVELOPMENT"; public static final String appVersion = "v0.2.3_DEV";
@Override @Override
public void start(Stage primaryStage) throws Exception{ public void start(Stage primaryStage) throws Exception{

View file

@ -114,19 +114,17 @@ public class UsbCommunications extends Task<Void> {
switch (result){ switch (result){
case 0: case 0:
System.out.println("SUCCES"); printLog("DBG: getActiveConfigDescriptor\n"+configDescriptor.dump(), EMsgType.PASS);
System.out.println("\n"+configDescriptor.dump());
break; break;
case LibUsb.ERROR_NOT_FOUND: case LibUsb.ERROR_NOT_FOUND:
System.out.println("ERROR_NOT_FOUND "+result); printLog("DBG: getActiveConfigDescriptor: ERROR_NOT_FOUND", EMsgType.FAIL);
break; break;
default: default:
System.out.println("UNKNOWN "+result); printLog("DBG: getActiveConfigDescriptor: "+result, EMsgType.FAIL);
break; break;
} }
System.out.println();
//LibUsb.freeConfigDescriptor(configDescriptor); LibUsb.freeConfigDescriptor(configDescriptor);
//*/ //*/
/* /*
* So what did we learn? * So what did we learn?
@ -228,6 +226,7 @@ public class UsbCommunications extends Task<Void> {
} }
else else
printLog("libusb doesn't supports function 'CAP_SUPPORTS_DETACH_KERNEL_DRIVER'. Proceeding.", EMsgType.WARNING); printLog("libusb doesn't supports function 'CAP_SUPPORTS_DETACH_KERNEL_DRIVER'. Proceeding.", EMsgType.WARNING);
/*
// Reset device // Reset device
result = LibUsb.resetDevice(handlerNS); result = LibUsb.resetDevice(handlerNS);
if (result == 0) if (result == 0)
@ -237,6 +236,7 @@ public class UsbCommunications extends Task<Void> {
close(); close();
return null; return null;
} }
*/
// Set configuration (soft reset if needed) // Set configuration (soft reset if needed)
result = LibUsb.setConfiguration(handlerNS, 1); // 1 - configuration all we need result = LibUsb.setConfiguration(handlerNS, 1); // 1 - configuration all we need
if (result != LibUsb.SUCCESS){ if (result != LibUsb.SUCCESS){
@ -264,27 +264,6 @@ public class UsbCommunications extends Task<Void> {
printLog("Set active configuration to device.", EMsgType.PASS); printLog("Set active configuration to device.", EMsgType.PASS);
} }
////////////////////////////////////////// DEBUG INFORMATION START ///////////////////////////////////////////
//
ConfigDescriptor configDescriptor = new ConfigDescriptor();
//result = LibUsb.getConfigDescriptor(deviceNS, (byte)0x01, configDescriptor);
result = LibUsb.getActiveConfigDescriptor(deviceNS, configDescriptor);
switch (result){
case 0:
printLog("DBG: getActiveConfigDescriptor\n"+configDescriptor.dump(), EMsgType.PASS);
break;
case LibUsb.ERROR_NOT_FOUND:
printLog("DBG: getActiveConfigDescriptor: ERROR_NOT_FOUND", EMsgType.FAIL);
break;
default:
printLog("DBG: getActiveConfigDescriptor: "+result, EMsgType.FAIL);
break;
}
LibUsb.freeConfigDescriptor(configDescriptor);
//*/
////////////////////////////////////////// DEBUG INFORMATION END //////////////////////////////////////////////
// Claim interface // Claim interface
result = LibUsb.claimInterface(handlerNS, DEFAULT_INTERFACE); result = LibUsb.claimInterface(handlerNS, DEFAULT_INTERFACE);
if (result != LibUsb.SUCCESS) { if (result != LibUsb.SUCCESS) {