[Letux-kernel] GTA04: external GPS antenna detection
H. Nikolaus Schaller
hns at goldelico.com
Thu Apr 26 12:38:26 CEST 2018
traditionally we have an "extcon" driver for this,
but it appears that extcon is nowhere used and almost
deprecated in latest kernels. DT support is weak
and although I had fixed the device tree in letux-4.17-rc2,
it did not properly report the antenna state.
A fix would have modified the extcon core where
I have found LKML discussions that nothing will
be accepted there any more.
So the day seems not to be too far away that
extcon will be removed completely from the kernel.
Therefore, I have switched it into a gpio-key.
This creates another /dev/input/event file and
evdev can be used to read the state.
I have not added something to our input.rules,
so there is not yet a "nice" file name for it
like we have for /dev/input/touchscreen etc.
Antenna state can now be read by:
ANTENNA_STATE=$(cd /sys/devices/platform/antenna-detect/input/input*/ && ls -1d event*) 2>/dev/null
evtest --query /dev/input/$ANTENNA_STATE EV_SW 13 </dev/ttyGPS0 && echo internal || echo external
Compiled code should open the input event file
and apply a special ioctl().
I haven't yet pushed the patches but they will
appear in letux-4.17-rc3.
More information about the Letux-kernel