using_serial_ports_in_linux
Differences
This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
using_serial_ports_in_linux [2022/03/03 11:20] – created richardrussell | using_serial_ports_in_linux [2024/01/05 00:21] (current) – external edit 127.0.0.1 | ||
---|---|---|---|
Line 11: | Line 11: | ||
So to avoid your BASIC program ' | So to avoid your BASIC program ' | ||
- | //BBC BASIC for Windows// provides built-in features to configure a serial port (as an extension of the **OPENUP** function) and to test for how much data is waiting in an input buffer (**EXT#** function), but //BBC BASIC for SDL 2.0// does not (because SDL 2.0 itself, which BBCSDL relies on to provide the cross-platform abstraction layer, doesn' | + | To configure and open a serial port in Linux you should use code similar to the following (in this case the port **/ |
- | + | ||
- | To configure and open a serial port in Linux you should use code similar to the following (in this case the port **/ | + | |
<code bb4w> | <code bb4w> | ||
- | OSCLI " | + | OSCLI " |
- | OSCLI "stty -F / | + | OSCLI "stty -F / |
serial% = OPENUP("/ | serial% = OPENUP("/ | ||
</ | </ | ||
- | To test how much data is ' | + | To test how much data is ' |
<code bb4w> | <code bb4w> | ||
- | | + | |
- | LOCAL F% | + | |
- | | + | REM Do something with the data here |
- | | + | |
- | = N% | + | REM Continue with any background tasks |
</ | </ | ||
+ | |||
+ | ====Notes on permissions==== | ||
+ | |||
+ | Typically to access a serial port in Linux you will either need root privileges (e.g. by using **sudo**) or | ||
+ | be a member of the **dialout** group. | ||
+ | |||
+ | <code bash> | ||
+ | sudo usermod -a -G dialout $USER | ||
+ | </ | ||
+ | |||
+ | For this change to become active it is likely that you will need to restart your PC. | ||
using_serial_ports_in_linux.1646306427.txt.gz · Last modified: 2024/01/05 00:16 (external edit)