BlueWave Studio forum
Couldn't get GPIO Controller Service to work - Printable Version

+- BlueWave Studio forum (https://bluewavestudio.io/community)
+-- Forum: Community (https://bluewavestudio.io/community/forum-85.html)
+--- Forum: General (https://bluewavestudio.io/community/forum-57.html)
+--- Thread: Couldn't get GPIO Controller Service to work (/thread-3462.html)



Couldn't get GPIO Controller Service to work - mark - 06-13-2022

Hello, I'm a bit stumped at the moment. I'm currently trying to map three buttons for scrolling and the enter key for CarPlay. I've tried following the information here:

https://bluewavestudio.io/community/showthread.php?tid=2208

However, I couldn't get it to work. I've tried using GPIO pins 20, 21 and 26 for 1, 2 and Enter keys respectively but nothing is happening when I try to use them. I got rid of my power management HAT which doesn't even use those GPIO pins and it still doesn't work.

This is how I have the config .ini file set up:
   

And this is how I have the autostart file set up:
   

Is there anything here that I've missed out or have done incorrectly? I'm trying not to use a Teensy/Arduino now due to space constraints as I'm mounting this OAP solution on my motorbike.


RE: Couldn't get GPIO Controller Service to work - BlueWave - 06-13-2022

One instance of the controller_service is always run by default with the .openauto/config/openauto_controller_service.ini. Just remove last line you added to the autostart file.

Please also post your wiring diagram.


RE: Couldn't get GPIO Controller Service to work - mark - 06-14-2022

(06-13-2022, 09:54 PM)BlueWave Wrote: One instance of the controller_service is always run by default with the .openauto/config/openauto_controller_service.ini. Just remove last line you added to the autostart file.

Please also post your wiring diagram.

I’ll try removing that line later.

Also I don’t exactly have a wiring diagram but I have been testing the circuit by jumping pin 39 (GND) with pins 37 (GPIO 26), 38 (GPIO 20) and 40 (GPIO 21) of my Pi 3B+.

And I am now even more confused because I’m not sure which GPIO naming convention this script uses, for example the GPIO by name and BCM GPIO are different!


RE: Couldn't get GPIO Controller Service to work - Kleekru - 09-03-2023

Just so I'm certain, can someone please comment on whether I should be using GPIO pin or BCM pin for GPIO controller service?


RE: Couldn't get GPIO Controller Service to work - Weagle - 09-04-2023

for buttons you don't really need a script to use them, just use dtoverlay gpio keys.

for each button put the line
dtoverlay=gpio-key,gpio=your GPIO-Pin,keycode=keyboardcode,label="just any name you prefer",gpio_pull=2
in your /boot/config.txt.

keycodes:
1 = ESC
2 = 1
3 = 2
28 = Enter

More key codes here: https://github.com/torvalds/linux/blob/master/include/uapi/linux/input-event-codes.h

if its not working try playing around with the "gpio_pull" setting. 0=none 1=pull down 2=pull up

this won't work with rotary encoders. if you or someone else needs a script for them just message me.


RE: Couldn't get GPIO Controller Service to work - Sambolini94 - 10-19-2023

(09-04-2023, 08:46 PM)Weagle Wrote: for buttons you don't really need a script to use them, just use dtoverlay gpio keys.

for each button put the line
dtoverlay=gpio-key,gpio=your GPIO-Pin,keycode=keyboardcode,label="just any name you prefer",gpio_pull=2
in your /boot/config.txt.

keycodes:
1 = ESC
2 = 1
3 = 2
28 = Enter

More key codes here: https://github.com/torvalds/linux/blob/master/include/uapi/linux/input-event-codes.h

if its not working try playing around with the "gpio_pull" setting. 0=none 1=pull down 2=pull up

this won't work with rotary encoders. if you or someone else needs a script for them just message me.

I have a 5 button/ rotary encoder..

I have connect directly to the free GPIO pins I have and tried both the GPIO PIN number and BCM Number but can't get it to work using (controller service.ini as bluewave suggested)... Do I need any other hardware for this to work or using your example of DT overlay would work? and do I need to connect COMA and COMB to 3.3v and Grnd


RE: Couldn't get GPIO Controller Service to work - BlueWave - 10-22-2023

This type of encoder is unsupported. We suggest to use API and create your own script to handle it.


RE: Couldn't get GPIO Controller Service to work - Sambolini94 - 11-02-2023

(10-22-2023, 07:55 PM)BlueWave Wrote: This type of encoder is unsupported. We suggest to use API and create your own script to handle it.

Sorry was your reply in answer to my comment?

And I was going to create multiple .ini files and split the buttons up/ rotary encoder... would that not work?

and do you mean for example connect to an external feather board first or I still can connect to gpio pins but create custom python script?


RE: Couldn't get GPIO Controller Service to work - BlueWave - 11-03-2023

Mentioned encoder is not supported by the controller_service. You can still create your own script to handle the encoder's signals and map them to desired button presses using keyboard simulator like xdotool or OpenAuto Pro API.


RE: Couldn't get GPIO Controller Service to work - Sambolini94 - 11-07-2023

(11-03-2023, 07:39 AM)BlueWave Wrote: Mentioned encoder is not supported by the controller_service. You can still create your own script to handle the encoder's signals and map them to desired button presses using keyboard simulator like xdotool or OpenAuto Pro API.

Thanks for the reply. I've found a solution I believe using custom python scripting to translate gpio button presses to desired keycodes... though how do I get them to specifically work in OAP? Do I need to add a specific line to let it know to work in OAP...