iam in the process to build a small device that uses a System On Module
(Aria G25 with an ARM9 @ 400Mhz on #Atmel AT91SAM9G25 SoC)
as os iam using debian (for which the manufacture has tutorials :-) - iam relative new to embedded linux systems)
my device is an POE PD (PD = Powered Device) -
so it extracts power from the Network cable with an Silvertel AG5300 module.
my Hardware itself is all working.
POE+ (IEEE802.3at - i need up to 24W) has a extended way how the PD and the PSE (Power Sourcing Equipment) communicate.
if the PD needs more than the 15W, it has to ask for more with the help of the Data Link Layer packages.
the PD extractor module has a pin that signals if the PSE supports more than 15W.
i have connected this signal to my controller.
so i can check the #gpio port if iam allowed to take more than 15W and as the datasheet explains
request over the Data Link Layer at the PSE for more power. most PSE's will deliver the power without the request - but to comply with the specifications i want to implement it. i have searched and found some lib's to do this.
so i will write a script that checks the port and sends the request - that part will be easy.
The PSE can react the more power request - so i have some result and want to make
theme available to other applications and scripts on the system so they can limit the power consumption.
now to my main question: what is the best / preferred way to do this?
i have played with the '/sys/class/gpio' thing and asked myself if this is the right place-
for example create a new entry in '/sys/class/net' called 'poe'
that contains the maximal allowed power and some additional information.
i don't know if it is possible to extend this 'virtual-filesystem' in this way.
so i hope someone has some good ideas / tips or links how to approach something like this.
I think you have to play with device trees to create new entry like you said "/sys/class/net". This way you will be creating a "POE Driver", but...
You can search on kernel config if there is a driver ready for your device. I think you are using Debian on your computer and another distribution on your board.
"so i have some result and want to make
theme available to other applications and scripts on the system so they can limit the power consumption."
If you have information to share with applications, save it to a file on your /home directory, for example.
the tutorial is titled 'Building a Debian Jessie Linux distribution'
so i think it is a debian based system ;-) (on my laptop i run kubuntu - also based on debian so its quite compatible in some comands)
i searched a bit in the web for poe driver and found not really something.
i will do it as you mentioned: will write a script that is started as service and writes the information to a file in the home directory. if this is all working and i have time left i will look into driver things some more...
thanks for your help.
Sure it is a Debian Jesse !! :)
If you want to work with device trees... When you are compiling linux, you have the config command:
~/linux-4.4.5$ make ARCH=arm menuconfig
Search something like POE (or manufacturer name etc) inside menuconfig. If there is nothing done for your device maybe there is something you can copy and change according to your needs.
I certainly agree with @fabatera -
- You should check if something already exists. If nothing exists, then...
- You should see if there is something similar that you can copy and edit. If there is nothing similar then ...
- You could consider creating something new.
Hope this helps!