1
0
mirror of https://github.com/mik3y/usb-serial-for-android.git synced 2026-08-11 08:22:52 +00:00

fix typos

This commit is contained in:
Kai Morich
2026-04-13 20:04:43 +02:00
parent a8b9ecc7d3
commit 1fa516372f
6 changed files with 20 additions and 20 deletions
@@ -125,7 +125,7 @@ public class TerminalFragment extends Fragment implements SerialInputOutputManag
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_terminal, container, false);
receiveText = view.findViewById(R.id.receive_text); // TextView performance decreases with number of spans
receiveText.setTextColor(getResources().getColor(R.color.colorRecieveText)); // set as default color to reduce number of spans
receiveText.setTextColor(getResources().getColor(R.color.colorReceiveText)); // set as default color to reduce number of spans
receiveText.setMovementMethod(ScrollingMovementMethod.getInstance());
TextView sendText = view.findViewById(R.id.send_text);
View sendBtn = view.findViewById(R.id.send_btn);
@@ -4,7 +4,7 @@
<color name="colorPrimaryDark">#61671B</color>
<color name="colorAccent">#D8E33B</color>
<color name="colorRecieveText">#00FF00</color>
<color name="colorReceiveText">#00FF00</color>
<color name="colorSendText">#82CAFF</color>
<color name="colorStatusText">#FFDB58</color>
</resources>
@@ -372,18 +372,18 @@ public class DeviceTest {
int minBaudRate = ProlificSerialPortWrapper.isDeviceTypeT(usb.serialPort) ? 6 : 46;
try {
usb.setParameters(minBaudRate-1, 8, 1, UsbSerialPort.PARITY_NONE);
fail("baud rate to low expected");
fail("baud rate too low expected");
} catch(UnsupportedOperationException ignored) {}
usb.setParameters(minBaudRate, 8, 1, UsbSerialPort.PARITY_NONE);
usb.setParameters(384_000_000, 8, 1, UsbSerialPort.PARITY_NONE);
try {
usb.setParameters(384_000_001, 8, 1, UsbSerialPort.PARITY_NONE);
fail("baud rate to high expected");
fail("baud rate too high expected");
} catch(UnsupportedOperationException ignored) {}
usb.setParameters(11_636_363, 8, 1, UsbSerialPort.PARITY_NONE);
try {
usb.setParameters(11_636_364, 8, 1, UsbSerialPort.PARITY_NONE);
fail("baud rate deviation to high expected");
fail("baud rate deviation too high expected");
} catch(UnsupportedOperationException ignored) {}
for(int baudRate : baudRates) {
@@ -428,7 +428,7 @@ public class DeviceTest {
usb.open();
try {
usb.setParameters(183, 8, 1, UsbSerialPort.PARITY_NONE);
fail("baud rate to low expected");
fail("baud rate too low expected");
} catch (UnsupportedOperationException ignored) {
}
usb.setParameters(184, 8, 1, UsbSerialPort.PARITY_NONE);
@@ -459,7 +459,7 @@ public class DeviceTest {
usb.setParameters(3000000, 8, 1, UsbSerialPort.PARITY_NONE);
try {
usb.setParameters(4000000, 8, 1, UsbSerialPort.PARITY_NONE);
fail("baud rate to high expected");
fail("baud rate too high expected");
} catch (UnsupportedOperationException ignored) {
}
}
@@ -914,7 +914,7 @@ public class DeviceTest {
public void writeTimeout() throws Exception {
// serial processing to slow for tests below, but they anyway only check shared code in CommonUsbSerialPort
Assume.assumeFalse(usb.serialDriver instanceof CdcAcmSerialDriver);
// write buffer size detection unreliable as baud rate to high
// write buffer size detection unreliable as baud rate too high
Assume.assumeFalse(usb.serialDriver instanceof Cp21xxSerialDriver && usb.serialDriver.getPorts().size() > 1);
usb.open();
@@ -2513,12 +2513,12 @@ public class DeviceTest {
try {
byte[] buffer = new byte[0];
usb.serialPort.read(buffer, UsbWrapper.USB_READ_WAIT);
fail("read buffer to small expected");
fail("read buffer too small expected");
} catch(IllegalArgumentException ignored) {}
try {
byte[] buffer = new byte[1];
usb.serialPort.read(buffer, 0, UsbWrapper.USB_READ_WAIT);
fail("read length to small expected");
fail("read length too small expected");
} catch(IllegalArgumentException ignored) {}
// use driver that does not override base class
@@ -276,7 +276,7 @@ public abstract class CommonUsbSerialPort implements UsbSerialPort {
int readMax = (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) ? length : Math.min(length, MAX_READ_SIZE);
nread = mConnection.bulkTransfer(mReadEndpoint, dest, readMax, timeout);
// Android error propagation is improvable:
// nread == -1 can be: timeout, connection lost, buffer to small, ???
// nread == -1 can be: timeout, connection lost, buffer too small, ???
if(nread == -1 && testConnection)
testConnection(MonotonicClock.millis() < endTime);
@@ -307,7 +307,7 @@ public abstract class CommonUsbSerialPort implements UsbSerialPort {
}
nread = Objects.requireNonNull(buf).position();
// Android error propagation is improvable:
// response != null & nread == 0 can be: connection lost, buffer to small, ???
// response != null & nread == 0 can be: connection lost, buffer too small, ???
if(nread == 0) {
testConnection(true);
}
@@ -364,7 +364,7 @@ public abstract class CommonUsbSerialPort implements UsbSerialPort {
if (actualLength <= 0) {
String msg = "Error writing " + requestLength + " bytes at offset " + offset + " of total " + src.length + " after " + elapsed + "msec, rc=" + actualLength;
if (timeout != 0) {
// could be buffer full because: writing to fast, stopped by flow control
// could be buffer full because: writing too fast, stopped by flow control
testConnection(elapsed < timeout, msg);
throw new SerialTimeoutException(msg, offset);
} else {
@@ -194,7 +194,7 @@ public class FtdiSerialDriver implements UsbSerialDriver {
private void setBaudrate(int baudRate) throws IOException {
int divisor, subdivisor, effectiveBaudRate;
if (baudRate > 3500000) {
throw new UnsupportedOperationException("Baud rate to high");
throw new UnsupportedOperationException("Baud rate too high");
} else if(baudRate >= 2500000) {
divisor = 0;
subdivisor = 0;
@@ -209,7 +209,7 @@ public class FtdiSerialDriver implements UsbSerialDriver {
subdivisor = divisor & 0x07;
divisor >>= 3;
if (divisor > 0x3fff) // exceeds bit 13 at 183 baud
throw new UnsupportedOperationException("Baud rate to low");
throw new UnsupportedOperationException("Baud rate too low");
effectiveBaudRate = (24000000 << 1) / ((divisor << 3) + subdivisor);
effectiveBaudRate = (effectiveBaudRate +1) >> 1;
}
@@ -356,7 +356,7 @@ public class FtdiSerialDriver implements UsbSerialDriver {
int result = mConnection.controlTransfer(REQTYPE_HOST_TO_DEVICE, MODEM_CONTROL_REQUEST,
value ? MODEM_CONTROL_RTS_ENABLE : MODEM_CONTROL_RTS_DISABLE, mPortNumber+1, null, 0, USB_WRITE_TIMEOUT_MILLIS);
if (result != 0) {
throw new IOException("Set DTR failed: result=" + result);
throw new IOException("Set RTS failed: result=" + result);
}
rts = value;
}
@@ -327,7 +327,7 @@ public class ProlificSerialDriver implements UsbSerialDriver {
mStopReadStatusThread = true;
mReadStatusThread.join();
} catch (Exception e) {
Log.w(TAG, "An error occured while waiting for status read thread", e);
Log.w(TAG, "An error occurred while waiting for status read thread", e);
}
mStopReadStatusThread = false;
mReadStatusThread = null;
@@ -376,7 +376,7 @@ public class ProlificSerialDriver implements UsbSerialDriver {
baseline = 12000000 * 32;
mantissa = baseline / baudRate;
if (mantissa == 0) { // > unrealistic 384 MBaud
throw new UnsupportedOperationException("Baud rate to high");
throw new UnsupportedOperationException("Baud rate too high");
}
exponent = 0;
if (mDeviceType == DeviceType.DEVICE_TYPE_T) {
@@ -385,7 +385,7 @@ public class ProlificSerialDriver implements UsbSerialDriver {
mantissa >>= 1; /* divide by 2 */
exponent++;
} else { // < 7 baud
throw new UnsupportedOperationException("Baud rate to low");
throw new UnsupportedOperationException("Baud rate too low");
}
}
buf = mantissa + ((exponent & ~1) << 12) + ((exponent & 1) << 16) + (1 << 31);
@@ -396,7 +396,7 @@ public class ProlificSerialDriver implements UsbSerialDriver {
mantissa >>= 2; /* divide by 4 */
exponent++;
} else { // < 45.8 baud
throw new UnsupportedOperationException("Baud rate to low");
throw new UnsupportedOperationException("Baud rate too low");
}
}
buf = mantissa + (exponent << 9) + (1 << 31);