Author Topic: gc100 and rs232 control  (Read 1834 times)

tschak909

  • LinuxMCE God
  • ****
  • Posts: 5476
  • DOES work for LinuxMCE.
    • View Profile
Re: gc100 and rs232 control
« Reply #15 on: November 13, 2013, 06:01:25 am »
It could mean the virtual serial device isn't working properly, for some reason. This is why I suggested to use a USB to serial converter for building your template.

Trust me, the name of the game when doing smart home work, is to work on one problem at a time.. it is a living hell fighting a battle on multiple fronts, get rid of ones that you can get rid of, even if it is only temporary, so that you can accomplish things.

-Thom

mikeybs

  • Regular Poster
  • **
  • Posts: 47
    • View Profile
Re: gc100 and rs232 control
« Reply #16 on: November 13, 2013, 06:55:27 am »
My best guess is that the problem lies with the virtual serial device /dev/ttyS_38_0

I am still at a loss as how to use the protocol sheet correctly...

When I put "11 00 00 00 03" into a hex translator (http://www.qbit.it/lab/hextext.php) it does not produce any text output

Can you give me one more example with the hex of a full command that would be sent to the receiver?  I think with that I would be able to generate the rest of them myself...

So the first part would have to be the ready message as described above, which the sheet says must come at the beginning of all communication.

What I have been working on is trying to get the receiver to switch to the HDMI 1 input.  On the protocol sheet in the Operation Commands table on page 14 that is listed as: 0784A

How do I incorporate that into the hex string I send?

I tried translating 0784A to hex: 30 37 38 34 41

and then adding that to the end of the ready command to create this hex string: "11 00 00 00 03 30 37 38 34 41"

I tested that with the iTest.exe application and it seemed to generate the same output as the ready command by itself.  The receiver did not change to the HDMI 1 input....

tschak909

  • LinuxMCE God
  • ****
  • Posts: 5476
  • DOES work for LinuxMCE.
    • View Profile
Re: gc100 and rs232 control
« Reply #17 on: November 13, 2013, 06:59:41 am »
No, you need to read the protocol sheet more. Look at page 9. It shows the correct format to form a command frame.

-Thom

mikeybs

  • Regular Poster
  • **
  • Posts: 47
    • View Profile
Re: gc100 and rs232 control
« Reply #18 on: November 13, 2013, 07:11:35 am »
ok, I will do that

any advice on figuring out why the virtual serial port /dev/ttyS_38_0 is not working with the TestSerialPort command? 

Clearly the gc100 is working along with the serial cable since I am able to get feedback with the iTest.exe application.  How can I go about debugging the virtual serial port?  I would rather work on this problem first.  If I can't solve it there is no point in generating a template as I need to use my gc100 to control the receiver.  If I can't get the gc100 virtual serial port working I'd prefer to switch to IR control. 

I've got the gc100 using IR to successfully control both my TV and Verizon STB in this entertainment area.  I wanted to use RS232 for the receiver since it supports it, but if I can't get the gc100 to play nicely with the virtual serial port, then IR is my only option.

tschak909

  • LinuxMCE God
  • ****
  • Posts: 5476
  • DOES work for LinuxMCE.
    • View Profile
Re: gc100 and rs232 control
« Reply #19 on: November 13, 2013, 07:18:33 am »
check to see if socat is running, in a shell.. (ps auwwx | grep "socat"), also look for /var/log/pluto/socat_DEVICENUMBER.log files, as these output what is being sent to the GC100's serial port.

-Thom

mikeybs

  • Regular Poster
  • **
  • Posts: 47
    • View Profile
Re: gc100 and rs232 control
« Reply #20 on: November 13, 2013, 07:31:29 am »
socat is running:

socat -v TCP4:192.168.80.134:4999 PTY,link=/dev/ttyS_38_0,echo=0,icanon=0,raw

cat /var/log/pluto/socat_ttyS_38_0.log
< 2013/11/12 22:59:04.913110  length=10 from=0 to=9
1100000003< 2013/11/12 23:01:41.549003  length=10 from=10 to=19
1100000003< 2013/11/12 23:02:39.257161  length=10 from=20 to=29
1100000003< 2013/11/12 23:13:45.712855  length=10 from=30 to=39
11000000032013/11/12 23:16:13 socat[9884] E read(4, 0x8bb0e90, 8192): Connection timed out
< 2013/11/12 23:33:54.189209  length=10 from=0 to=9
11000000032013/11/12 23:51:03 socat[3137] E read(4, 0x9d4ce90, 8192): Connection timed out


Also, I finally pieced together what to do for the protocol sheet after staring a bit longer :)  I was able to switch between HDMI input using the iTest.exe application

