iqaudio / tools

Sample CLI tools for IQaudio products
http://www.iqaudio.com
35 stars 11 forks source link

Pi 3 struggling to get sudo IQ_ir& working #6

Closed sheridat closed 7 years ago

sheridat commented 7 years ago

Hi, I have the DAC+ and am attempting to control the volume using Infrared. My only previous programming experience is Cobol. I have had a good time playing with Python et al. I am using the DAC+ to listen to flac files and internet radio using mpd and some python code to control things.

I have installed an IR receiver on the "black" DAC+ card. I setup the boot/config.txt as follows dtoverlay=lirc-rpi:gpio_in_pin=25,gpio_in_pull=down I have installed lirc and set it up and it is working with the IR receiver (i get stuff when I use irx and press the keys on my remote that I have mapped in my lircd.conf.

So I thought I would use the code provided to manipulate the volume.

I have cloned the code into a dir "tools". If i do sudo IQ_ir& it fails "sudo: IQ_ir: command not found"

I wasn't surprised because in alsamixer the volume control is shown as "Digital" rather than PCM. So I changed IQ_ir.c and IQSetupMix.c to use "Digital". I then compiled IQSetupMix.c using the instructions in the file. Compiled clean. Then compiled IQ_ir.c which compiles with warnings (compiled these with the cli in issue 4 that discusses compiling) gcc -include /usr/include/lirc/lirc_client.h -o IQ_ir IQ_ir.c -llirc_client -lasound -lwiringPi IQ_ir.c:36:0: warning: "TRUE" redefined

define TRUE 1

^ In file included from IQ_ir.c:17:0: /usr/include/wiringPi.h:32:0: note: this is the location of the previous definition

define TRUE (1==1)

^ IQ_ir.c:37:0: warning: "FALSE" redefined

define FALSE 0

^ In file included from IQ_ir.c:17:0: /usr/include/wiringPi.h:33:0: note: this is the location of the previous definition

define FALSE (!TRUE)

^ If I sudo IQ_ir& i get the same failure as above

Frankly I am pretty lost. So I am wondering

  1. Any idea regarding how I can proceed to get IQ_ir.c to work or
  2. Can you advise whether I can use python to do the same thing - finding it relatively easy to understand compared to C.

Thank You in advance.

iqaudio commented 7 years ago

wow, good job so far. Comments in-line.

On 7 Mar 2017, at 14:00, sheridat notifications@github.com wrote:

Hi, I have the DAC+ and am attempting to control the volume using Infrared. My only previous programming experience is Cobol. I have had a good time playing with Python et al. I am using the DAC+ to listen to flac files and internet radio using mpd and some python code to control things.

I have installed an IR receiver on the "black" DAC+ card. I setup the boot/config.txt as follows dtoverlay=lirc-rpi:gpio_in_pin=25,gpio_in_pull=down I have installed lirc and set it up and it is working with the IR receiver (i get stuff when I use irx and press the keys on my remote that I have mapped in my lircd.conf.

Okay, solid basis. So I thought I would use the code provided to manipulate the volume.

I have cloned the code into a dir "tools". If i do sudo IQ_ir& it fails "sudo: IQ_ir: command not found"

That’ll be linux. the current directory is not on the path. so try: sudo ./IQ_ir& I wasn't surprised because in alsamixer the volume control is shown as "Digital" rather than PCM. So I changed IQ_ir.c and IQSetupMix.c to use "Digital". I then compiled IQSetupMix.c using the instructions in the file. Compiled clean. Then compiled IQ_ir.c which compiles with warnings (compiled these with the cli in issue 4 that discusses compiling) gcc -include /usr/include/lirc/lirc_client.h -o IQ_ir IQ_ir.c -llirc_client -lasound -lwiringPi IQ_ir.c:36:0: warning: "TRUE" redefined

define TRUE 1

^ In file included from IQ_ir.c:17:0: /usr/include/wiringPi.h:32:0: note: this is the location of the previous definition

define TRUE (1==1)

^ IQ_ir.c:37:0: warning: "FALSE" redefined

define FALSE 0

^ In file included from IQ_ir.c:17:0: /usr/include/wiringPi.h:33:0: note: this is the location of the previous definition

define FALSE (!TRUE)

^

So that’s just because we’ve both used the variables called TRUE and FALSE, so the compiler thinks they are being redefined. I’ve just changed the code to use IQTRUE and IQFALSE. I’ve also changed the mixer to Digital and bumped the version number.

If I sudo IQ_ir& i get the same failure as above

Frankly I am pretty lost. So I am wondering

Any idea regarding how I can proceed to get IQ_ir.c to work

Try the latest version. Change DEBUG_PRINT den to below.

define DEBUG_PRINT 1

compile and run without the & (which puts the task in the background) sudo ./IQ_rot

then you should see any error messages etc coming out.

• or • Can you advise whether I can use python to do the same thing - finding it relatively easy to understand compared to C.

Python, probably. not tried it. I jumped form Cobol to C myself. Python is a black art. :-)

Thank You in advance.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or mute the thread.

sheridat commented 7 years ago

Thank You for getting back so quickly and for amending the source for my purpose. Followed the instructions and I am almost there - results are sudo ./IQ_ir IQaudIO.com Pi-DAC Volume Control support (IR) v1.4 March 7th 2016

Returned card VOLUME range - min: 0, max: 207 Current ALSA volume LEFT: 79 Current ALSA volume RIGHT: 79 lirc: could not open config files /root/.lircrc and /etc/lirc/lirc/lircrc lirc: No such file or directory

I will chase down the lirc problems "lirc: could not open config files /root/.lircrc and /etc/lirc/lirc/lircrc" errors are all about but much heartened.

Thank You again

sheridat commented 7 years ago

Hi, created the lircrc file with my KEY_VOLUMEUP and KEY_VOLUMEDOWN and hey presto it works. Thanks again