Commit Graph

96 Commits

Author SHA1 Message Date
poljar (Damir Jelić) 1bd9e678ac serial: Add function to extract serial options.
This patch adds a function for a common operation of all serial based drivers.
It extracts the serial options from the options linked list that is passed down
to every hardware driver.
2013-12-03 15:10:01 +01:00
Martin Ling 9647ce694b Use new libserialport blocking/nonblocking API calls. 2013-12-01 18:51:24 +01:00
Uwe Hermann c4d85a4026 serial.c: Re-enable serial_read() error reporting.
libserialport now returns 0 (not SP_ERR_FAIL) as return value when a
non-blocking read would return EAGAIN.

This fixes bug #188.
2013-11-26 16:29:43 +01:00
Martin Ling 25b66c3c61 Use new libserialport opaque configuration structure. 2013-11-26 15:53:40 +01:00
Martin Ling 3182932d36 Use accessor for new libserialport opaque port structure. 2013-11-26 15:53:40 +01:00
Matthias Heidbrink a970522b6d serial: Allow 5 and 6 data bits. 2013-11-22 02:31:17 +01:00
Martin Ling 13cd8197eb Update for libserialport v0.1 API. 2013-11-22 02:14:16 +01:00
Bert Vermeulen c4650aca12 Suppress compile warning 2013-11-20 22:06:01 +01:00
Uwe Hermann 1a54044299 serial.c: Minor cosmetic fix. 2013-11-19 20:09:59 +01:00
Martin Ling a82635f252 Use new sp_port_config fields. 2013-11-19 14:26:18 +01:00
Martin Ling e385e2ed90 serial: Use new sp_set_config instead of sp_set_params. 2013-11-19 14:26:18 +01:00
poljar (Damir Jelić) 066d42b1c8 serial: Fix leak in serial_open.
A new sp_port is created every time we call serial_open (sp_get_port_by_name
implicitly creates one for us), so free it every time we call serial_close.
2013-11-19 10:29:24 +01:00
Uwe Hermann 449cc16bb2 serial.c: Temporary quickfix until a libserialport fix is done. 2013-11-15 12:23:09 +01:00
Uwe Hermann 6a76efebc1 serial.c: Fix a few return values. 2013-11-14 23:48:28 +01:00
Uwe Hermann a0dfaa6c4c serial.c: Cosmetics, coding-style. 2013-11-14 23:48:28 +01:00
Martin Ling 0d4405ce5e Update for renamed libserialport header file. 2013-11-14 23:48:16 +01:00
Martin Ling c9bc57b6bc Update to new libserialport API. 2013-11-14 23:48:16 +01:00
Martin Ling a9bce5a561 Use libserialport for serial port access. 2013-11-14 23:48:16 +01:00
Matthias Heidbrink 50a9aba21b serial: Removed flag OPOST (turn off all output processing). 2013-10-25 19:11:15 +02:00
Matthias Heidbrink a510d55571 serial: Added flags CLOCAL (ignore modem status lines) and CREAD (start receiver). 2013-10-25 19:11:15 +02:00
Matthias Heidbrink 1b943b6d8b serial: Added flag IXANY (any char will restart) to XON/XOFF handshaking. 2013-10-25 19:11:14 +02:00
Matthias Heidbrink b21d7eebe2 serial: Changed order of flags PARENB and PARODD in deletion to same order as in setting (cosmetic). 2013-10-18 16:58:33 +02:00
Daniel Thompson 5715e84fe3 serial: Only sleep when no characters are received.
g_usleep(XX) sleeps for *at least* XX microseconds but may sleep for
longers (on older kernels the sleep will typically be 10000us). Thus
byte receive loops containing an unconditional sleep will perform
very poorly (for example it causes the scan in agilent-dmm to timeout
prematurely).

Even on modern kernels serial_readline() has a 2ms sleep per byte which
means it will read at a maximum rate of half a character per millisecond
(~4800baud).

This is fixed by only sleeping when read() returns no data.

Signed-off-by: Daniel Thompson <daniel@redfelineninja.org.uk>
2013-09-26 14:57:37 +02:00
Uwe Hermann 045e9a9918 serial.c: Drop unneeded <glob.h>.
This is no longer used, and also it is not available on Android and thus
breaks cross-compilation for Android.

