NXDT-related updates

master v4.3
Dmitry Isaenko 2020-09-02 00:28:38 +03:00
parent ba4afa0046
commit adabfbe860
2 changed files with 13 additions and 15 deletions

View File

@ -32,11 +32,11 @@ Sometimes I add new posts about this project [on my home page](https://developer
* Information, ideas and data from ['fusee-launcher'](https://github.com/reswitched/fusee-launcher) application
* [Apache Commons CLI](https://commons.apache.org/proper/commons-cli/)
#### List of awesome contributors!
### List of awesome code contributors, translators and other great people!
* [Pablo Curiel (DarkMatterCore)](https://github.com/DarkMatterCore)
* [wolfposd](https://github.com/wolfposd)
#### Thanks for the great work done by our translators!
* French by [Stephane Meden (JackFromNice)](https://github.com/JackFromNice)
* Italian by [unbranched](https://github.com/unbranched)

View File

@ -287,11 +287,9 @@ class NxdtUsbAbi1 {
long received = 0;
int bufferSize;
boolean zlt_expected = isAligned(size);
while (received < size) {
while (received+NXDT_FILE_CHUNK_SIZE < size) {
//readBuffer = readUsbFile();
readBuffer = readUsbFileDebug();
readBuffer = readUsbFileDebug(NXDT_FILE_CHUNK_SIZE);
bos.write(readBuffer);
if (isWindows10)
fd.sync();
@ -300,20 +298,20 @@ class NxdtUsbAbi1 {
logPrinter.updateProgress((double)received / (double)size);
}
if (zlt_expected) {
logPrinter.print("Finishing with ZLT packet request", EMsgType.INFO);
//readUsbFile();
readUsbFileDebug();
}
int lastChunkSize = (int)(size - received) + 1;
readBuffer = readUsbFileDebug(lastChunkSize);
bos.write(readBuffer);
if (isWindows10)
fd.sync();
} finally {
logPrinter.updateProgress(1.0);
}
}
/** Handle Zero-length terminator **/
/* Handle Zero-length terminator
private boolean isAligned(long size){
return ((size & (endpointMaxPacketSize - 1)) == 0);
}
*/
/** Sending any byte array to USB device **/
private void writeUsb(byte[] message) throws Exception{
@ -397,8 +395,8 @@ class NxdtUsbAbi1 {
throw new InterruptedException();
}
private byte[] readUsbFileDebug() throws Exception {
ByteBuffer readBuffer = ByteBuffer.allocateDirect(NXDT_FILE_CHUNK_SIZE);
private byte[] readUsbFileDebug(int chunkSize) throws Exception {
ByteBuffer readBuffer = ByteBuffer.allocateDirect(chunkSize);
IntBuffer readBufTransferred = IntBuffer.allocate(1);
if (parent.isCancelled())
throw new InterruptedException();