|
View:
New views
12 Messages
—
Rating Filter:
Alert me
|
|
|
New tool for converting pronto hex codes to lircd.confHello
I've written a small tool to convert pronto hex codes to lircd.conf format. I've tested it in my setup and irsend is able to control the devices i have in my setup. It's written in python and should work pretty much anywhere. Hope you find it useful. Olavi Akerman # # A tool for converting Pronto format hex codes to lircd.conf format # # Copyright by Olavi Akerman <olavi.akerman@...> # # pronto2lirc is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. # class CodeSequence: # Handles codesequences parsing and conversion def ProcessPreamble(self,sPreamble): if sPreamble[0]<>"0000": raise "Formats other than starting with 0000 are not supported!" self.dIRFrequency=1000000/(long(sPreamble[1],16) * 0.241246) # Frequency of the IR carrier in Khz self.lOnceSequenceLength=long(sPreamble[2],16) # No of pulses that is sent once when button is pressed self.lRepeatableSequenceLength=long(sPreamble[3],16) # No of pulses that are repeatable while button pressed def CreatePulses(self,sItems): self.dPulseWidths=[] # Table of Pulse widths. Length is repsented in microseconds for i in sItems: self.dPulseWidths.append(1000000*long(i,16)/self.dIRFrequency) # Convert pulse widths to uS if len(self.dPulseWidths)<>2*(self.lOnceSequenceLength+self.lRepeatableSequenceLength): raise "Number of actual codes does not match the header information!" def AnalyzeCode(self,sCodeName,sHexCodes): sHexTable=sHexCodes.split() self.sCodeName=sCodeName.rstrip() # Name of the Code associated with code sequence self.ProcessPreamble(sHexTable[:4]) # First four sequences make up Preamble self.CreatePulses(sHexTable[4:]) # The rest are OnceSequence + RepeatableSequence return self.dPulseWidths[-1] # Final gap=last off signal length def WriteCodeSection(self,fOut): fOut.write('\n\t\t\tname '+self.sCodeName+'\n') for i in range(len(self.dPulseWidths)-1): # Do not write the last signal as lircd.conf # does not contain last off signal length if (i%6) ==0: fOut.write('\t\t\t\t') fOut.write('%d ' % round(self.dPulseWidths[i])) if (i+1)%6 ==0: # Group codes as six per line fOut.write('\n') fOut.write('\n') # Final EOL class HexParser: def __init__(self,sFileName): f=open(sFileName,'r') self.sRemoteName=sFileName.split('.')[:1][0] # Name of the remote self.sCodes=[] # Codes contained in file self.lGap=0 # Final Gap while True: sLine=f.readline() if sLine=='' or sLine.strip()=='': # EOF? break [sCodeName,sHexCodes]=sLine.split(':') seq=CodeSequence() finalgap=seq.AnalyzeCode(sCodeName,sHexCodes) if finalgap>self.lGap: self.lGap=finalgap self.sCodes.append(seq) f.close() def WriteLIRCConf(self,sOutFileName): f=open(sOutFileName,'w') f.write('begin remote\n') f.write('\tname\t'+self.sRemoteName+'\n') f.write('\tflags\tRAW_CODES\n') f.write('\teps\t30\n') f.write('\taeps\t100\n') f.write('\tgap\t%d\n' % self.lGap ) f.write('\t\tbegin raw_codes\n') for i in self.sCodes: i.WriteCodeSection(f) f.write('\t\tend raw_codes\n') f.write('end remote\n') f.close() # Main import sys if len(sys.argv)<>2: print "Pronto codes converter to lircd.conf format (version 1.00)" print "Usage: pronto2lirc.py inputfile.hex " print "Input file must be in format where each line contains all codes" print " associated with a button like:" print " Button1:0000 00ac 000b 00de ..." print "Result: lircd.conf file is written to the current directory" print " containing all the Pronto codes extracted from" print " the input file" else: p=HexParser(sys.argv[1]) p.WriteLIRCConf('lircd.conf') ------------------------------------------------------------------------- This SF.net email is sponsored by the 2008 JavaOne(SM) Conference Don't miss this year's exciting event. There's still time to save $100. Use priority code J8TL2D2. http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone |
|
|
Re: New tool for converting pronto hex codes to lircd.confHello
A couple of additions to the program to make CCF->lircd.conf easier. To translate CCF to lircd.conf first use CCFDecompiler (from CCFTools) to convert CCF to XML and then use the attached program to make lircd.conf. The new version (1.1) is attached. Olavi On Sat, May 10, 2008 at 1:02 PM, Olavi Akerman <olavi.akerman@...> wrote: Hello ------------------------------------------------------------------------- This SF.net email is sponsored by the 2008 JavaOne(SM) Conference Don't miss this year's exciting event. There's still time to save $100. Use priority code J8TL2D2. http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone |
|
|
Re: New tool for converting pronto hex codes to lircd.confHi Olavi,
thanks for the tool. I already could make good use of it. I plan to add the tool to the contrib/ folder in the lirc distribution if you don't mind. Could you please write up some documentation on the process of converting .ccf files and how to use the tool. Is the CCFDecompiler only available for Windows? Christoph Olavi Akerman "olavi.akerman@..." wrote: > A couple of additions to the program to make CCF->lircd.conf easier. To > translate CCF to lircd.conf first use CCFDecompiler (from CCFTools) to > convert CCF to XML and then use the attached program to make lircd.conf. The > new version (1.1) is attached. > > Olavi > > On Sat, May 10, 2008 at 1:02 PM, Olavi Akerman <olavi.akerman@...> > wrote: >> Hello >> >> I've written a small tool to convert pronto hex codes to lircd.conf format. >> >> I've tested it in my setup and irsend is able to control the devices i have >> in my setup. >> >> It's written in python and should work pretty much anywhere. >> Hope you find it useful. >> >> Olavi Akerman >> ------------------------------------------------------------------------- This SF.net email is sponsored by the 2008 JavaOne(SM) Conference Don't miss this year's exciting event. There's still time to save $100. Use priority code J8TL2D2. http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone |
|
|
RE: New tool for converting pronto hex codes to lircd.confHello
Yes I don't mind if you add it to contrib. Regarding documentation: what is the format you would like the documentation- to be in? As far as I know CCFDecompiler is only available for Windows. If anyone knows any other platform independent library/tool that can be used to parse CCF files I willing to consider writing support for them as well. Olavi -----Original Message----- From: lirc-list-bounces@... [mailto:lirc-list-bounces@...] On Behalf Of Christoph Bartelmus Sent: Saturday, May 10, 2008 7:50 PM To: lirc-list@... Subject: Re: New tool for converting pronto hex codes to lircd.conf Hi Olavi, thanks for the tool. I already could make good use of it. I plan to add the tool to the contrib/ folder in the lirc distribution if you don't mind. Could you please write up some documentation on the process of converting .ccf files and how to use the tool. Is the CCFDecompiler only available for Windows? Christoph Olavi Akerman "olavi.akerman@..." wrote: > A couple of additions to the program to make CCF->lircd.conf easier. To > translate CCF to lircd.conf first use CCFDecompiler (from CCFTools) to > convert CCF to XML and then use the attached program to make lircd.conf. The > new version (1.1) is attached. > > Olavi > > On Sat, May 10, 2008 at 1:02 PM, Olavi Akerman <olavi.akerman@...> > wrote: >> Hello >> >> I've written a small tool to convert pronto hex codes to lircd.conf format. >> >> I've tested it in my setup and irsend is able to control the devices i have >> in my setup. >> >> It's written in python and should work pretty much anywhere. >> Hope you find it useful. >> >> Olavi Akerman >> ------------------------------------------------------------------------- This SF.net email is sponsored by the 2008 JavaOne(SM) Conference Don't miss this year's exciting event. There's still time to save $100. Use priority code J8TL2D2. http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javao ne ------------------------------------------------------------------------- This SF.net email is sponsored by the 2008 JavaOne(SM) Conference Don't miss this year's exciting event. There's still time to save $100. Use priority code J8TL2D2. http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone |
|
|
Re: New tool for converting pronto hex codes to lircd.confHi!
Olavi Akerman "olavi.akerman@..." wrote: > Yes I don't mind if you add it to contrib. > Regarding documentation: what is the format you would like the > documentation- to be in? Html for simple inclusion on lirc.org would be perfect. Simple text would be fine as well. Christoph ------------------------------------------------------------------------- This SF.net email is sponsored by the 2008 JavaOne(SM) Conference Don't miss this year's exciting event. There's still time to save $100. Use priority code J8TL2D2. http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone |
|
|
Re: New tool for converting pronto hex codes to lircd.confVery interesting program.
If you can comment it a bit more, I could try to port it to BASIC: RapidQ basic compiler can produce standalone executables for both windows and linux (and maybe Mac), even with GUI. How can I use this program to convert Pronto raw codes rather than a CCF file (which I do not have)? These are the codes: DVD ON 0000 006d 0022 0003 00ab 00aa 0016 003f 0016 0014 0016 003e 0016 003f 0016 0014 0016 003e 0016 0014 0016 0014 0016 003e 0016 0014 0016 003e 0016 003f 0016 0014 0016 003e 0016 0014 0016 0014 0016 003e 0016 0014 0016 003f 0016 0014 0016 003e 0016 003e 0016 003f 0016 0014 0016 0014 0016 003f 0016 0014 0016 003e 0016 0014 0016 0014 0016 0014 0016 003e 0016 06c3 00ab 00aa 0016 0014 0016 0e7d DVD OFF 0000 006d 0022 0003 00ab 00aa 0016 003e 0016 0014 0016 003f 0016 003e 0016 0014 0016 003e 0016 0014 0016 0014 0016 003e 0016 0014 0016 003f 0016 003e 0016 0014 0016 003f 0016 0014 0016 0014 0016 0014 0016 003e 0016 003f 0016 0014 0016 003e 0016 003f 0016 003e 0016 0014 0016 003f 0016 0014 0016 0014 0016 003e 0016 0014 0016 0014 0016 0014 0016 003e 0016 06c3 00ab 00aa 0016 0014 0016 0e7d A simple lirc raw sequence would be enough (no need to analyse the file looking for known patterns/protocols). |
|
|
Re: New tool for converting pronto hex codes to lircd.confcassioli wrote:
> Very interesting program. > If you can comment it a bit more, I could try to port it to BASIC: RapidQ > basic compiler can produce standalone executables for both windows and linux > (and maybe Mac), even with GUI. > > How can I use this program to convert Pronto raw codes rather than a CCF > file (which I do not have)? > > These are the codes: > DVD ON > > 0000 006d 0022 0003 00ab 00aa 0016 003f 0016 0014 0016 003e 0016 003f 0016 > 0014 0016 003e 0016 0014 0016 0014 0016 003e 0016 0014 0016 003e 0016 003f > 0016 0014 0016 003e 0016 0014 0016 0014 0016 003e 0016 0014 0016 003f 0016 > 0014 0016 003e 0016 003e 0016 003f 0016 0014 0016 0014 0016 003f 0016 0014 > 0016 003e 0016 0014 0016 0014 0016 0014 0016 003e 0016 06c3 00ab 00aa 0016 > 0014 0016 0e7d > > DVD OFF > > 0000 006d 0022 0003 00ab 00aa 0016 003e 0016 0014 0016 003f 0016 003e 0016 > 0014 0016 003e 0016 0014 0016 0014 0016 003e 0016 0014 0016 003f 0016 003e > 0016 0014 0016 003f 0016 0014 0016 0014 0016 0014 0016 003e 0016 003f 0016 > 0014 0016 003e 0016 003f 0016 003e 0016 0014 0016 003f 0016 0014 0016 0014 > 0016 003e 0016 0014 0016 0014 0016 0014 0016 003e 0016 06c3 00ab 00aa 0016 > 0014 0016 0e7d > > A simple lirc raw sequence would be enough (no need to analyse the file > looking for known patterns/protocols). > > > > Just create a file with 2 rows each containing the whole sequence of commands: DVDON:0000 006d 0022 0003 00ab 00aa 0016 003f 0016 0014 0016 003e 0016 003f 0016 0014 0016 003e 0016 0014 0016 0014 0016 003e 0016 0014 0016 003e 0016 003f 0016 0014 0016 003e 0016 0014 0016 0014 0016 003e 0016 0014 0016 003f 0016 0014 0016 003e 0016 003e 0016 003f 0016 0014 0016 0014 0016 003f 0016 0014 0016 003e 0016 0014 0016 0014 0016 0014 0016 003e 0016 06c3 00ab 00aa 0016 0014 0016 0e7d DVDOFF:0000 006d 0022 0003 00ab 00aa 0016 003e 0016 0014 0016 003f 0016 003e 0016 0014 0016 003e 0016 0014 0016 0014 0016 003e 0016 0014 0016 003f 0016 003e 0016 0014 0016 003f 0016 0014 0016 0014 0016 0014 0016 003e 0016 003f 0016 0014 0016 003e 0016 003f 0016 003e 0016 0014 0016 003f 0016 0014 0016 0014 0016 003e 0016 0014 0016 0014 0016 0014 0016 003e 0016 06c3 00ab 00aa 0016 0014 0016 0e7d Use this file as an input parameter. Please note that the whole sequence for a each command should be on the same line. Olavi ------------------------------------------------------------------------- Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source. http://sourceforge.net/services/buy/index.php |
|
|
Re: New tool for converting pronto hex codes to lircd.conf>Just create a file with 2 rows each containing the whole sequence of
>commands: Thank you very much, it works like a charm! ;-) I attach the result and I add a couple of keywords, for people wandering around looking for UNIVERSAL LG DVD PLAYER/RECORDER DISCRETE ON/OFF COMMANDS (at least I guess it is universal: the remote of my LG DVD player works with my LG DVD recorder too!) RAW Pronto version: DVD ON 0000 006d 0022 0003 00ab 00aa 0016 003f 0016 0014 0016 003e 0016 003f 0016 0014 0016 003e 0016 0014 0016 0014 0016 003e 0016 0014 0016 003e 0016 003f 0016 0014 0016 003e 0016 0014 0016 0014 0016 003e 0016 0014 0016 003f 0016 0014 0016 003e 0016 003e 0016 003f 0016 0014 0016 0014 0016 003f 0016 0014 0016 003e 0016 0014 0016 0014 0016 0014 0016 003e 0016 06c3 00ab 00aa 0016 0014 0016 0e7d DVD OFF 0000 006d 0022 0003 00ab 00aa 0016 003e 0016 0014 0016 003f 0016 003e 0016 0014 0016 003e 0016 0014 0016 0014 0016 003e 0016 0014 0016 003f 0016 003e 0016 0014 0016 003f 0016 0014 0016 0014 0016 0014 0016 003e 0016 003f 0016 0014 0016 003e 0016 003f 0016 003e 0016 0014 0016 003f 0016 0014 0016 0014 0016 003e 0016 0014 0016 0014 0016 0014 0016 003e 0016 06c3 00ab 00aa 0016 0014 0016 0e7d RAW LIRC version is attached DVD ON: dvd-on.wav DVD OFF: dvd-off.wav Tested on LG DVD Recorder RH 255. Thanks again, now I'll try porting your program to Rapidq. |
|
|
Re: New tool for converting pronto hex codes to lircd.confI started porting to RapidQ.
It was quite strightforward, but I need some help as I don't know Python very well. What do these functions do? sub CreatePulses(sItems as string) ' dPulseWidths=[] # Table of Pulse widths. Length is repsented in microseconds ' for i in sItems: ' self.dPulseWidths.append(1000000*long(i,16)/self.dIRFrequency) # Convert pulse widths to uS ' if len(self.dPulseWidths)<>2*(self.lOnceSequenceLength+self.lRepeatableSequenceLength): ' raise "Number of actual codes does not match the header information!" end sub function AnalyzeCode(sCodeName as string , sHexCodes as string) as string ' sHexTable=sHexCodes.split() ' sCodeName=sCodeName.rstrip() # Name of the Code associated with code sequence ' self.ProcessPreamble(sHexTable[:4]) # First four sequences make up Preamble ' self.CreatePulses(sHexTable[4:]) # The rest are OnceSequence + RepeatableSequence ' return self.dPulseWidths[-1] # Final gap=last off signal length end function I don't know how lists, tables and arrays work in python... :-( |
|
|
|
|
|
RE: New tool for converting pronto hex codes to lircd.confHello AnalyzeCodes separates the header (first 4 ) and the main pulsesequences from pronto codes for futher processing. CreatePulses converts the pronto type pulse lenghts (which have relative lengths depending on the IR carrier defined in pronto header) to values which contains the pulse lengths in microseconds. To fully understand the logic of calculation I recommend reading up on the pronto format. For example: http://majority.110mb.com/files/pronto.pdf or from www.remotecentral.com. Python tutorial is at http://docs.python.org/tut/tut.html. Olavi -----Original Message----- From: lirc-list-bounces@... [mailto:lirc-list-bounces@...] On Behalf Of cassioli Sent: Monday, June 09, 2008 7:58 PM To: lirc-list@... Subject: Re: New tool for converting pronto hex codes to lircd.conf I started porting to RapidQ. It was quite strightforward, but I need some help as I don't know Python very well. What do these functions do? sub CreatePulses(sItems as string) ' dPulseWidths=[] # Table of Pulse widths. Length is repsented in microseconds ' for i in sItems: ' self.dPulseWidths.append(1000000*long(i,16)/self.dIRFrequency) # Convert pulse widths to uS ' if len(self.dPulseWidths)<>2*(self.lOnceSequenceLength+self.lRepeatableSequence Length): ' raise "Number of actual codes does not match the header information!" end sub function AnalyzeCode(sCodeName as string , sHexCodes as string) as string ' sHexTable=sHexCodes.split() ' sCodeName=sCodeName.rstrip() # Name of the Code associated with code sequence ' self.ProcessPreamble(sHexTable[:4]) # First four sequences make up Preamble ' self.CreatePulses(sHexTable[4:]) # The rest are OnceSequence + RepeatableSequence ' return self.dPulseWidths[-1] # Final gap=last off signal length end function I don't know how lists, tables and arrays work in python... :-( -- View this message in context: http://www.nabble.com/New-tool-for-converting-pronto-hex-codes-to-lircd.conf -tp17161702p17737188.html Sent from the LIRC mailing list archive at Nabble.com. ------------------------------------------------------------------------- Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source. http://sourceforge.net/services/buy/index.php ------------------------------------------------------------------------- Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source. http://sourceforge.net/services/buy/index.php |
|
|
Re: New tool for converting pronto hex codes to lircd.confHi!
Olavi Akerman "olavi.akerman@..." wrote: > I've attached the documentation to the email. > It uses the base layout and references that are used www.lirc.org > documentation. Thanks. It's in CVS now. Christoph ------------------------------------------------------------------------- Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source. http://sourceforge.net/services/buy/index.php |
| Free embeddable forum powered by Nabble | Forum Help |