Thanks Marcus Comstedt <marcus@mc.pp.se> for reporting.
2013-08-30 16:35:56 +02:00
Uwe Hermann 29a27196a1 s/DRIVER_LOG_DOMAIN/LOG_PREFIX/.
This is more correct anyway, and also a bit shorter and more readable.
2013-05-03 21:59:32 +02:00
Uwe Hermann 50985c2019 GPL headers: Use correct project name. 2013-04-23 22:24:30 +02:00
Uwe Hermann cc840ab618 serial.c: FreeBSD and OpenBSD don't have OFILL either. 2013-03-17 15:07:50 +01:00
Uwe Hermann 7d4abe5a77 serial.c: NetBSD doesn't have OFILL. 2013-01-27 01:23:01 +01:00
Bert Vermeulen b1a051544d serial: more serial processing flags to turn off 2013-01-23 02:32:58 +01:00
Uwe Hermann 86c02e6554 serial.c: Fix copy-paste error.
Thanks Bert Vermeulen for reporting.
2013-01-21 01:47:30 +01:00
Uwe Hermann b97cbca6c9 serial.c: OpenBSD doesn't have B460800. 2013-01-19 15:55:22 +01:00
lelazary 26ddb5baca Added flow control to serial configuration to support xon/xoff for link-mso19 2013-01-08 01:00:13 +01:00
Bert Vermeulen d92faf6cac serial: more debug cleanup 2012-12-24 11:22:01 +01:00
Bert Vermeulen 49aaa0bc68 serial: get rid of overly verbose spew
It just made spew-level logging unusable; the way sigrok async comms work
guarantees most of it was a false error.
2012-12-24 11:22:01 +01:00
Uwe Hermann 006dbe5587 serial_stream_detect(): Drop unneeded sr_spew(). 2012-12-17 14:21:12 +01:00
Alexandru Gagniuc ea088bb693 serial.c: Be more verbose about failing to parse parameter string
Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
2012-12-02 22:22:07 +01:00
Uwe Hermann 5ddb0cc7d4 serial: Don't hardcode parity and stop bits on Windows. 2012-12-02 14:10:27 +01:00
Uwe Hermann 5ae35c29a7 serial: Full baudrate support on Windows/MinGW. 2012-12-02 13:56:13 +01:00
Uwe Hermann 39e5d79826 serial: RTS/DTR support on Windows/MinGW. 2012-12-02 13:41:49 +01:00
Uwe Hermann a54dd31e38 serial: Use OS-independent flags for serial port opening.
Add SERIAL_RDWR, SERIAL_RDONLY, and SERIAL_NONBLOCK (for now), which are
mapped to the respective OS-specific mechanism in serial_open().
2012-12-02 12:45:54 +01:00
Uwe Hermann 0f84cda05d serial: Fix Windows build. 2012-12-01 22:34:53 +01:00
Bert Vermeulen 71caaad46b serial: allow for extra rts and dtr options in conn string
Options in addition to the usual "9600/8n1" syntax start with a
slash, and take the form of key=value, where different options are
also separated by slashes. For example:

	"9600/8n1/rts=0/dtr=1"

This sets RTS low and DTR high.
2012-11-27 00:55:08 +01:00
Uwe Hermann 700dcd5caa serial: Initial code for setting DTR/RTS.
Currently disabled until option parsing is in place.
2012-11-26 17:01:15 +01:00
Alexandru Gagniuc 551c3d8ce3 serial.c: Sanitize serial_stream_detect
Print the timeout in miliseconds, not microseconds.
Only calculate elapsed time once oer loop.

Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
2012-11-21 19:18:21 -06:00
Uwe Hermann 766456be1c Move serial_stream_detect() to serial.c. 2012-11-14 18:40:07 +01:00
Uwe Hermann 4da1a800df serial: Compile-fix for Windows/MinGW. 2012-11-14 18:20:13 +01:00
Bert Vermeulen 299bdb249e serial: revamp internal API
The only thing to get passed around now is the struct sr_serial_dev_inst
pointer. This should make things more portable as well.
2012-11-12 00:27:17 +01:00
Bert Vermeulen 5df7b20156 serial: avoid Cyrillic conversion specifiers 2012-11-11 03:27:51 +01:00
Alexandru Gagniuc a99e0d2a0c ols: Do not randomly probe serial ports
ols driver used to probe a series of available serial ports obtained
by regexp matching of common serial port names.
There are a number of problems with this approach:
1. It will probe all serial devices, including devices that do not
like to be probed, potentially causing them to act up.
2. It will try to probe serial ports which may already be opened in
other applications for other purposes.
3. It assumes the naming of the serial ports is set in stone, and
creates an unnecessary OS-specific list.
4. It produces unnecessary debug output even when an OLS device is
not connected.
5. etc...

Do not implicitly probe serial ports. Only probe the port specified
by the frontend, if any; otherwise, just quit.
Also get rid of all functionality in serial.c which was designed
specifically for random probing.

Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
2012-11-11 03:12:10 +01:00
Uwe Hermann 302c4b5ab5 serial: Deduplicate log messages a bit. 2012-11-10 01:45:51 +01:00