LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This 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


Reply
  Search this Thread
Old 04-06-2012, 09:08 PM   #1
spartan1833
LQ Newbie
 
Registered: Apr 2012
Posts: 3

Rep: Reputation: Disabled
indicator light when VPN is up


Hi,

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.

Any help appreciated - thanks...
 
Old 04-07-2012, 09:07 AM   #2
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,679

Rep: Reputation: 5892Reputation: 5892Reputation: 5892Reputation: 5892Reputation: 5892Reputation: 5892Reputation: 5892Reputation: 5892Reputation: 5892Reputation: 5892Reputation: 5892
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.

Last edited by michaelk; 04-07-2012 at 09:09 AM.
 
Old 04-07-2012, 09:18 AM   #3
jlinkels
LQ Guru
 
Registered: Oct 2003
Location: Bonaire, Leeuwarden
Distribution: Debian /Jessie/Stretch/Sid, Linux Mint DE
Posts: 5,195

Rep: Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043
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.

http://lwn.net/Kernel/LDD3/
http://www.comedi.org/

jlinkels
 
Old 04-10-2012, 07:40 AM   #4
spartan1833
LQ Newbie
 
Registered: Apr 2012
Posts: 3

Original Poster
Rep: Reputation: Disabled
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.


Thanks...
 
Old 04-10-2012, 01:23 PM   #5
jlinkels
LQ Guru
 
Registered: Oct 2003
Location: Bonaire, Leeuwarden
Distribution: Debian /Jessie/Stretch/Sid, Linux Mint DE
Posts: 5,195

Rep: Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043
Quote:
Originally Posted by spartan1833 View Post
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.

jlinkels

Last edited by jlinkels; 04-10-2012 at 01:25 PM.
 
Old 04-11-2012, 11:43 AM   #6
spartan1833
LQ Newbie
 
Registered: Apr 2012
Posts: 3

Original Poster
Rep: Reputation: Disabled
Sorry, since it came up as #1 on Google I figured it was common knowledge - what I get for assuming:

http://en.wikipedia.org/wiki/General...e_Input/Output


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.


Thanks
 
Old 04-11-2012, 12:22 PM   #7
jlinkels
LQ Guru
 
Registered: Oct 2003
Location: Bonaire, Leeuwarden
Distribution: Debian /Jessie/Stretch/Sid, Linux Mint DE
Posts: 5,195

Rep: Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043
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.

jlinkels
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] DD-WRT Indicator Light Question linuxbird Linux - Networking 2 11-24-2010 10:15 PM
Need a very light linux distribution (seriously, very very light) dafrazzman Linux - Distributions 7 08-06-2009 05:46 AM
keyboard indicator maikki Linux - Newbie 1 05-01-2009 01:29 PM
bZerk keyboard w/ blue light.. with no light? Flexo Linux - Hardware 0 03-06-2006 04:03 PM
Shell indicator. ultimator Linux - General 2 03-03-2003 06:21 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 12:32 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration