--- /dev/null
+<project
+ xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>com.codesrc</groupId>
+ <artifactId>scsi2sd-util</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ </parent>
+
+ <artifactId>scsi2sd.io.usb4java</artifactId>
+ <packaging>jar</packaging>
+
+ <name>scsi2sd.io.usb4java</name>
+ <url>http://www.codesrc.com</url>
+ <developers>
+ <developer>
+ <name>Michael McMaster</name>
+ <email>michael@codesrc.com</email>
+ </developer>
+ </developers>
+
+ <properties>
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+ <libusb4java.version>1.3.0</libusb4java.version>
+
+ </properties>
+
+ <build>
+ <directory>target</directory>
+ <outputDirectory>target/classes</outputDirectory>
+ <finalName>${project.artifactId}-${project.version}</finalName>
+
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <version>3.8.0</version>
+ <configuration>
+ <source>10</source>
+ <target>10</target>
+ </configuration>
+ </plugin>
+
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-shade-plugin</artifactId>
+ <configuration>
+ <artifactSet>
+ <excludes>
+ <exclude>module-info.java</exclude>
+ <exclude>commons-lang3.jar</exclude>
+
+ </excludes>
+ </artifactSet>
+ </configuration>
+ <executions>
+ <execution>
+ <phase>package</phase>
+ <goals>
+ <goal>shade</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+
+ <plugin>
+ <groupId>org.moditect</groupId>
+ <artifactId>moditect-maven-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>add-module-infos</id>
+ <phase>package</phase>
+ <goals>
+ <goal>add-module-info</goal>
+ </goals>
+ <configuration>
+ <overwriteExistingFiles>true</overwriteExistingFiles>
+ <module>
+ <moduleInfoFile>
+ src/main/java/module-info.java
+ </moduleInfoFile>
+ </module>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+
+ </plugins>
+ </build>
+
+
+ <dependencies>
+ <dependency>
+ <groupId>org.usb4java</groupId>
+ <artifactId>usb4java</artifactId>
+ <version>1.3.0</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.usb4java</groupId>
+ <artifactId>libusb4java</artifactId>
+ <version>${libusb4java.version}</version>
+ <classifier>linux-x86</classifier>
+ </dependency>
+ <dependency>
+ <groupId>org.usb4java</groupId>
+ <artifactId>libusb4java</artifactId>
+ <version>${libusb4java.version}</version>
+ <classifier>linux-x86-64</classifier>
+ </dependency>
+ <dependency>
+ <groupId>org.usb4java</groupId>
+ <artifactId>libusb4java</artifactId>
+ <version>${libusb4java.version}</version>
+ <classifier>win32-x86</classifier>
+ </dependency>
+ <dependency>
+ <groupId>org.usb4java</groupId>
+ <artifactId>libusb4java</artifactId>
+ <version>${libusb4java.version}</version>
+ <classifier>win32-x86-64</classifier>
+ </dependency>
+ <dependency>
+ <groupId>org.usb4java</groupId>
+ <artifactId>libusb4java</artifactId>
+ <version>${libusb4java.version}</version>
+ <classifier>darwin-x86-64</classifier>
+ </dependency>
+ <dependency>
+ <groupId>org.usb4java</groupId>
+ <artifactId>libusb4java</artifactId>
+ <version>${libusb4java.version}</version>
+ <classifier>linux-arm</classifier>
+ </dependency>
+ <dependency>
+ <groupId>org.usb4java</groupId>
+ <artifactId>libusb4java</artifactId>
+ <version>${libusb4java.version}</version>
+ <classifier>linux-aarch64</classifier>
+ </dependency>
+
+ <!-- https://mvnrepository.com/artifact/org.apache.commons/commons-lang3 -->
+ <dependency>
+ <groupId>org.apache.commons</groupId>
+ <artifactId>commons-lang3</artifactId>
+ <version>3.8.1</version>
+ <scope>provided</scope>
+ </dependency>
+
+ </dependencies>
+</project>
+
--- /dev/null
+// Copyright (C) 2020 Michael McMaster <michael@codesrc.com>
+//
+// This file is part of scsi2sd-util.
+//
+// scsi2sd-util is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// scsi2sd-util is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with scsi2sd-util. If not, see <https://www.gnu.org/licenses/>.
+
+module com.codesrc.scsi2sd.io.usb4java {
+ exports org.usb4java;
+ requires org.apache.commons.lang3;
+}
}
}
this.readDebugData();
+
+ if (firmwareVersion >= 0x0485) {
+ this.readDeviceList();
+ }
}
@Override
return false; //"3.5\" SCSI2SD V4.1/V4.2/V5.0 or 2.5\" SCSI2SD for Apple Powerbook";
case 0x3003:
return true; //"3.5\" SCSI2SD V5.1";
+ case 0x3004:
+ return true; //"3.5\" SCSI2SD V5.2";
case 0x0055:
return false; //"External DB25 SCSI2SD";
}
data[0] = 0; // report ID
this.debugHidDevice.read(data, 5000);
- this.firmwareVersion = (data[62] << 8) | data[63];
+ this.firmwareVersion = (HidPacketProtocol.uint8ToInt(data[62]) << 8) | HidPacketProtocol.uint8ToInt(data[63]);
this.sDCapacity =
(HidPacketProtocol.uint8ToInt(data[58]) << 24) |
(HidPacketProtocol.uint8ToInt(data[59]) << 16) |
(HidPacketProtocol.uint8ToInt(data[61]));
}
+ private void readDeviceList()
+ {
+ byte[] cmd = {
+ (byte)Commands.DEV_LIST.ordinal()
+ };
+
+ byte[] response = protocolDevice.sendHIDPacket(cmd, 1);
+ System.out.print("Found storage devices: ");
+ System.out.println(HidPacketProtocol.uint8ToInt(response[0]));
+
+ for (int i = 1; i + 4 < response.length; i += 5) {
+ OUTPUT THE TYPE AS WELL
+ int capacity = (HidPacketProtocol.uint8ToInt(response[i + 1]) << 24) |
+ (HidPacketProtocol.uint8ToInt(response[i + 2]) << 16) |
+ (HidPacketProtocol.uint8ToInt(response[i + 3]) << 8) |
+ (HidPacketProtocol.uint8ToInt(response[i + 4]));
+ System.out.print("Found storage device with capacity: ");
+ System.out.println(capacity * 512L);
+ }
+ }
+
+
@Override
public int getMaxDisks()
{