Dangerous Prototypes

Dangerous Prototypes => USB Infrared Toy => Topic started by: pitsie on September 02, 2011, 10:17:27 am

Title: Irtoy Lirc (Linux) driver
Post by: pitsie on September 02, 2011, 10:17:27 am
Hello all,

I have finished work on a lirc driver for linux that supports receive and transmit in ir sample mode. I have just submitted the patch here:

http://sourceforge.net/mailarchive/foru ... =lirc-list (http://sourceforge.net/mailarchive/forum.php?thread_name=4ebf97df-17f8-48bb-ba65-32e4b9983ac4%40devleno&forum_name=lirc-list)

Tested with irw, irrecord and irsend, working fine in my setup, ymmv.

Peter
Title: Re: Irtoy Lirc (Linux) driver
Post by: ian on September 02, 2011, 10:39:55 am
Very nice, thank you!

I read through the code, very tidy. Everything in the DB transmit function seems good.

I'll post this up and see if we can get some more testers.
Title: Re: Irtoy Lirc (Linux) driver
Post by: const on September 05, 2011, 01:14:12 pm
I want to test irtoy lirc driver, but i can't build it.
I download lirc-0.9.0.tar.bz2, patch it. Create new setup-driver.sh from setup.data.
My OS Mint 9. 
Then: sudo ./setup.sh && make install
From dialog I select driver:usb_irtoy and tty:/de/ttyACM0
At the end I get:
configure: error: *** it is not possible to install the specified driver
   on this system
Title: Re: Irtoy Lirc (Linux) driver
Post by: albuquerque13 on September 05, 2011, 05:49:01 pm
Following steps worked for me.

Since you have already patched won't explain that.

make sure you have autoconf and automake installed, if they are not already present and run the following commands:
./autogen.sh
./setup.sh  #This will ask for the Device and software configurations
./configure.sh --prefix=/usr
make
sudo make install
Title: Irtoy Lirc (Linux) driver
Post by: pitsie on September 06, 2011, 01:15:21 am
[quote author="const"]
From dialog I select driver:usb_irtoy and tty:/de/ttyACM0
At the end I get:
configure: error: *** it is not possible to install the specified driver
   on this system[/quote]

Yes You need to run ./autogen.sh before ./setup.sh, I should have mentioned that.
Title: Re: Irtoy Lirc (Linux) driver
Post by: const on September 06, 2011, 04:37:49 am
I don't have autogen.sh in lirc-0.9.0.tar.bz2. Where I can get it?
Title: Re: Irtoy Lirc (Linux) driver
Post by: pitsie on September 06, 2011, 12:35:30 pm
[quote author="const"]I don't have autogen.sh in lirc-0.9.0.tar.bz2. Where I can get it?[/quote]

Ah yes, you need to get the latest version from the GIT repository to get the autogen.sh script, it is not included in the normal LIRC distribution. Make sure you have git installed, then create a new empty directory and from there do:

Code: [Select]
git clone git://lirc.git.sourceforge.net/gitroot/lirc/lirc

This will create a  directory lirc in the current directory and populate it with the latest lirc source files.

cd to the lirc directory, apply the irtoy driver patches:

Code: [Select]
zcat 0001-Add-driver-for-USB-Infrared-Toy-in-sample-mode.patch.gz | patch -p1
zcat 0002-Add-USB-Infrared-Toy-driver-to-setup-system.patch.gz | patch -p1

This should complete without errors.

Then:

Code: [Select]
./autogen.sh
./setup.sh

setup.sh will pesent you with a menu:
select option 1 "driver configuration"
select option 8 "usb devices"
select option 0, "Dangerous Prototypes USB Infrared Toy"
select the tty for your Irtoy, normally /dev/ttyACM0
You are now back in the main menu, make sure that after Driver configuration it says:
(driver: usb_irtoy tty:/dev/ttyACMx) where x is the tty you selected, 0, 1, 2 or 3
Select option 3, "Save configuration and run configure"

You are now back at the command line, do:
Code: [Select]
make
sudo make install
Title: Re: Irtoy Lirc (Linux) driver
Post by: const on September 06, 2011, 01:31:04 pm
I get latest version from the GIT repository. Patch it. Run ./autogen.sh and receive:

Code: [Select]
Can't exec "libtoolize": No such file or directory at /usr/bin/autoreconf line 189.
Use of uninitialized value in pattern match (m//) at /usr/bin/autoreconf line 189.
configure.ac:24: error: possibly undefined macro: AC_PROG_LIBTOOL
      If this token and others are legitimate, please use m4_pattern_allow.
      See the Autoconf documentation.
autoreconf: /usr/bin/autoconf failed with exit status: 1
configure.ac:17: required file `./compile' not found
configure.ac:17:  `automake --add-missing' can install `compile'
configure.ac:10: required file `./install-sh' not found
configure.ac:10:  `automake --add-missing' can install `install-sh'
configure.ac:10: required file `./missing' not found
configure.ac:10:  `automake --add-missing' can install `missing'
daemons/Makefile.am:12: library used but `RANLIB' is undefined
daemons/Makefile.am:12:  The usual way to define `RANLIB' is to add `AC_PROG_RANLIB'
daemons/Makefile.am:12:  to `configure.ac' and run `autoconf' again.
daemons/Makefile.am: required file `./depcomp' not found
daemons/Makefile.am:  `automake --add-missing' can install `depcomp'
tools/Makefile.am:51: Libtool library used but `LIBTOOL' is undefined
tools/Makefile.am:51:  The usual way to define `LIBTOOL' is to add `AC_PROG_LIBTOOL'
tools/Makefile.am:51:  to `configure.ac' and run `aclocal' and `autoconf' again.
tools/Makefile.am:51:  If `AC_PROG_LIBTOOL' is in `configure.ac', make sure
tools/Makefile.am:51:  its definition is in aclocal's search path.
Makefile.am: required file `./INSTALL' not found
Makefile.am:  `automake --add-missing' can install `INSTALL'
configure.ac:11: required file `config.h.in' not found
Creating setup-driver.sh ...
I feel that something is wrong, but run ./setup.sh , select driver: usb_irtoy tty:/dev/ttyACM0 and
select option 3, "Save configuration and run configure". I get:

Code: [Select]
Configuration: .setup.config, executable shell script: configure.sh
Starting the generated shell script which will call configure with the right
parameters...
configure: error: cannot find install-sh, install.sh, or shtool in "." "./.." "./../.."
Title: Re: Irtoy Lirc (Linux) driver
Post by: pitsie on September 06, 2011, 02:45:51 pm
[quote author="const"]
Code: [Select]
Can't exec "libtoolize": No such file or directory at /usr/bin/autoreconf line 189.
[/quote]

Looks like you need to install the libtool package, something like

Code: [Select]
sudo apt-get install libtool
Title: Re: Irtoy Lirc (Linux) driver
Post by: const on September 07, 2011, 02:08:24 am
Thank You very much! I build lirc.
But now I have two problem.
First:
Code: [Select]
~ $ sudo service lirc start
lirc: unrecognized service

Second:

Code: [Select]
 ~ $ irrecord -n -H usb_irtoy -d /dev/ttyACM0 RemoteXXX.conf
Driver `usb_irtoy' not supported.
Supported drivers:
default
Title: Irtoy Lirc (Linux) driver
Post by: pitsie on September 07, 2011, 09:43:49 am
[quote author="const"]Thank You very much! I build lirc.

But now I have two problem.
First:
Code: [Select]
~ $ sudo service lirc start
lirc: unrecognized service

Second:

Code: [Select]
 ~ $ irrecord -n -H usb_irtoy -d /dev/ttyACM0 RemoteXXX.conf
Driver `usb_irtoy' not supported.
Supported drivers:
default
[/quote]

Ok, let's make sure it's not finding the lirc version that came with your distribution before the one you compiled. Do

Code: [Select]
 which irrecord


and let us know what it says.
Title: Re: Irtoy Lirc (Linux) driver
Post by: const on September 07, 2011, 10:58:27 am
Yes, I run old irrecod from /usr/local/bin (new I biuld in /usr ). I delete all licr files from /usr/local.
irrecord find usb_irtoy , but don't work. It want firmware version 20. I update firmware to V20 and
successfully created file RemoteXXX.conf.

But I still have the first problem. How I can start lirc service?
Title: Re: Irtoy Lirc (Linux) driver
Post by: pitsie on September 07, 2011, 11:12:25 am
[quote author="const"]
Code: [Select]
~ $ sudo service lirc start
lirc: unrecognized service
[/quote]

It's lircd, so do
Code: [Select]
~ $ sudo service lircd start

Be careful though, it could start the lircd from the distribution that probably still is lurking in /usr/local/sbin. For a quick test, you can just do

Code: [Select]
lircd RemoteXXX.conf

making sure you execute the lircd you compiled, not the one from your distribution. After starting lircd, test with irw to see if it recognizes your remote.
Title: Re: Irtoy Lirc (Linux) driver
Post by: const on September 07, 2011, 11:18:23 am
~ $ sudo service lircd start
lircd: unrecognized service
Title: Re: Irtoy Lirc (Linux) driver
Post by: pitsie on September 07, 2011, 12:03:50 pm
Do you have a file lirc or lircd in /etc/init.d at all? Also, try starting lircd directly as I indicated above, at least it will allow you to test if your newly compiled lircd works.
Title: Re: Irtoy Lirc (Linux) driver
Post by: const on September 08, 2011, 05:23:30 am
I start lirc service.
1. make uninstall
2. Install lirc  from MInt9 Synaptic
Now I have scripts for lirc service.
3. make install

irrecord  does two different conf files for the same remote panel. First big in raw mode and it work correct.
Second small, with it,  two of the 21 buttons do not work and the rest give multiple commands on one click.
Title: Irtoy Lirc (Linux) driver
Post by: pitsie on September 08, 2011, 09:46:41 am
[quote author="const"]I start lirc service.[/quote]
Great!

[quote author="const"]
irrecord  does two different conf files for the same remote panel. First big in raw mode and it work correct.
Second small, with it,  two of the 21 buttons do not work and the rest give multiple commands on one click.[/quote]

That kind of problem with irrecord happens from time to time, mainly due to the enormous amount of guesswork irrecord does in "cooked" mode. However, I would like to make sure it's not a driver issue, can you let us know what remote control you used? Also, check the lirc website for conf files for your remote.
Title: Re: Irtoy Lirc (Linux) driver
Post by: const on September 08, 2011, 10:42:55 am
I use noname chinese remote like this http://http://www.ebay.com/itm/Wireless-Car-MP3-FM-Transmitter-Player-Modulator-USB-/320733450539?pt=Other_MP3_Player_Accessories&hash=item4aad34112b
The first correct work conf (raw mode) I get if don't press button after first 80 dot string.
Title: Re: Irtoy Lirc (Linux) driver
Post by: pitsie on September 08, 2011, 10:48:14 am
[quote author="const"]I use noname chinese remote.[/quote]

Can you post the conf files, both the raw one and the short one that does not work? I would like to compare the two and try to see what's going on.
Title: Re: Irtoy Lirc (Linux) driver
Post by: const on September 08, 2011, 10:52:29 am
Yes, I can post. Where to post? PM?
Title: Re: Irtoy Lirc (Linux) driver
Post by: pitsie on September 08, 2011, 10:58:20 am
Sent you a PM
Title: Re: Irtoy Lirc (Linux) driver
Post by: dext0rb on September 13, 2011, 11:19:18 pm
yo yo! pretty excited cuz i just got this to compile for openwrt (after fucking with it for days).
i will write up a step-by-stepper after i doublecheck my work :D

big thanks to pitsie for making this driver!
Title: Irtoy Lirc (Linux) driver
Post by: pitsie on September 14, 2011, 10:48:07 am
Nice work! Hope the driver works as it should!
Title: Re: Irtoy Lirc (Linux) driver
Post by: LisandroP on March 06, 2012, 07:03:39 am
This is amazing - i've been waiting a while for a native LIRC driver for the toy :)  You rock!

The patch seems to work fine. ¿Do you know if the LIRC developers plan to merge it into the mainline?
Title: Re: Irtoy Lirc (Linux) driver
Post by: Shagnar on September 15, 2012, 12:58:15 pm
Hello,

I want to use my irtoy with lirc to turn on my devices (with an infrared controlled power plug). I used it with winlirc so far, and it was working.

Now I switched to XBMCubuntu. Lirc still seems not to natively support the irtoy.

I tried to compile it on my own, but i got stuck on at:
Quote
cd to the lirc directory, apply the irtoy driver patches:

Code: [Select]
zcat 0001-Add-driver-for-USB-Infrared-Toy-in-sample-mode.patch.gz | patch -p1
zcat 0002-Add-USB-Infrared-Toy-driver-to-setup-system.patch.gz | patch -p1

the output is:
Code: [Select]
zcat 0001-Add-driver-for-USB-Infrared-Toy-in-sample-mode.patch.gz | patch -p1
gzip: 0001-Add-driver-for-USB-Infrared-Toy-in-sample-mode.patch.gz: No such file or directory
sixpacku@sixpack:~/lircd/lirc$    zcat 0002-Add-USB-Infrared-Toy-driver-to-setup-system.patch.gz | patch -p1
gzip: 0002-Add-USB-Infrared-Toy-driver-to-setup-system.patch.gz: No such file or directory

it seems like the patches do not exist. where can i get them?

Edit:
got, it - found them at http://sourceforge.net/mailarchive/mess ... d=28032156 (http://sourceforge.net/mailarchive/message.php?msg_id=28032156) (due to noscript, no attachements where shown)
Title: Re: Irtoy Lirc (Linux) driver
Post by: Shagnar on September 15, 2012, 01:07:39 pm
.
Title: Re: Irtoy Lirc (Linux) driver
Post by: Shagnar on September 15, 2012, 01:17:05 pm
I cannot run setup.sh, it fails with:
Code: [Select]
./setup.sh
dialog not found!

what is wrong?
Title: Re: Irtoy Lirc (Linux) driver
Post by: ginpb on September 15, 2012, 05:01:35 pm
You need dialog. If you are using a Debian based distro like ubuntu you can do: apt-get install dialog
Title: Re: Irtoy Lirc (Linux) driver
Post by: sIRwa2 on June 23, 2013, 04:46:36 pm
Quote
setup.sh will pesent you with a menu:
select option 1 "driver configuration"
select option 8 "usb devices"
select option 0, "Dangerous Prototypes USB Infrared Toy"
select the tty for your Irtoy, normally /dev/ttyACM0

cant select irtoy at ttyACMx because mine is at ttyUSB2

aslo xbmc@xbmc:~/lirc$ make

returns:
make: *** No targets specified and no makefile found.  Stop.
Title: Re: Irtoy Lirc (Linux) driver
Post by: bam on September 13, 2015, 01:32:18 am
The patches merged upstream for over the year now. Thank you Peter and all who helped with testing!
Title: Re: Irtoy Lirc (Linux) driver
Post by: Shagnar on September 19, 2015, 03:31:12 pm
Hello,

after a complete reinstall of kodi (x64) I tried to get lirc with irtoy working again.

I just cloned the newest lirc from sourceforge and the patch is not yet included.

I tried to patch the files but this wont work:

Code: [Select]
patching file configure.ac
Hunk #1 FAILED at 154.
Hunk #2 FAILED at 445.
Hunk #3 FAILED at 679.
Hunk #4 FAILED at 1390.
4 out of 4 hunks FAILED -- saving rejects to file configure.ac.rej
can't find file to patch at input line 60
Perhaps you used the wrong -p or --strip option?
The text leading up to this was:
--------------------------
|diff --git a/daemons/hw-types.c b/daemons/hw-types.c
|index 0536ea2..b11cbdf 100644
|--- a/daemons/hw-types.c
|+++ b/daemons/hw-types.c
--------------------------

I saved my old patched lirc install files, but after autogen setup and configure when I enter "make" it wont work:

Code: [Select]
i386 architecture of input file `libhw_module.a(hw_usbirtoy.o)' is incompatible with i386:x86-64 output

how can I get it working again?

( ! ) Fatal error: Uncaught exception 'Elk_Exception' with message 'Please try again. If you come back to this error screen, report the error to an administrator.' in /var/www/dangerousprototypes/forum/sources/database/Db-mysql.class.php on line 696
( ! ) Elk_Exception: Please try again. If you come back to this error screen, report the error to an administrator. in /var/www/dangerousprototypes/forum/sources/database/Db-mysql.class.php on line 696
Call Stack
#TimeMemoryFunctionLocation
10.01522161768session_write_close ( )...(null):0
20.01562293344ElkArte\sources\subs\SessionHandler\DatabaseHandler->write( )...(null):0
30.01562294120Database_MySQL->query( ).../DatabaseHandler.php:119
40.05632432840Database_MySQL->error( ).../Db-mysql.class.php:273