Kai Morich
06faad5622
CDC device tests with MCP2221
2025-04-18 08:18:33 +02:00
Kai Morich
026355f61e
terminate SerialInputOutputManager write thread if read thread terminates (e.g. port closed)
2025-02-15 18:02:15 +01:00
Dmitry Kaukov
9911e141a7
01. Refactored SerialInputOutputManager ( #615 )
...
Used separate threads for reading and writing, enhancing concurrency and performance.
Note: before was possible to start `SerialInputOutputManager` with `Executors.newSingleThreadExecutor().submit(ioManager)`. Now you have to use `ioManager.start()`
2025-01-28 21:26:09 +01:00
Kai Morich
f5380975ce
values supported by default setFlowControl() consistent with getSupportedFlowControl()
2024-07-12 09:29:08 +02:00
Kai Morich
88ca3f57c4
flowcontrol for ftdi, pl2303, cp210x
2024-07-05 21:18:37 +02:00
Kai Morich
b6e1833270
test coverage
2024-06-02 14:52:39 +02:00
Kai Morich
0c0275675f
SerialInputOutputManager.writeAsync(): handle SerialTimeoutException
2024-06-01 14:46:38 +02:00
Kai Morich
28506a9bf9
assert warning cleanup
2024-05-03 08:47:22 +02:00
Kai Morich
8b9ad7efdf
improved error handling for read() with concurrent close() ( #569 )
...
- isOpen() returns false during concurrent close()
- less tracing in SerialInputOutputManager
2024-04-25 18:24:28 +02:00
Kai Morich
26a2f9363e
target sdk 34
...
Pending intent and broadcast receiver changed according to sdk 34 release notes.
Permisssion dialog now shown while fragment is paused.
2024-02-18 13:30:50 +01:00
kai-morich
b06118b156
consolidate get[Supported]ControlLines
2023-10-02 19:05:55 +02:00
kai-morich
35fdeb1e13
improved exception type also for read with timeout
2023-08-24 19:51:47 +02:00
kai-morich
6c648e9f56
have to use MUTABLE to get GRANTED flag at intent extras
2023-03-11 17:42:12 +01:00
kai-morich
fbe64fe4be
gradle update, coverage working again
2023-03-11 17:42:12 +01:00
kai-morich
ab27c19dc3
sdk 31 fixes: pending intent mutability
2022-07-21 21:59:36 +02:00
kai-morich
cf9bada887
use optimal write buffer size by default + revert gradle update
...
write buffer: SerialTimeoutException from write() has valid ex.bytesTransferred
gradle 7.1.x creates empty coverage results
2022-04-26 21:40:49 +02:00
kai-morich
b853ac773c
test concurrent access on multi-port devices
2022-04-19 22:17:23 +02:00
kai-morich
76f9198c02
more configurable debug log, disabled by default ( #389 )
2021-09-26 08:02:20 +02:00
kai-morich
12095f6b94
coverage for PL2303 variants
2021-08-17 22:51:26 +02:00
kai-morich
18e300efa3
add dedicated handling for Ch34x baud rate 921600
2021-07-28 17:49:35 +02:00
kai-morich
c82cd284ae
support PL2303GC/GB/GT/GL/GE/GS
...
see https://lore.kernel.org/linux-usb/20190213123000.4656-1-charlesyeh522@gmail.com/
2021-05-13 20:55:15 +02:00
kai-morich
2f23bdfb6d
custom baud rates for PL2303TA/TB
...
see https://lore.kernel.org/r/3aee5708-7961-f464-8c5f-6685d96920d6@IEEE.org
2021-05-11 17:30:09 +02:00
kai-morich
5f94a47b63
read w/o timeout now only throws exception on connection lost
...
partly revert f4166f34
, as there might be unkown reasons for empty response
2021-04-20 22:53:53 +02:00
kai-morich
128d1a00b1
new SerialInputOutputManager.start() method
...
Previously recommended start action `Executors.newSingleThreadExecutor().submit(ioManager)` did not shutdown the Executor, which caused a thread leak. It's still possible to use old style start, as SerialInputOutputManager continues to implement Runnable interface.
2021-04-16 21:55:22 +02:00
kai-morich
848d4e7713
SerialInputOutputManager: use optimal read buffer size to reduce latency for FTDI and CH34x
2021-04-04 20:55:41 +02:00
kai-morich
f1d73c04dc
fixed some warnings
2021-04-02 20:28:41 +02:00
kai-morich
f4166f34a0
read w/o timeout now throws exception on connection lost or buffer to small
...
SerialInputOutputManager already returned connection lost exception, as the next read failed
2021-03-26 18:11:23 +01:00
kai-morich
4ffcc8d0fb
simplify write timeout handling
2021-02-13 21:07:21 +01:00
kai-morich
f60414f8ec
improve write timeout handling
...
Return type of write() method changed to void. The return value was redundant before, as it always was the request length or an exception was thrown.
If timeout is reached, write() now throws a SerialTimeoutException with ex.bytesTransferred filled with known transferred bytes.
Added CommonUsbSerialPort.getReadEndpoint() and .getWriteEndpoint() to assist in setting the optimal write buffer size with port.setWriteBufferSize(port.getWriteEndpoint().getMaxPacketSize()).
By default the write buffer size is > MaxPacketSize and the Linux kernel splits writes in chunks. When the timeout occurs, it's unknown how many chunks have already been transferred and the exception typically stores 0. With optimal write buffer size, this value is known and stored in SerialTimeoutException, but due to more kernel round trips write() might take slightly longer().
2021-02-07 16:37:01 +01:00
kai-morich
85d0348844
improve error quality + test for PR #339
2021-01-31 19:58:59 +01:00
kai-morich
fc610a9764
IntDef Parity for better warnings
...
but no @Intdef for databits, stopbits as these are frequently used with numbers instead of constants
remove redundant modifiers
2021-01-16 23:21:10 +01:00
kai-morich
768f716600
new setBreak() method
2020-10-14 20:36:49 +02:00
kai-morich
1e75f91467
slightly more coverage, local coverage report, dependency update
2020-10-12 21:28:50 +02:00
kai-morich
08a93ec530
PL2303 fix initial input control line values
2020-10-07 21:40:07 +02:00
kai-morich
732e138630
PL2303(HX) support non-standard baud rates
2020-09-28 21:12:50 +02:00
kai-morich
1adf2a9b98
PL2303 throw error on unsupported baud rates
...
instead of silently falling back to 9600 baud
2020-09-27 09:03:37 +02:00
kai-morich
26999e3626
read with timeout now throws error on connection lost, e.g. device disconnected
...
and similar connection lost detection for prolific input control lines
2020-09-12 21:17:52 +02:00
kai-morich
c53c3ed0ae
check read buffer size
2020-09-06 09:48:10 +02:00
kai-morich
6f4cd0313c
FTDI read() now waits until timeout
...
previously returned after periodic FTDI status response (default 16 msec)
2020-09-05 12:00:37 +02:00
kai-morich
80e8eb8a60
iomanager with configurable threadpriority and higher default to prevent data loss
2020-08-31 22:40:28 +02:00
kai-morich
f443d1f012
iomanager with configurable buffer size
2020-08-31 22:40:28 +02:00
kai-morich
698f590d58
restored UsbId.FTDI_FT231X
...
same ID for FT230X, FT231X, FT234XD
tested with FT230X
2020-08-23 20:44:34 +02:00
kai-morich
a664082f23
throw UnsupportedOperationException instead of returning false
2020-08-01 10:06:51 +02:00
kai-morich
954295456c
rebase new FTDI baudrate test
2020-07-30 17:52:18 +02:00
kai-morich
e496195bd9
rewrite ftdi driver without LGPL code from libftdi
2020-07-27 17:39:01 +02:00
kai-morich
ce73857825
slightly more tests
2020-07-19 19:47:13 +02:00
kai-morich
8eaf3f5c5f
tests UsbDeviceConnection close behavior
...
and extract test utilities
2020-07-18 20:48:27 +02:00
kai-morich
a1e58b9843
implement CP21xx input control lines
...
open() CP21xx without RTS, DTR set
2020-07-04 15:31:58 +02:00
kai-morich
7423fd9d79
new getControlLines() and getSupportedControLines() methods
...
getControlLines() requires less USB calls than calling getRTS() + ... + getRI() individually.
getSupportedControlLines() tells you, which control lines are supported by a driver. Previously you had to check the driver implementation.
2020-06-30 18:10:02 +02:00
kai-morich
13df128226
implement CH34x input control lines
2020-06-27 11:53:12 +02:00