top of page

Use of the library of infrared or radio code on Linux

You prepared and tested an infrared or radio library of codes, and you want to integrate them into a project Linux of home automation.

You will have to transfert the following ressources from your Windows PC to your Linux sytem :

- A copy of your entire folder CODES
- A copy of the script sendir.sh

Copy of your entire folder CODES



Depending of how your can acces from or to your Windows PC to your linux system you go to have to use various methods

1,  If you did install the samba utilities, on your linux system, just copy the c:\codes folder, where you want inside your LINUX sytem.

For information, here is a perfect tuto to install samba with an anonymous open access

https://www.howtoforge.com/samba-server-install-on-debian-7-wheezy

I suggest really to install Samba exchange tools from et to your Windows PC


The best place, is normally in your home folder, or in your script folder if you have reserved script folder.

Then as usual, you will have to make a CHMOD command for all witch is inside the codes folder

The name of the "code folder" must be in lower case

Using you Puttty console software in SSH mode :


Go in your "codes folder"

Then realise the chmod

sudo chmod 755 *.*, or sudo chmod 777 *.*  (depending of the security level you want to preserved)

Take care, your "codes folder" has to contain your codes IR or RF .cbe extension but also two commander function scrpts for the ANDROID RM BRIDGE communication, init.d2l and choice.d2l , in lower case names

2, You don't have a samba connection

In this case you will have to copy the folder on an SD card, or any support that can be mount on your Linux system

Just use the CP Linux command to transfert the folder where you want to install the "codes folder"

The best place, is normally in your home folder, or in your script folder if you have reserved script folder.

Then as usual, you will have to make a CHMOD command for all witch is inside the codes folder

The name of the "code folder" must be in lower case

Using you Puttty console software in SSH mode :

Go in your "codes folder"

Then realise the chmod


sudo chmod 755 *.*, or sudo chmod 777 *.*  (depending of the security level you want to preserved)

Take care, your "codes folder" has to contain your codes IR or RF .cbe extension but also two commander function scrpts for the ANDROID RM BRIDGE communication, init.d2l and choice.d2l , in lower case names


Install a copy of the sendir.sh script

This script will be the script command that you will use to send your codes, IR or RF

you will find bellow the script, just copy this script inside nano editor.

sudo sendir.sh

Then copy the script

Control O, enter to valid, then  Control X

Then with the CHMOD command


Go to the folder here you did installed "sendir.sh"


sudo chmod 755  sendir.sh , or sudo chmod 777 sendir.sh  (depending of the security level you want to preserved)



The script code sendir.sh


!/bin/sh

echo $1
echo $2
echo $3

curl -H "Content-Type: application/json" -X POST -d @$1init.d2l $3
curl -H "Content-Type: application/json" -X POST -d @$1choice.d2l $3
curl -H "Content-Type: application/json" -X POST -d @$1$2 $3
 

4, from there how to send IR or RF command

Just use this command


sh /mnt/sendir.sh /samba/anonymous/codes/ test-on.cbe http://192.168.yyy.zzz:7474

Where

sh is the normal send command for a script

/mnt/sendir.sh is where the sendir.sh script is install in this example, in /mnt/

/samba/anonymous/codes/ where the codes folder is installed

test-on.cbe the name of the code to send

http://192.168.yyy.zzz:7474 the full adress of your ANDROID RM BRIDGE

 

Each parameter must be separated with a space like in the example

 

Of course you must replace the 5 parameters by your own parameters

That all, enjoy ...!










 

 

bottom of page