LinuxQuestions.org
Help answer threads with 0 replies.
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-24-2021, 06:17 AM   #1
mstrimel
Member
 
Registered: Apr 2004
Location: USA
Distribution: Mint 19 Cinnamon
Posts: 75

Rep: Reputation: 0
setting an environment variable - it doesn't seem to work


I'm trying to configure the lirc remote control software, but I'm hoping someone can help me even if they are not familiar with lirc.

My lirc commands are failing because they are pointing to an interface called /usr/local/var/run/lirc/lircd, when in fact the program is listening on /var/run/lirc/lircd (without the /usr/local prefix)

The manpage has this entry:

ENVIRONMENT
LIRC_SOCKET_PATH
The lircd socket to connect to, defaults to a hardcoded default value /usr/local/var/run/lirc/lircd

So the hard coded value is obviously my problem. The manpage made me think I could change an environment variable called LIRC_SOCKET_PATH to point in the correct place, and I would be good to go.

So I edited /etc/environment to add a line "LIRC_SOCKET_PATH=/var/run/lirc/lircd".

I logged out and back in, and I get:
mary@mythbox:~$ printenv | grep lir
LIRC_SOCKET_PATH=/var/run/lirc/lircd

so it looks like it worked. But then when I run the lirc program (irsend, if it matters), it still fails because it is trying to point to the hard-coded interface of /usr/local/var/run/lirc/lircd

Is there something about the manpage that I am misunderstanding? If something is hard-coded, am I SOL and if so, what is the point of having an environment variable for it?

Thank you in advance!
 
Old 04-24-2021, 06:32 AM   #2
hazel
LQ Guru
 
Registered: Mar 2016
Location: Harrow, UK
Distribution: LFS, AntiX, Slackware
Posts: 7,567
Blog Entries: 19

Rep: Reputation: 4447Reputation: 4447Reputation: 4447Reputation: 4447Reputation: 4447Reputation: 4447Reputation: 4447Reputation: 4447Reputation: 4447Reputation: 4447Reputation: 4447
Usually you set environmental variables either on the command line from which you launch your program or on a per-session basis in one of your login files (usually .profile or .bash_profile). The second method is probably better because it works for graphically launched programs too.

Try putting that line in your personal profile, then log out and log in again.
 
Old 04-24-2021, 07:37 AM   #3
teckk
LQ Guru
 
Registered: Oct 2004
Distribution: Arch
Posts: 5,137
Blog Entries: 6

Rep: Reputation: 1826Reputation: 1826Reputation: 1826Reputation: 1826Reputation: 1826Reputation: 1826Reputation: 1826Reputation: 1826Reputation: 1826Reputation: 1826Reputation: 1826
https://www.lirc.org/html/lircd.conf.html
https://www.lirc.org/html/index.html
https://www.lirc.org/

https://www.lirc.org/html/irsend.html
Code:
OPTIONS

-h --help
    Display usage summary. 
-v --version
    Display version. 
-d --device=device
    Use given lircd socket [/usr/var/run/lirc/lircd]. 
-a --address=host[:port]
    Connect to lircd at this address. 
-# --count=n
    Send command n times.
The docs talk about that it looks like.
 
Old 04-24-2021, 10:59 PM   #4
rnturn
Senior Member
 
Registered: Jan 2003
Location: Illinois (SW Chicago 'burbs)
Distribution: openSUSE, Raspbian, Slackware. Previous: MacOS, Red Hat, Coherent, Consensys SVR4.2, Tru64, Solaris
Posts: 2,800

Rep: Reputation: 550Reputation: 550Reputation: 550Reputation: 550Reputation: 550Reputation: 550
Quote:
Originally Posted by mstrimel View Post
I'm trying to configure the lirc remote control software, but I'm hoping someone can help me even if they are not familiar with lirc.

My lirc commands are failing because they are pointing to an interface called /usr/local/var/run/lirc/lircd, when in fact the program is listening on /var/run/lirc/lircd (without the /usr/local prefix)
What do you mean by "failing"? "File not found?" Permissions? Are there error messages you can post?

Quote:
LIRC_SOCKET_PATH
The lircd socket to connect to, defaults to a hardcoded default value /usr/local/var/run/lirc/lircd

So the hard coded value is obviously my problem. The manpage made me think I could change an environment variable called LIRC_SOCKET_PATH to point in the correct place, and I would be good to go.
Rather than editing and creating s system-wide environment variable (unless other users will need it, then go ahead), I would write a quick-n-dirty wrapper script (in, say, "$HOME/bin") that either uses the information that 'teckk' suggested:
Code:
irsend [-d /var/run/lirc/lircd|--device=/var/run/lirc/lircd]
or runs the command you want as:
Code:
LIRC_SOCKET_PATH=/var/run/lirc/lircd irsend
If neither of those work, post whatever error messages you are receiving. It's, uh, pretty hard to tell what's going wrong when you can't see the failure.

HTH...
 
Old 04-25-2021, 01:49 AM   #5
lvm_
Member
 
Registered: Jul 2020
Posts: 912

Rep: Reputation: 314Reputation: 314Reputation: 314Reputation: 314
Offhand I cannot tell what is wrong, but if it doesn't work, try a different approach: create a link to this socket at the desired location or remount /var/run/lirc at /usr/local using mount --bind
 
Old 04-25-2021, 05:01 PM   #6
mstrimel
Member
 
Registered: Apr 2004
Location: USA
Distribution: Mint 19 Cinnamon
Posts: 75

Original Poster
Rep: Reputation: 0
Thanks everyone for your helpful suggestions. A piece of information I should have provided is that another user, "mythtv," needs to be able to run the lirc commands to change channels for my linux PVR system, that is why I was seeking a universal environmental variable. Luckily for me, the mythtv channel change script has a config file where you can set a device to override the hard-coded one. So, problem solved, once I realized I should look there, although I'm still baffled as to why setting an environment variable as described in my first post did not work. (For those who asked ... the error was 'no device found' on /usr/local/var/run/lirc/lircd, and the logs clearly showed that lircd was listening on /var/run/lirc/lircd).

Marking this solved. Thanks again!
 
  


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
Environment variable that dynamically changes when another variable is changed youtoo Linux - Newbie 4 02-17-2016 01:44 AM
totem-pps plugin doesn't seem to work (doesn't show up) prushik Linux - Software 1 07-29-2013 09:51 AM
AWK a variable Ouptut to a new variable and using the new variable with the old one alertroshannow Linux - Newbie 4 02-16-2009 12:08 AM
rmdir -rf does not seem to work in fc4 .what do i do?rm -p also doesnt seem to work vinay87 Linux - Newbie 2 05-09-2006 09:18 AM
Num Lock keypad setting doesn't seem to exsist in Galeon. l0f33t Linux - Newbie 2 08-21-2003 04:16 PM

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

All times are GMT -5. The time now is 03:32 PM.

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