cbw.setLun((byte) 0);
cbw.setLength((byte) scsiCmd.length);
cbw.setCdb(scsiCmd);
log.debug(cbw.toString());
// Sent CBW to device
USBDataPipe outPipe = ((USBDataPipe) storageDeviceData.getBulkOutEndPoint().getPipe());
USBRequest req = outPipe.createRequest(cbw);
if (timeout <= 0) {
outPipe.asyncSubmit(req);
} else {
outPipe.syncSubmit(req, timeout);
}
//
CSW csw = new CSW();
csw.setSignature(US_BULK_CS_SIGN);
USBDataPipe inPipe = ((USBDataPipe) storageDeviceData.getBulkInEndPoint().getPipe());
USBRequest resp = inPipe.createRequest(csw);
if (timeout <= 0) {
inPipe.asyncSubmit(resp);
} else {
inPipe.syncSubmit(resp, timeout);
}
} catch (USBException e) {
e.printStackTrace();
}
}