mirror of
https://github.com/mik3y/usb-serial-for-android
synced 2025-06-07 16:06:10 +00:00
parent
f6f7e2600a
commit
ef13784f4f
@ -210,7 +210,7 @@ public class FtdiSerialDriver implements UsbSerialDriver {
|
|||||||
* @return The number of payload bytes
|
* @return The number of payload bytes
|
||||||
*/
|
*/
|
||||||
private final int filterStatusBytes(byte[] src, byte[] dest, int totalBytesRead, int maxPacketSize) {
|
private final int filterStatusBytes(byte[] src, byte[] dest, int totalBytesRead, int maxPacketSize) {
|
||||||
final int packetsCount = totalBytesRead / maxPacketSize + 1;
|
final int packetsCount = totalBytesRead / maxPacketSize + (totalBytesRead % maxPacketSize == 0 ? 0 : 1);
|
||||||
for (int packetIdx = 0; packetIdx < packetsCount; ++packetIdx) {
|
for (int packetIdx = 0; packetIdx < packetsCount; ++packetIdx) {
|
||||||
final int count = (packetIdx == (packetsCount - 1))
|
final int count = (packetIdx == (packetsCount - 1))
|
||||||
? (totalBytesRead % maxPacketSize) - MODEM_STATUS_HEADER_LENGTH
|
? (totalBytesRead % maxPacketSize) - MODEM_STATUS_HEADER_LENGTH
|
||||||
|
Loading…
x
Reference in New Issue
Block a user