Skip to content

Commit

Permalink
- removed some classes
Browse files Browse the repository at this point in the history
  • Loading branch information
andy.rozman committed Apr 12, 2024
1 parent dab26ec commit 8608754
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 234 deletions.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@

import com.atech.library.usb.libaums.UsbMassStorageLibrary;
import com.atech.library.usb.libaums.data.LibAumsException;
import com.atech.library.usb.libaums.data.UsbMassStorageDeviceConfig;
import com.atech.library.usb.libaums.usb.device.ATUsbConfigurationDescriptor;
import com.atech.library.usb.libaums.usb.device.ATUsbDevice;
import com.atech.library.usb.libaums.usb.device.ATUsbDeviceDescriptor;
Expand Down Expand Up @@ -94,6 +95,7 @@ public static List<ATUsbDevice> getFullDeviceList(int...excludeClass) throws Lib
return outList;
}


/**
* Get Device
* @param device Device instance
Expand Down Expand Up @@ -169,18 +171,17 @@ public static ATUsbDevice getDevice(Device device, boolean details, DeviceHandle
return usbDevice;
}

public static List<ATUsbConfigurationDescriptor> getConfigurationDescriptors(final Device device,
private static List<ATUsbConfigurationDescriptor> getConfigurationDescriptors(final Device device,
final int numConfigurations,
DeviceHandle handle)
{
DeviceHandle handle) {
List<ATUsbConfigurationDescriptor> list = new ArrayList<>();
for (byte i = 0; i < numConfigurations; i += 1)
{

for (byte i = 0; i < numConfigurations; i += 1) {
final ConfigDescriptor descriptor = new ConfigDescriptor();
final int result = LibUsb.getConfigDescriptor(device, i, descriptor);

if (result < 0) {
throw new LibUsbException("Unable to read config descriptor",
result);
throw new LibUsbException("Unable to read config descriptor", result);
}

try
Expand All @@ -201,33 +202,26 @@ public static List<ATUsbConfigurationDescriptor> getConfigurationDescriptors(fin
return list;
}

public void getDeviceDetails(UsbMassStorageDeviceConfig usbDeviceSettings) throws LibAumsException {

UsbMassStorageLibrary.initLibrary();

// open device
DeviceHandle handle = LibUsb.openDeviceWithVidPid(null, usbDeviceSettings.getVendorId(),
usbDeviceSettings.getProductId());

if (handle == null) {
log.error("Device {} not found.", usbDeviceSettings.getReadableDeviceId());
throw LibAumsException.createWithLibUsbException("Device " + usbDeviceSettings.getReadableDeviceId() + " not found.", -1);
}

Device device = LibUsb.getDevice(handle);

getDevice(device, true, handle, null);

// static UsbServices services;
//
// public static List<UsbDevice> getUsbDevices() throws UsbException {
// if (services==null) {
// services = UsbHostManager.getUsbServices();
// }
//
// return discoverDevices(services.getRootUsbHub());
// }
//
// public static List<UsbDevice> discoverDevices(UsbHub usbHub) {
// List<UsbDevice> deviceList = new ArrayList<>();
// for (Object attachedUsbDevice : usbHub.getAttachedUsbDevices()) {
// UsbDevice device = (UsbDevice) attachedUsbDevice;
//
// if (device.isUsbHub()) {
// deviceList.addAll(discoverDevices((UsbHub)device));
// } else {
// deviceList.add(device);
// }
// }
// return deviceList;
// }
// Close the device
LibUsb.close(handle);

}

}

0 comments on commit 8608754

Please sign in to comment.