Skip to content

Commit

Permalink
Finalizing library after tests
Browse files Browse the repository at this point in the history
- just some clean in UsbMassStorageDevice
  • Loading branch information
andy.rozman committed Apr 15, 2024
1 parent c4e8c00 commit 54f6a6c
Showing 1 changed file with 1 addition and 97 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -71,88 +71,6 @@
@Slf4j
public class UsbMassStorageDevice {

/**
* Usb communication which uses the newer API in Android Jelly Bean MR2 (API
* level 18). It just delegates the calls to the {@link UsbDeviceConnection}
* .
*
* @author mjahnen
*
*/
// @TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR2)
// private class JellyBeanMr2Communication implements UsbCommunication {
// @Override
// public int bulkOutTransfer(byte[] buffer, int length) {
// return deviceConnection.bulkTransfer(outEndpoint, buffer, length, TRANSFER_TIMEOUT);
// }
//
// @Override
// public int bulkOutTransfer(byte[] buffer, int offset, int length) {
// return deviceConnection.bulkTransfer(outEndpoint, buffer, offset, length,
// TRANSFER_TIMEOUT);
// }
//
// @Override
// public int bulkInTransfer(byte[] buffer, int length) {
// return deviceConnection.bulkTransfer(inEndpoint, buffer, length, TRANSFER_TIMEOUT);
// }
//
// @Override
// public int bulkInTransfer(byte[] buffer, int offset, int length) {
// return deviceConnection.bulkTransfer(inEndpoint, buffer, offset, length,
// TRANSFER_TIMEOUT);
// }
// }

/**
* On Android API level lower 18 (Jelly Bean MR2) we cannot specify a start
* offset in the source/destination array. Because of that we have to use
* this workaround, where we have to copy the data every time offset is non
* zero.
*
* @author mjahnen
*
*/
// private class HoneyCombMr1Communication implements UsbCommunication {
// @Override
// public int bulkOutTransfer(byte[] buffer, int length) {
// return deviceConnection.bulkTransfer(outEndpoint, buffer, length, TRANSFER_TIMEOUT);
// }
//
// @Override
// public int bulkOutTransfer(byte[] buffer, int offset, int length) {
// if (offset == 0)
// return deviceConnection.bulkTransfer(outEndpoint, buffer, length, TRANSFER_TIMEOUT);
//
// byte[] tmpBuffer = new byte[length];
// System.arraycopy(buffer, offset, tmpBuffer, 0, length);
// return deviceConnection.bulkTransfer(outEndpoint, tmpBuffer, length,
// TRANSFER_TIMEOUT);
// }
//
// @Override
// public int bulkInTransfer(byte[] buffer, int length) {
// return deviceConnection.bulkTransfer(inEndpoint, buffer, length, TRANSFER_TIMEOUT);
// }
//
// @Override
// public int bulkInTransfer(byte[] buffer, int offset, int length) {
// if (offset == 0)
// return deviceConnection.bulkTransfer(inEndpoint, buffer, length, TRANSFER_TIMEOUT);
//
// byte[] tmpBuffer = new byte[length];
// int result = deviceConnection.bulkTransfer(inEndpoint, tmpBuffer, length,
// TRANSFER_TIMEOUT);
// System.arraycopy(tmpBuffer, 0, buffer, offset, length);
// return result;
// }
// }



private static int TRANSFER_TIMEOUT = 21000;


UsbMassStorageDeviceConfig usbMassStorageDeviceConfig;

@Getter
Expand All @@ -163,7 +81,7 @@ public class UsbMassStorageDevice {
// this two parameters will be overwritten with values
private boolean loadPartitionTable = true;

Usb4JavaUsbDeviceCommunication communication;
private Usb4JavaUsbDeviceCommunication communication;
private boolean connectedToDevice;

/**
Expand Down Expand Up @@ -299,7 +217,6 @@ public static List<UsbMassStorageDeviceConfig> getListOfAttachedUsbMassStorageDe
}



/**
* Initializes the mass storage device and determines different things like
* for example the MBR or the file systems for the different partitions.
Expand Down Expand Up @@ -340,8 +257,6 @@ private void setupDevice() throws LibAumsException {
partitionTable = PartitionTableFactory.createPartitionTable(blockDevice);
initPartitions();
}


}

/**
Expand Down Expand Up @@ -384,16 +299,5 @@ public List<Partition> getPartitions() {
return partitions;
}

/**
* This returns the @link android.hardware.usb.UsbDevice which can be used
* to request permission for communication.
*
// @return Underlying @link android.hardware.usb.UsbDevice used for
* communication.
*/
// public UsbDevice getUsbDevice() {
// return usbDevice;
// }


}

0 comments on commit 54f6a6c

Please sign in to comment.