You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am currently working on a project which I would really like to integrate with labgrid. I believe I will have to write some new drivers for what I want to do. Therefore I have a few questions.
Now to the more technical part. There are multiple SerialExpansionHATs on the raspberry pi (each with it's own interrupt pin and hardware address). Each HAT is controlled through i2c and provides 8 GPIO ports and two UARTs. On each HAT I am using four of those GPIO lines to control relays, two to control power relays and two to control relays which "press" the reset button.
Now for the description of the problem: The order that the devices are added to the dtoverlay determines the gpiochipN which is assigned. And the only way I have been able to reliably determine which gpiochipN is connected to which HAT is by looking in /sys/bus/i2c/devices/1-00XX where XX is the hardware address on the HAT.
My question is: Where should I add this new driver? Should I add a new class to labgrid/driver/powerdriver.py or create a new file in labgrid/driver/power?
Should I instead be looking at sysfsgpio.py (which according to the kernel documentation /sys/class/gpio is deprecated)? But honestly, this doesn't really seem to be right for me since I want to use it for power control.
I feel like this concept could be used with the exporter config file with any new classes I create.
Future issues...
Controlling the reset relays will come later. But I imagine that I will have to do something similar to the power control.
Eventually I will have to do something similar for the UARTs too. The UARTs will be /dev/ttySCN. This is another situation where the hardware address is the only reliable way to determine which tty belongs to which HAT.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hi,
I am currently working on a project which I would really like to integrate with labgrid. I believe I will have to write some new drivers for what I want to do. Therefore I have a few questions.
But first, to get an idea of what I'm working on (without a lot of technical detail) please feel free to take a look at https://github.com/pmelange/openwrt-testlab
Now to the more technical part. There are multiple SerialExpansionHATs on the raspberry pi (each with it's own interrupt pin and hardware address). Each HAT is controlled through i2c and provides 8 GPIO ports and two UARTs. On each HAT I am using four of those GPIO lines to control relays, two to control power relays and two to control relays which "press" the reset button.
Now for the description of the problem: The order that the devices are added to the dtoverlay determines the gpiochipN which is assigned. And the only way I have been able to reliably determine which gpiochipN is connected to which HAT is by looking in /sys/bus/i2c/devices/1-00XX where XX is the hardware address on the HAT.
My question is: Where should I add this new driver? Should I add a new class to labgrid/driver/powerdriver.py or create a new file in labgrid/driver/power?
Should I instead be looking at sysfsgpio.py (which according to the kernel documentation /sys/class/gpio is deprecated)? But honestly, this doesn't really seem to be right for me since I want to use it for power control.
For my proof-of-concept code which uses https://pypi.org/project/gpiod/, I created a config file which looks like this:
I feel like this concept could be used with the exporter config file with any new classes I create.
Future issues...
Controlling the reset relays will come later. But I imagine that I will have to do something similar to the power control.
Eventually I will have to do something similar for the UARTs too. The UARTs will be /dev/ttySCN. This is another situation where the hardware address is the only reliable way to determine which tty belongs to which HAT.
Thank you in advance for reading this post and for any and all helpful suggestions.
Beta Was this translation helpful? Give feedback.
All reactions