Linux - GeneralThis Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
First post here but have been doing Linux for a while. Currently on a project that builds a basic network plus VPN into a portable enclosure. Everything is essentially auto-start up and once setup the first time, users should never have to open the enclosure unless there is a problem.
One thing that I would like to do is put an indicator light on the outside of the enclosure that would illuminate when the VPN tunnel is up. The goal here is that the user starting the system would be visually prompted when the system is ready to service clients. It would also give some indication when there is a problem with the VPN tunnel by virtue of the light being out.
No real idea how to do this; I send email alerts and do tunnel restarts via a cron job that checks a remote ping server - no reply = no tunnel but I don't know how to translate that to an external indicator.
We will need to know the details about the hardware and what type of I/O ports are available. From there we can tell how difficult and/or practical it will be to add an indicator.
Distribution: Debian /Jessie/Stretch/Sid, Linux Mint DE
Posts: 5,195
Rep:
Rather difficult. No matter how powerful Linux is, it is extremely difficult to read or set an external hardware I/O.
My recommendation would be to find some hardware output which could be used to connect an indicator to, and then write or modify a device driver which can control this output. This could be as simple as a printer port where you set a signal on an arbitrary pin or a USB port where you apply power on. You should study the hardware you use to see if there are any port available to that.
Next, since Linux cannot write directly to hardware from userland (your program runs in userland, even if it is using root credentials) you need to write/adapt and load a kernel driver.
Thanks for the replies - system is a LGX AU115 from Logic Supply. 945GSE chipset w/ Atom N270 CPU. 2 LAN, 2 COM ports (one is GPIO - maybe an option there?), 4 USB (one in use), audio out, etc. Ubuntu 11.10 server installed with VPN, SSH, etc.
Distribution: Debian /Jessie/Stretch/Sid, Linux Mint DE
Posts: 5,195
Rep:
Quote:
Originally Posted by spartan1833
one is GPIO - maybe an option there?
Since you are newbie here: it doesn't hurt to elaborate on your problems and options. You want us to think with you, and I consider it unfair if we have to spend time on guessing, while you save time by not providing as much information as possible.
That having said, what is GPIO? Grand Prospective Informative Overview? General Purpose I/O? On a serial port? Or is the chip GPIO? Which one? Free pins? How connected to the serial port? Driving capability? Used for anything else?
If you have an unused serial port, you do have the hardware available. There are plenty of signals you could use as LED output. However, almost all drivers provide a modem-like interface to the user program. That is, it let the serial port behave as a serial communication channel or character device, thereby hiding all the underlying details. You would have to look are the source of such drivers to see where you can tap in somewhere to get to parts where the hardware pins are controlled. For example, there is a way to set signals like CTS/RTD and DTR/DSR from within the driver.
The next option is to identify your "GPIO" thingy and see if Comedi provides a driver for that.
One of the serial ports is dual purpose serial/GPIO - I'm currently not using either of the serial ports so I'll do some additional research usin the info you have provided and see what I can come up with.
Distribution: Debian /Jessie/Stretch/Sid, Linux Mint DE
Posts: 5,195
Rep:
I know what GPIO means, I was complaining about the lack of information you are providing.
Still, look what information I use, which you did not provide:
The chip on which the GPIO is implemented is the ICH7M. However, I am not sure that the GPIO pin is accessible on your PCB. There is no driver coming near to the ICH7. I don't know it the registers of the ICH7 are easily accessible, I didn't spend any time on that.
The Serial ports seem to be connected to a 16550A chip. Altough this chip is not drawn in the LGXAU115, it is stated that the chip is present. (page 8). In the datasheet of this chip http://www.ti.com/general/docs/lit/g...n&fileType=pdf the so-called modem registers are accessible. Signals like DTR etc are accessible thru the modem registers. My best bet would be to use a generic Comedi driver like the 8255 and modify it to access the modem registers. You can of course ignore the serial data registers.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.