But reading the value of DCD signal using termios structure, statserial and picocom showed always zero, when the DCD is raised by the device.
I also decompiled the device tree binary to make that the settings are really in the dtb. And they are.
When I use as GPIO
echo 11 > /sys/class/gpio/export
and
cat /sys/class/gpio/gpio11/value
I can see the value toggling according to the DCD state of the connected modem.
But using it as GPIO doesn’t really help me out. I wanted to use the DCD signal with pppd to detect a broken connection using a LTE modem connected to UART0.
Does anyone has a hint how to get it working that the DCD is usable in the standard linux way?
I found out, that this patch is only half of the solution. When I use the patch together with pppd (modem option enable) the connection isn’t terminated.
There have to be made a call to uart_handle_dcd_change in the kernel module to notify the userspace applications of the state change. The current provided patch fill does that only when state is polled.
I implemented that with an GPIO irq, but thats not very pretty right now. I’ll post back when I finally extended the fsl_lpuart with a timer to poll the GPIOs cyclically.
If no signal_gpio_active_value is defined, but the gpio is defined, then zero is used ‘active value’
By default the GPIOs are low active.
The kernel module will also print out the GPIOs used.
[ 0.360963] fsl-lpuart 40027000.serial: using interrupt of gpio 11 for dcd
[ 0.361138] fsl-lpuart 40027000.serial: dcd_gpio_active_value not defined in devicetree - using as 0 as 'active value' for dcd gpio
[ 0.361365] fsl-lpuart 40027000.serial: using gpio 21 for dsr
[ 0.361476] fsl-lpuart 40027000.serial: dsr_gpio_active_value not defined in devicetree - using as 0 as 'active value' for dsr gpio
[ 0.361666] fsl-lpuart 40027000.serial: using gpio 20 for ri
[ 0.361772] fsl-lpuart 40027000.serial: ri_gpio_active_value not defined in devicetree - using as 0 as 'active value' for ri gpio
[ 0.361930] fsl-lpuart 40027000.serial: dtr_gpio_active_value not defined in devicetree - using as 0 as 'active value' for dtr gpio
[ 0.362112] fsl-lpuart 40027000.serial: using gpio 10 for dtr
Thank you for sharing your answer on our platform. I am sure other people having similar applications/issues will be able to take inspiration from your answer.