now I just need to get the virtual serial port working and I'll be off to the races...

mikeybs

  • Regular Poster
  • **
  • Posts: 47
    • View Profile
Re: gc100 and rs232 control
« Reply #21 on: November 13, 2013, 08:36:00 am »
ok, I am now able to send all the commands I need to the gc100 serial port using the iTest.exe application, but I am still unable to do it using linuxmce.

I have created the template and put in the hex codes in pronto format for all the commands I require.  Are there any linuxmce tools to test the basic functionality of a device.  None of the commands are working while I am editing the device template, but I am wondering if that is because the template does not know to use the gc100 virtual serial port.  That setting is on the device itself, not the template...

Now that I have all the hex codes I need, where do I go from here to get it working on linuxmce?

It's a good day though :)  I finally got the RS232 on the gc100 to send commands to my receiver!

mikeybs

  • Regular Poster
  • **
  • Posts: 47
    • View Profile
Re: gc100 and rs232 control
« Reply #22 on: November 14, 2013, 01:25:25 am »
I've been attempting to turn the receiver on and off instead of using the ready command.  My TestSerialPort command looks like this

on:
/usr/pluto/bin/TestSerialPort -p /dev/ttyS_45_0 -b 9600 -P N81 -t "\02\00\37\38\37\45\03"

off:
/usr/pluto/bin/TestSerialPort -p /dev/ttyS_45_0 -b 9600 -P N81 -t "\02\00\37\38\37\46\03"

This is on a brand new 1204 install which I just got working today :)

I'm not having any success with the gc100 serial port though.  Both those commands hang for a bit and then return nothing.  Receiver does nothing.

socat is running:
ps aux|grep socat
root      1678  0.0  0.0   5484  1528 pts/31   S+   19:03   0:00 socat -v TCP4:192.168.80.133:4999 PTY,link=/dev/ttyS_45_0,echo=0,icanon=0,raw


cat /var/log/pluto/socat_ttyS_45_0.log < 2013/11/13 19:11:42.706137  length=7 from=0 to=6
..787E.< 2013/11/13 19:15:10.413205  length=7 from=7 to=13
..787E.< 2013/11/13 19:18:07.623543  length=7 from=14 to=20
..787F.< 2013/11/13 19:18:32.738888  length=7 from=21 to=27
..787F.< 2013/11/13 19:19:21.106566  length=7 from=28 to=34
..787E.< 2013/11/13 19:20:23.914085  length=7 from=35 to=41
..787E.< 2013/11/13 19:21:13.898427  length=7 from=42 to=48
..787E.


If anyone would like more information or has any ideas just let me know...

mikeybs

  • Regular Poster
  • **
  • Posts: 47
    • View Profile
Re: gc100 and rs232 control
« Reply #23 on: November 14, 2013, 06:43:14 am »
I haven't gone back to the 1004 install yet, but I figured out the problem on 1204, odds are it's the same issue...

Problem was permissions on the virtual serial device for the gc100: /dev/ttyS_45_0 -> /dev/pts/32

/dev/pts/32 was set 600, I changed it to 660

after that the /usr/pluto/bin/TestSerialPort commands began working as expected :)  My receiver is doing things!

Now back to trying to get a functional template...

thank you for all the help

tschak909

  • LinuxMCE God
  • ****
  • Posts: 5476
  • DOES work for LinuxMCE.
    • View Profile
Re: gc100 and rs232 control
« Reply #24 on: November 14, 2013, 06:50:07 am »
Awesome! can you file a ticket in svn.linuxmce.org so that we can fix this permanently? :)

-Thom

mikeybs

  • Regular Poster
  • **
  • Posts: 47
    • View Profile
Re: gc100 and rs232 control
« Reply #25 on: November 14, 2013, 08:24:45 am »
http://svn.linuxmce.org/trac/ticket/1963

there you go


I'm not able to successfully generate commands from within my new template, when I attempt to test codes my receiver is unresponsive and I don't see any output in /var/log/pluto/socat_ttyS_45_0.log

I'm hoping this is because the template is unaware of which serial port to use.  I created the template and the device and then set the COM Port on PC to /dev/ttyS_45_0

