Mailing List Archive

DCT2000 Serial Control
**long post

So following the directions and suggestions for getting the serial
connection on a DCT2000 working I've managed to come to a block. I
compiled, configured, and installed lirc from CVS using the serial
option (home-brew) and grabbed Ian's scripts. So far this is what I'm
getting.

From lircd: # modprobe lirc_serial
Jul 23 07:57:59 laptop kernel: lirc_serial: auto-detected active high
receiver
(same thing in dmesg)

in /dev/ I have: /dev/lircd= and /dev/lirc/serial

I copied the remote.py and crcgen.py to /usr/local/bin (changed
/dev/ttyS1 to /dev/ttyS0) and tried to execute the changechannel
script ... this is what I got:

# ./changechannel.sh 3
Traceback (most recent call last):
File "/usr/local/bin/remote.py", line 13, in ?
import crcgen # CRC generator - preset to generate
CCITT polynomial crc's
ImportError: No module named crcgen

I searched google for a while trying to find a crcgen module for
python and came up with nothing (not sure if they have a repository
for modules but I'm guessing they do and I just couldn't find it).
Anyway, just for the sake of debugging and to see if anything would
happen, I commented out the crcgen line and tried again:

File "/usr/local/bin/remote.py", line 111, in ?
stopbits=serial.STOPBITS_ONE, timeout=1, xonxoff=1,rtscts=0,)
File "/usr/lib/python2.2/site-packages/serial/serialposix.py", line
161, in __init__
raise serialutil.SerialException, "could not open port: %s" % msg
serial.serialutil.SerialException: could not open port: (5,
'Input/output error')

It seems like for some reason the supplied serial port isn't getting
passed to serialposix.py. Here's line 111 in remote.py:
serCon = serial.Serial('/dev/ttyS0',baudrate=9600,
bytesize=serial.EIGHTBITS, parity=serial.PARITY_NONE,
stopbits=serial.STOPBITS_ONE, timeout=1, xonxoff=1,rtscts=0,)

Does it seem like I'm at least on the right track (minus the minor
hang up)? I just dont want to spend a few days trying to debug and end
result if the thing that got me there started out wrong :) Either
way I'll keep hammering away at it ... just looking for
advice/suggestions.

Sorry for the long post,
Lonny
_______________________________________________
mythtv-users mailing list
mythtv-users@snowman.net
http://lists.snowman.net/cgi-bin/mailman/listinfo/mythtv-users
Re: DCT2000 Serial Control [ In reply to ]
On July 23, 2003, Lonny Selinger sent me the following:
> So following the directions and suggestions for getting the serial
> connection on a DCT2000 working I've managed to come to a block. I
> compiled, configured, and installed lirc from CVS using the serial
> option (home-brew) and grabbed Ian's scripts. So far this is what I'm
> getting.

I'm under the impression that this implementation has nothing to do
with lirc. I don't think you need it for controlling the DCT2000 via a
serial connection.

> I copied the remote.py and crcgen.py to /usr/local/bin (changed
> /dev/ttyS1 to /dev/ttyS0) and tried to execute the changechannel
> script ... this is what I got:
>
> # ./changechannel.sh 3
> Traceback (most recent call last):
> File "/usr/local/bin/remote.py", line 13, in ?
> import crcgen # CRC generator - preset to generate
> CCITT polynomial crc's
> ImportError: No module named crcgen
>
> I searched google for a while trying to find a crcgen module for
> python and came up with nothing (not sure if they have a repository
> for modules but I'm guessing they do and I just couldn't find it).
> Anyway, just for the sake of debugging and to see if anything would
> happen, I commented out the crcgen line and tried again:

The crcgen module is the crcgen.py file that you copied to
/usr/local/bin. Apparently your python isn't searching there for
includes. I'm not a Python expert, so I don't know where you should
put a module for it to be included, or how to modify the include path,
but I'm pretty sure that's what your problem is.

