Checking the ToneAlarm under AP_HAL_Linux(BBBMINI is using that) I realize was using old kernek
3.9 device tree, so I updated to 4.X - this will affect only BBBMINI and
Blue boards.
musl implements `sched_*` following the posix standard,
where `sched_setschedule` is used for process scheduling.
Linux implementation defines `sched_*` functions based in
the thread scheduler and not with the process.
Using `pthread_*` should be used to follow such standard.
Ref: https://pubs.opengroup.org/onlinepubs/9699919799/
From: https://www.openwall.com/lists/musl/2016/03/01/5
> ... Linux does not provide a way
> to set scheduling parameters for a _process_, only for threads. The
> sched_setscheduler syscall is documented as taking a pid but actually
> takes a thread id and only operates on that thread. glibc just ignores
> this and provides sched_* functions that do the wrong thing.
This can be fixed by using `pthread_setschedparam` and requesting the current
thread id via `pthread_self`.
Signed-off-by: Patrick José Pereira <patrickelectric@gmail.com>
This allows more channels to be passed to RCInput_UDP protocol while
also allowing less than 8 channels - this is similar to the approach
used by SITL in which the packet size is used to figure out the number
of channels.
- Move macros to functions and improve explanation about logic behind it
- Break code in functions to make it more readable
- Add doxygen comments about functions and how they work in a comprehensive manner
- Improve general code maintainability
Signed-off-by: Patrick José Pereira <patrickelectric@gmail.com>
Uusally problems evidence themsleves with stdin not working correctly -
for example, "git add -p" skipping through all queries as if the
user was just pressing enter.
The Raspberry Pi 4 uses a new BCM cpu, the BCM2711 with
a peripheral base address of 0xFE000000
Signed-off-by: Patrick José Pereira <patrickelectric@gmail.com>
Make sure to clear CBAUD before setting the baud and disable
input modifications.
Fix for #12162
This change removes input options that can modify the input data stream.
INLCR: map new line to carriage return
ICRNL: map carriage return to new line
IUCLC: map upper case to lower case
IGNCR: ignore carriage return
BRKINT: send SIGINT on serial break
Using the string template to determine the size of the array to print
into strikes issues as varargs passes the stack variables as integer
types, so the perceived range is larger.
this allows Linux boards to trigger an external script on GPIO
writes. This can be hooked up to relays with either RC options or
mavlink or mission items to trigger actions that can be scripted
this is the first step to using AP_RCProtocol for most (or all) RC
input on Linux boards. It also fixes a major bug on Disco where the
old SBUS decoder didn't use strict enough timing checks to filter out
bad frames when video capture is running. That led to erratic flight
mode changes and sometimes loss of control.
This allows to use any device to send RCInput to Disco via network.
Particularly this is useful when paired to additional changes on
SkyController 2 so it can be used to control Ardupilot.
This was tested with https://github.com/lucasdemarchi/dema-rc running
on SkyController 2.
This should at most be behind a flag. If the device is being used by
other process/drivers, it's a problem with that specific user/distro:
don't penalize everybody else. Besides, changing the mode is not atomic
and nothing guarantees the other side doesn't get scheduled and change
it back before we get to run.
Do not create one thread per chardev (i.e. bus + kernel's chip select).
Since the shared resources are actually the bus controller and the bus
lines, it makes sense to have 1 thread per bus, otherwise it will just
get locked again on the mutex in the kernel side.
../../libraries/AP_HAL_Linux/Scheduler.cpp: In member function ‘void Linux::Scheduler::_debug_stack()’:
../../libraries/AP_HAL_Linux/Scheduler.cpp:127:47: warning: format ‘%zu’ expects a matching ‘size_t’ argument [-Wformat=]
_uart_thread.get_stack_usage());
^
The open coded version has the same problem fixed by Thread abstraction:
the order of the calls matters and it's easy to call in the wrong order.
Here pthread_attr_setschedparam() and pthread_attr_setschedpolicy()
should be swapped, like in 62c2f737d5 (AP_HAL_Linux: fix setting RT priorities.)