Amit Posted December 2, 2016 Share Posted December 2, 2016 Hello Everyone.. I am using Olimex A20 board in my project wherein I will be using USB OTG as Ethernet/ LAN commuication with PC. The Ethernet/LAN communication is working properly. However, I am writing a program in C, wherein I want to detect the USB OTG connection (USB cable connected between olimex board and PC) at power ON. Link to comment Share on other sites More sharing options...
MartinKeppler Posted December 2, 2016 Share Posted December 2, 2016 Do you know, if there is a PMU on the Board? As I know from Banana Pi, you can detect the connection from sysfs. On the Banana Pi there is /sys/power/axp_pmu/vbus/connected file. If you read 1, the OTG is plugged in, otherwise you'll read 0. Hope this is a good hint. Yours, Martin Link to comment Share on other sites More sharing options...
zador.blood.stained Posted December 2, 2016 Share Posted December 2, 2016 Do you know, if there is a PMU on the Board? As I know from Banana Pi, you can detect the connection from sysfs. On the Banana Pi there is /sys/power/axp_pmu/vbus/connected file. If you read 1, the OTG is plugged in, otherwise you'll read 0. All A20 based boards should have AXP209 PMU, but this sysfs node will be present only on mainline kernel. If superuser privileges for direct memory access is not a problem, then it's better to read GPIO input responsible for OTG detection directly. Edit: Also there are some issues with OTG on mainline kernel and Lime2 boards, so basic OTG should be tested first. Link to comment Share on other sites More sharing options...
Recommended Posts