As for commenting it out, I'm under the impression that the control
code can't work without it, since the DCT2000 control codes appear to
contain a CRC checksum.

> File "/usr/local/bin/remote.py", line 111, in ?
> stopbits=serial.STOPBITS_ONE, timeout=1, xonxoff=1,rtscts=0,)
> File "/usr/lib/python2.2/site-packages/serial/serialposix.py", line
> 161, in __init__
> raise serialutil.SerialException, "could not open port: %s" % msg
> serial.serialutil.SerialException: could not open port: (5,
> 'Input/output error')
>
> It seems like for some reason the supplied serial port isn't getting
> passed to serialposix.py. Here's line 111 in remote.py:
> serCon = serial.Serial('/dev/ttyS0',baudrate=9600,
> bytesize=serial.EIGHTBITS, parity=serial.PARITY_NONE,
> stopbits=serial.STOPBITS_ONE, timeout=1, xonxoff=1,rtscts=0,)

Not sure on this one. You may want to try setting xonxoff=0 instead of
1, there was a post mentioning that earlier. Also, if you have lirc
running, make sure it's not using the port that the channel changing
script it trying to use (though I think that would be something other
than an "Input/output error")

--
Chip Marshall <chip@chocobo.cx> http://www.chocobo.cx/chip/
GCM/CS d+(-) s+:++ a22>? C++ UB++++$ P+++$ L- E--- W++ N@ o K- w O M+
V-- PS+ PE Y+ PGP++ t+@ R@ tv@ b++@ DI++++ D+(-) G++ e>++ h>++ r-- y?
Re: DCT2000 Serial Control [ In reply to ]
> I'm under the impression that this implementation has nothing to do
> with lirc. I don't think you need it for controlling the DCT2000 via a
> serial connection.

Thats a safe assumption after looking through the code more :\ I need
more sleep (but thank you for pointing it out) :)

> The crcgen module is the crcgen.py file that you copied to
> /usr/local/bin. Apparently your python isn't searching there for
> includes. I'm not a Python expert, so I don't know where you should
> put a module for it to be included, or how to modify the include path,
> but I'm pretty sure that's what your problem is.

I loaded python from the command line in verbose mode and saw where it
was loading other modules from, did an 'import crcgen' with crcgen.py
in my current directory, and copied the newly created crcgen.pyc and
crcgen.py to that directory (I know nothing about python but at least
some things are similar to other interpreted languages)

This seems to have cleared that up (for anyone else who might run into
the same issue ... BTW the dir I copied them to was:
/usr/lib/python2.2/

> As for commenting it out, I'm under the impression that the control
> code can't work without it, since the DCT2000 control codes appear to
> contain a CRC checksum.

All better now and not commented out.

>> It seems like for some reason the supplied serial port isn't getting
>> passed to serialposix.py. Here's line 111 in remote.py:
>> serCon = serial.Serial('/dev/ttyS0',baudrate=9600,
>> bytesize=serial.EIGHTBITS, parity=serial.PARITY_NONE,
>> stopbits=serial.STOPBITS_ONE, timeout=1, xonxoff=1,rtscts=0,)
>
> Not sure on this one. You may want to try setting xonxoff=0 instead of
> 1, there was a post mentioning that earlier. Also, if you have lirc
> running, make sure it's not using the port that the channel changing
> script it trying to use (though I think that would be something other
> than an "Input/output error")

Well I did some more looking in the script (remote.py) and found that
*part* of the issue was when I copied the script, it put a CR mid
line, so I joined the line and changed xonxoff to '0' ... I still get
the same error but now it prints the serCon to one line :\

Thanks for all the suggestions so far :) ... I'll continue to hammer
away!!

--
Lonny
_______________________________________________
mythtv-users mailing list
mythtv-users@snowman.net
http://lists.snowman.net/cgi-bin/mailman/listinfo/mythtv-users