From here I am not quite sure how to test my rs232 receiver configuration.  I've also added my TV and my verizon STB, those templates are working perfectly and I can test all the codes without a problem.  I used the connection wizard to describe how the STB goes to the receiver which then goes to the TV.  How can I get linuxmce to execute this and power on these devices and switch their inputs etc, and then power them down?

tschak909

  • LinuxMCE God
  • ****
  • Posts: 5476
  • DOES work for LinuxMCE.
    • View Profile
Re: gc100 and rs232 control
« Reply #26 on: November 14, 2013, 03:54:03 pm »
Do you see messages going to your device in the DCERouter log? Anything in the socat log? If all the pipes are connected correctly, then the system should know to execute the relevant commands to your target device...

-Thom

mikeybs

  • Regular Poster
  • **
  • Posts: 47
    • View Profile
Re: gc100 and rs232 control
« Reply #27 on: December 10, 2013, 10:03:20 pm »
I don't see any messages going to my receiver in /var/log/pluto/socat_ttyS_45_0.log

I am wondering if I am running into issues because I do not have a media director involved in the setup...

All of my pipes seems to be set up correctly as far as I can tell...

So far the only way I am able to successfully send any rs232 commands to the receiver is with /usr/pluto/bin/TestSerialPort

I am not able to test commands successfully either in device template or by attempting to launch a scenario in LMCE

mikeybs

  • Regular Poster
  • **
  • Posts: 47
    • View Profile
Re: gc100 and rs232 control
« Reply #28 on: December 10, 2013, 10:34:36 pm »
I do see some output in 49_Generic_Serial_Device.log, a bunch of error messages and "failure loading code", that is my receiver device.

I am wondering if I am not putting the correct commands in the template...

I have figured out all the commands I need from the protocol sheet and I am able to send them to the receiver using the /usr/pluto/bin/TestSerialPort

But I am not sure I am putting those commands in the correct format in the template...

I can use this command on the CLI to turn my receiver off:
/usr/pluto/bin/TestSerialPort -p /dev/ttyS_45_0 -b 9600 -P N81 -t "\02\00\37\38\37\46\03"

what should that correspond to in the template IR codes?  I have tried a few different values trying to get anything to work, but so far I have not have any luck.  For other yamamha rs232 receivers I can see exisitng IR commands of the format:
SendIrCommand("07A15")

Should I be using commands like that?  Or should I be translating into pronto format?

If someone could tell me what to place in the template IR code box that corresponds to:
/usr/pluto/bin/TestSerialPort -p /dev/ttyS_45_0 -b 9600 -P N81 -t "\02\00\37\38\37\46\03"

I would be able to tell if what I am doing for the rest of my commands is correct...



here is some of the log for 49_Generic_Serial_Device.log:

   12/10/13 12:13:25.442      Failed loading code: Error loading code:
error: (eval):387: compile error
(eval):70: syntax error, unexpected tINTEGER, expecting kEND
0000 006D 0022 0002 0155 00AA 0015 001...
        ^
(eval):76: syntax error, unexpected tINTEGER, expecting kEND
0000 006D 0022 0002 0155 00AA 0015 001...
        ^
(eval):158: syntax error, unexpected tINTEGER, expecting kEND
02 00 37 38 34 41 03
     ^
(eval):372: syntax error, unexpected tINTEGER, expecting kEND
02 00 37 38 44 30 03
     ^
(eval):378: syntax error, unexpected tINTEGER, expecting kEND
02 00 37 38 32 41 03
     ^, line: 387
. <0xb53ffb40>
05   12/10/13 15:53:33.287      Got a reload command from 0  <0xb5dffb40>
05   12/10/13 15:53:33.743      void ClientSocket::Disconnect() on this socket: 0x84205f8 (m_Socket: 8) <0xb77e1ac0>
Return code: 2
2   12/10/13 15:53:34   49 (spawning-device)   Device requests restart... count=1/50 dev=49
Tue Dec 10 15:53:34 EST 2013 Restart
========== NEW LOG SECTION ==========
1   12/10/13 15:53:42   49 (spawning-device)   Starting... 1
1   12/10/13 15:53:43   49 (spawning-device)   Found /usr/pluto/bin/Generic_Serial_Device
RCODE:

tschak909

  • LinuxMCE God
  • ****
  • Posts: 5476
  • DOES work for LinuxMCE.
    • View Profile
Re: gc100 and rs232 control
« Reply #29 on: December 10, 2013, 11:12:08 pm »
It looks like your ruby code has been overwritten by Pronto codes, please edit the ruby codes, and ensure they are correct.

-Thom