Wykres commitów

171 Commity (master)

Autor SHA1 Wiadomość Data
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 1f35587739 target-sdk + dependency update 2022-04-19 20:55:34 +02:00
Doug MacEwen a2fa5f010a Specify Support is only for Micropython 2022-02-11 11:32:51 -08:00
Doug MacEwen 49ee2d3c8e Add support for Raspberry Pi Pico 2022-02-08 16:08:49 -08:00
kai-morich bdfb7d5f6c reordered public members 2021-09-26 08:09:39 +02:00
kai-morich 76f9198c02 more configurable debug log, disabled by default (#389) 2021-09-26 08:02:20 +02:00
kai-morich d319879386 jitpack with gradle 7 2021-09-21 20:38:32 +02:00
kai-morich 12095f6b94 coverage for PL2303 variants 2021-08-17 22:51:26 +02:00
kai-morich 21cf775281 fix PL2303G product IDs (#383) 2021-08-17 17:29:49 +02:00
kai-morich 18e300efa3 add dedicated handling for Ch34x baud rate 921600 2021-07-28 17:49:35 +02:00
kai-morich 7ffbc73919 restore FT2232C support 2021-07-01 07:45:24 +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 22a685e738 target-sdk-version update from 29 to 30 2021-05-09 08:50:29 +02:00
kai-morich 38527730cd
Merge pull request #289 from rusefi/st_cdc
ST CDC
2021-05-08 19:22:38 +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 b6e9dbe40f generate unit test coverage xml for codecov upload 2021-03-26 20:25:59 +01: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
Daniel Hugenroth b8c3057967 Use monotonic clock for timeouts 2021-03-16 22:39:00 +00:00
kai-morich c06ccf70bc really set thread priority in SerialInputOutputManager (#349) 2021-02-27 13:59:30 +01:00
kai-morich cbed086279 fix write timeout calculation 2021-02-14 14:16:25 +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 5519182256
Merge pull request #339 from ybs-github/master
catch exception thrown by `close()` inside `open()`
2021-01-10 10:04:27 +01:00
Ilja 911cf96ba0
Debug mode disable
Ability to disable DEBUG Logging for in/out bytes.
2020-12-16 14:24:43 +02:00
Yehezkiel Syamsuhadi ebc8d791fc catch exception thrown by `close()` 2020-12-14 10:23:29 +11:00
kai-morich 115fb407b4 coverage fix, gradle update 2020-10-14 20:36:49 +02: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 d63a24762d mention other CP210x devices, remove CP2110 which is a HID device 2020-09-22 07:52:18 +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 2d13b90f59 move from LGPL to MIT license (#244)
moving away from LGPL possible, as the FTDI driver is rewritten and not based any more on LGPL code from libftdi.
2020-07-29 11:03:26 +02:00
kai-morich e496195bd9 rewrite ftdi driver without LGPL code from libftdi 2020-07-27 17:39:01 +02:00
kai-morich e0ed25b85f CH341A readme update 2020-07-27 17:38:16 +02:00
kai-morich 963729924b mention close of UsbDeviceConnection in javadoc comment 2020-07-21 08:20:22 +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
kai-morich 06d1041738 added CH341A support 2020-06-27 08:46:23 +02:00
rusefi aee7fc1b9d ST CDC
See https://www.the-sz.com/products/usbid/index.php?v=0483&p=&n=
2020-06-24 20:38:52 -04:00
kai-morich 735fa3d70f make all SerialPort classes public
and test FtdiSerialPort methods
2020-06-10 19:09:34 +02:00
Behxhet Sadiku 37324c6b0f Expose isOpen on CommonUsbSerialPort 2020-05-19 20:50:42 +02:00
kai-morich cffe54e15c test control lines 2020-03-21 18:01:05 +01:00
Kai Morich 5096d6940c relax CH340 initialization
controlIn(0x95, 0x0706) result includes control line values
2020-03-08 16:06:44 +01:00
kai-morich 2cad1fd5a2 fix CP2102N initialization
do not send SET_BAUDDIV command. It fails on CP2102N and CP2102/5 work without
2020-03-01 13:54:35 +01:00
kai-morich 2a77ebf8b9 fix ch340 initialization 2020-02-03 20:36:56 +01:00
kai-morich bbed92eafb support multi-port CDC devices 2020-01-10 08:02:56 +01:00
kai-morich ce97a3408b reuse UsbRequest
less LogCat output
2019-12-13 21:13:48 +01:00
kai-morich 7b578918b0 support FTDI control lines for multi-port devices 2019-11-23 13:24:28 +01:00
uholeschak 6b32e25e9c Fixed modem status
Signed-off-by: kai-morich <mail@kai-morich.de>
2019-11-23 13:23:10 +01:00
uholeschak 21e96594d2 Added missing functions: - latency timer - modem lines
Signed-off-by: kai-morich <mail@kai-morich.de>
2019-11-23 13:22:42 +01:00
kai-morich e2e9df8463 reimplement read timeout 2019-11-15 21:45:22 +01:00
kai-morich 669ab48e0f resolve merge issue 2019-11-15 07:51:03 +01:00
Tim Vahlbrock 89ad5be9c3 Improved DTR and RTS support. DTR and RTS can now be queried after transmission. Added usage of existing methods and new constants. 2019-11-14 14:44:39 +01:00
Tim Vahlbrock 92b16a8c24 Merge branch 'master' of https://github.com/mik3y/usb-serial-for-android 2019-11-14 14:15:39 +01:00
kai-morich fd2055791a added proguard rules
now they are part of the .aar library, before you had to add them to each release app
2019-11-13 18:49:27 +01:00
kai-morich 24187b3af6 refactor duplicated code in close method 2019-11-09 22:48:00 +01:00
kai-morich 5767298636 refactor duplicated read/write methods 2019-11-09 20:26:50 +01:00
kai-morich e1b62cf675 write + purge tests, remove unused read buffer code 2019-11-03 19:34:14 +01:00
kai-morich 5c6748e1b8 improve setParameter() error handling
harmonize exception messages, more UI friendly messages
distinguish IllegalArgumentException and UnsupportedOperationException
2019-11-02 13:49:08 +01:00
kai-morich 18b5b6e648 unify open() error handling, more tests, minor cleanup 2019-11-02 13:09:15 +01:00
kai-morich 6869eff88a revert previous usbRequest.cancel() removal
Combine usbRequest.cancel() and releaseInterface to interrupt read() and terminate SerialInputOutputManager.
UsbRequest.cancel() immediately interrupts read() on newer Android versions.
With releaseInterface() only, some hickup are observed on fast reconnect.
Keep releaseInterface() as only this interrupts read() on older Androids.
2019-11-02 12:46:45 +01:00
Tim Vahlbrock 7eaea45068 Added DTR and RTS support for cp21xx driver 2019-10-28 13:20:34 +01:00
kai-morich 9ea936b14a improve close handling
Use releaseInterface to interrupt read() and terminate SerialInputOutputManager. Previously some drivers used usbRequest.cancel() but this does not interrupt read() on older Android.

Added connection check to read(). Before Android 8.0 request.initialize() did not check usbConnection, which can lead to native crash if NULL
2019-10-27 21:32:38 +01:00
Kai Morich b3631dff58 README with SerialInputOutputManager for read() and port for write()
test the usually not used read/write variants
2019-10-26 21:32:28 +02:00
Kai Morich 800381e370 CdcAcm driver: cancel read() on close() 2019-10-26 20:37:06 +02:00
Kai Morich fac8c9f340 test nonstandard baud rates 2019-10-26 15:40:40 +02:00
Kai Morich f7399c2aad more coverage tests
purgeHwBuffers: adjust parameter names to match read/write methods and actual behavior
2019-10-25 22:23:00 +02:00
Kai Morich 37059b1a27 reduce non covered code
move HexDump class from library to example
remove unused UsbSerialRuntimeException
2019-10-21 21:04:58 +02:00
Kai Morich 54a3db115f show code coverage 2019-10-20 22:41:55 +02:00
Kai Morich 2bee5b930b build with jitpack 2019-10-06 17:52:17 +02:00
Kai Morich 0d48ed04e7 Always use async read, as bulkTransfer can cause data loss. Increase API version to 17 because async read only works reliably since Android 4.2 (http://b.android.com/28023) 2019-10-05 10:35:15 +02:00
Kai Morich e527afdf35 compile+target sdk 28, gradle 4.6 2019-10-05 10:35:15 +02:00
Kai Morich 61b272b8b6 support ft_232h, cp210_ multiport devices
harmonize claimInterface() error handling
cancel read() on close()
2019-10-05 10:27:11 +02:00
Kai Morich 0ea5b282b7 implement async read for all devices 2019-10-05 10:27:11 +02:00
Kai Morich adb22f718e build tools update; instrumented device test 2019-10-05 10:27:11 +02:00
kai-morich c89ca2c96a
Merge pull request #195 from kai-morich/ch340-parameter
CH34x: data bits, parity, stop bits
2019-10-04 16:50:16 +02:00
kai-morich d7147201de
Merge pull request #188 from kai-morich/ch340-async
enable async read for CH340 as in CDC driver to prevent data loss at high baud rates
2019-10-04 16:49:50 +02:00
kai-morich eb2de17af8
Merge pull request #170 from kai-morich/ftdi-async
enable async read for FTDI + prevent loss of last packet if full
2019-10-04 16:49:03 +02:00
kai-morich deabc510c1
Merge pull request #189 from kai-morich/cdc-endpoints
support USB devices with other non CDC related endpoints, e.g. when u…
2019-10-04 16:48:03 +02:00
Kai Morich 9c1ca288ae CH34x: data bits, parity, stop bits
CP21xx: mark+space
all devices: return error on unsupported parameters
2018-01-20 13:09:29 +01:00
Kai Morich df4e9174cb enable async read for CH340 as in CDC driver to prevent data loss at high baud rates 2017-11-03 22:52:32 +01:00