LinuxMCE Forums

General => Users => Topic started by: mikeybs on October 29, 2013, 08:17:32 pm

Title: gc100 and rs232 control
Post by: mikeybs on October 29, 2013, 08:17:32 pm
I am trying to control a yamaha YSP5100BL soundbar/receiver via rs232 with the gc100.  I have found the rs232 protocol sheet for the receiver on the yahama website.

I am running lmce1004.  The gc100 was autodetected and setup.  I am using the IR transmitters without an issue.  The serial port was created on the core as /dev/ttyS_38_0 and I have selected that in the receiver device data as the value of "COM Port on PC".  

I went to the gc100 web admin and set up the serial port as described in the yahama protocol sheet:
baud rate: 9600
flow control: hardware
parity: no

The cable I am using to connect the gc100 serial port to the receiver serial port is described as a "DB9 RS232 Serial Null Modem Cable".  Perhaps the cable is my issue?  

I initially chose the "Yahama RX Receivers RS232" as the "Group/Codeset", but it doesn't appear that those codes match up well with my receiver.  I have been attempting to replace the rs232 codes in the template with the ones in the protocol sheet I have.  I am not having any success with this though.  I have yet to successfully send any sort of command to the receiver.

Can anyone suggest what I should attempt next?

Is there any other information I can provide?
Title: Re: gc100 and rs232 control
Post by: tschak909 on October 29, 2013, 10:03:51 pm
I would suggest grabbing an RS-232 in line tester, it's a device with LEDs on each pin, so you can see what's actually happening.

You can use the TestSerialPort command in /usr/pluto/bin to try sending commands to the device, run it without parameters to see what parameters it uses. You'll need to set the port to one of the ports that are exposed by the GC100 driver.

-Thom
Title: Re: gc100 and rs232 control
Post by: mikeybs on October 29, 2013, 10:40:41 pm
yeah I've been trying to use the TestSerialPort utility to see if I can get a successful send that way.  I don't think I am writing my commands properly though, I'm not that familiar with serial port stuff...  I am not sure how to generate the correct transmit string.

I tried:

/usr/pluto/bin/TestSerialPort -p /dev/ttyS_38_0 -t 0787F -b 9800


I'm guessing that 0787F needs to be rewritten, can anyone assist in how to do that?
Title: Re: gc100 and rs232 control
Post by: tschak909 on October 29, 2013, 10:48:09 pm
If that is hexadecimal, then you need to use the hex notation, \xNN\xNNx\xNN, where NN is a hexadecimal number:

01050F would be written as:

\x01\x05\x0F

-Thom
Title: Re: gc100 and rs232 control
Post by: mikeybs on October 29, 2013, 11:35:27 pm
so I'm thinking this is the correct command:

/usr/pluto/bin/TestSerialPort -p /dev/ttyS_38_0 -t "\x00\x78\x7F" -b 9600 -P N81

but the receiver does nothing when I send it...

I am still wondering if maybe I have the wrong type of cable.  I am rs232 newbie, so not quite sure.  Here is the cable I am using...  I tried putting in an actual link, but the forum will not let me.

"amazon.com/gp/product/B00006B8BJ/ref=oh_details_o07_s00_i00?ie=UTF8&psc=1"
Title: Re: gc100 and rs232 control
Post by: mikeybs on October 29, 2013, 11:58:25 pm
I'm trying to use the globalcache itest.exe application to see if I can get it working that way...

still no luck

I am not sure I am doing the hex translation correctly.  The "Yahama RX Receivers RS232" "Group/Codeset" has IR commands that look like the following in it's A/V Properties:

SendIrCommand("07A15")

The codes in my protocol sheet appear to be very similar... I am attempting to send what is listed in my protocol sheet as: "0787F"

The itest.exe application will accept either string literals or hex input, so I am trying to use the hex input...

I used a hex code translator to turn "0787F" into "30 37 38 37 46" and then I entered that into the hex input of itest.exe and the receiver does nothing.  I also tried these for the hex codes:

00 78 7F
00 07 08 07 0F

neither of those worked either

itest.exe does seem to successfully connect to the serial port of the gc100 though.

I am back to wondering if the cable is my problem, or if I am screwing up the hex format in some way....
Title: Re: gc100 and rs232 control
Post by: tschak909 on October 30, 2013, 12:22:02 am
Again, I would recommend inserting an RS-232 tester, and get a straight through cable, to test. Some devices need a null modem cable, some devices want a straight through cable.

-Thom
Title: Re: gc100 and rs232 control
Post by: mikeybs on October 30, 2013, 12:43:01 am
ok, I'll get a straight through cable and try that, if I still have issues I'll get the tester too, thanks for the advice
Title: Re: gc100 and rs232 control
Post by: mikeybs on October 30, 2013, 03:37:58 am
I am pretty sure the cable I need is a null modem cable :(  So I guess I just ordered a cable for nothing.  Looking at this PDF:

"www.customcodecrafters.com/pdfs/C3%20Yamaha%20YSP-4100%20+%20YSP-5100%20sound%20projector%20help.pdf"

it appears my receiver/soundbar requires a null modem cable.  The cable I am using is brand new, the link for it is in one of my previous posts in this thread.  So looks like I am back to the drawing board.  I guess I'll have to buy a tester to see if the signals are going through...
Title: Re: gc100 and rs232 control
Post by: mikeybs on October 30, 2013, 03:40:43 am
here is a link to the protocol sheet for my receiver/soundbar as well if it is of any help

http://www.awe-europe.com/documents/Control%20Docs/Yamaha/YSP_4100_RS232Full.zip
Title: Re: gc100 and rs232 control
Post by: mikeybs on November 13, 2013, 02:18:16 am
well I now have both an inline tester as well as a straight through serial cable and I am still unable to get things working.  According to the tester the signals are coming across the wire.

I am thinking that I am simply not generating the correct codes to send using the protocol sheet.  I am not sure what I am doing wrong.  In my previous post there is a link to the protocol sheet for my receiver.  I would really appreciate it if anyone could help me generate the correct commands for TestSerialPort, or the correct hex codes so that I can use the globalcache iTest.exe application to test.

The core groups of commands I am interested in are:

Power On
Stand By
Volume Up
Volume Down
HDMI 1
HDMI 2
HDMI 3
HDMI 4


If anyone could help me determine the correct TestSerialPort command for any one of those receiver commands it would be fantastic.
Title: Re: gc100 and rs232 control
Post by: tschak909 on November 13, 2013, 04:05:02 am
From my glances of the protocol sheet, I've gathered:

* A crossover (null modem) cable is required, as RXD/TXD are swapped on both ends of the cable.
* fairly standard RS232 settings, 9600 BPS, N, 8, 1, which is what the generic serial device does by default.
* the protocol is a mash of binary and ASCII, and very compact.

DC1/DC2/ETX are ASCII control characters (which have their roots in Teletype communication, but I digress), look at an ASCII chart for their equivalents, like:

http://www.asciitable.com/index/asciifull.gif

As you see, 0x11 (hex) is DC1, which translates to \11 in TestSerialCommand or \x11 within a GSD string.

The values to use for timeout are specified there in the protocol sheet, but I will just for example say timeout is 0, so, TOUT 1 2 and 3 would all be 0.
so for the ready command (which according to the specification must be sent at the start of any communication), you would do for TestSerialPort:

Code: [Select]
\11\00\00\00\03

This should spit back a long string of data. Let's see if this does anything, first.

-Thom
Title: Re: gc100 and rs232 control
Post by: mikeybs on November 13, 2013, 05:04:49 am
I attempted to run this as root:

/usr/pluto/bin/TestSerialPort -P N81 -t \11\00\00\00\03 -b 9600 -p /dev/ttyS_38_0

it hung for a few seconds and then completed, there was no output

On the gc-100 web interface, what should the serial port settings for "Flow Control" be?  "Hardware" or "None" are the options...  I tried it with both settings, neither produced any output
Title: Re: gc100 and rs232 control
Post by: tschak909 on November 13, 2013, 05:07:31 am
it should be hardware. You're not seeing any blinking happening with the serial port breakout? I would suggest testing with a USB to serial converter while you build the protocol, it'll be one less thing to worry about.

-Thom
Title: Re: gc100 and rs232 control
Post by: mikeybs on November 13, 2013, 05:39:59 am
I was able to get feedback using the iTest.exe application from globalcache.

I used the application to connect to the Serial Port and then sent the Hex command string:  \11\00\00\00\03

I received a very long response just as you suggested I would :)

That is the first feedback I've gotten from the receiver via RS232 so thank you for helping me achieve that. 

Perhaps I messed something up in the TestSerialPort command?

should the output for it come right through on STDOUT, or do I have to specify a "-s Search String" or "-m message to log" to see some output?

Could this mean the issue is with the virtual serial port on the linuxmce core.... /dev/ttyS_38_0? 
Title: Re: gc100 and rs232 control
Post by: tschak909 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
Title: Re: gc100 and rs232 control
Post by: mikeybs 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....
Title: Re: gc100 and rs232 control
Post by: tschak909 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
Title: Re: gc100 and rs232 control
Post by: mikeybs 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.
Title: Re: gc100 and rs232 control
Post by: tschak909 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
Title: Re: gc100 and rs232 control
Post by: mikeybs 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...
Title: Re: gc100 and rs232 control
Post by: mikeybs 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!
Title: Re: gc100 and rs232 control
Post by: mikeybs 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...
Title: Re: gc100 and rs232 control
Post by: mikeybs 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
Title: Re: gc100 and rs232 control
Post by: tschak909 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
Title: Re: gc100 and rs232 control
Post by: mikeybs 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?
Title: Re: gc100 and rs232 control
Post by: tschak909 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
Title: Re: gc100 and rs232 control
Post by: mikeybs 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
Title: Re: gc100 and rs232 control
Post by: mikeybs 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:
Title: Re: gc100 and rs232 control
Post by: tschak909 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
Title: Re: gc100 and rs232 control
Post by: mikeybs on December 11, 2013, 12:07:22 am
ok, I think I've got my ruby commands squared away now, there is still no way to test them from within the template so I am not sure....

is there any way to test device commands?  My template doesn't know I am using the gc100 virtual serial port so I can't test from within the template...

I am getting this in my receiver log file now:

407:01   12/10/13 17:49:45.524      Error while calling method: Cannot call class method: cmd_350
error: SIGHUP, line: 118
backtrace:
   in: (eval): 118
   from (eval):118:in `cmd_350'
 <0xb53ffb40>
05   12/10/13 17:49:45.639      Socket::ReceiveData 0x9f065f8 failed, bytes left 0 start: 5550000 1: 0 1b: 0 2: 0 2b: 0 m_Socket: 8 Command_Impl1 Dev #49 <0xb5dffb40>
05   12/10/13 17:49:45.640      Socket::ReceiveString2 ReceiveData failed m_Socket: -1 Command_Impl1 Dev #49 <0xb5dffb40>
01   12/10/13 17:49:45.640      Receive string failed in HandleRequestSocket 18:ReceiveData failed Command_Impl1 Dev #49 <0xb5dffb40>
05   12/10/13 17:49:45.640      Dumping 1 locks <0xb5dffb40>
05   12/10/13 17:49:45.640      finished check for exceptions <0xb5dffb40>
05   12/10/13 17:49:45.640      OL: (0x9f06744) (>91) MessageQueue Command_Impl.cpp l:852 time: 7:00:00p (1386715785 s) thread: 3061214016 Rel: Y Got: Y <0xb5dffb40>
== ATTEMPT FRESH START ==
1   12/10/13 17:52:37   /usr/pluto/bin/Spawn_Device.sh 49 (spawning-device)   10831 Dev: 49; Already Running list: 15,16,18,19,29,30,31,45,
== FRESH START ==
1   12/10/13 17:52:37   /usr/pluto/bin/Spawn_Device.sh 49 (spawning-device)   device: 49 ip: localhost cmd_line: Generic_Serial_Device
0   12/10/13 17:52:37   49 (spawning-device)   Entering 49
========== NEW LOG SECTION ==========
1   12/10/13 17:52:37   49 (spawning-device)   Starting... 1
1   12/10/13 17:52:38   49 (spawning-device)   Found /usr/pluto/bin/Generic_Serial_Device
Title: Re: gc100 and rs232 control
Post by: mikeybs on December 11, 2013, 01:42:12 am
here is an attached image of my connection wizard to show how my pipes are connected...

I thought I remember reading that scenarios should be automatically generated after I've set up all the AV equipment, but nothing like that happened for me. 

I tried manually creating a "verzion" scenario with the objective of have the tv power on and turn to HDMI input, the receiver power on and turn to HDMI 3 input, and the verizon STB powering on... but I have not been able to get anything like that happening.  None of my components respond in any way except for my ability to successfully test IR commands to the TV and verizon STB in the templates where IR codes are defined.  Using that mechanism I am able to make all the things happen to the verizon STB and TV that I want.  As far as the receiver, that is rs232 and I am only able to send it commands successfully via the /usr/pluto/bin/TestSerialPort utility.

My setup includes all of this connected to a gc100, there is no MD. 

Any advice would be appreciated, not sure where to go at this point...
Title: Re: gc100 and rs232 control
Post by: tschak909 on December 11, 2013, 01:45:42 am
Can you please paste the code output of the GSD from the log? Also, can you paste the contents of command 350?

-Thom
Title: Re: gc100 and rs232 control
Post by: mikeybs on December 11, 2013, 01:56:37 am
here is the GSD log

407:01   12/10/13 17:49:45.524      Error while calling method: Cannot call class method: cmd_350
error: SIGHUP, line: 118
backtrace:
   in: (eval): 118
   from (eval):118:in `cmd_350'
 <0xb53ffb40>
05   12/10/13 17:49:45.639      Socket::ReceiveData 0x9f065f8 failed, bytes left 0 start: 5550000 1: 0 1b: 0 2: 0 2b: 0 m_Socket: 8 Command_Impl1 Dev #49 <0xb5dffb40>
05   12/10/13 17:49:45.640      Socket::ReceiveString2 ReceiveData failed m_Socket: -1 Command_Impl1 Dev #49 <0xb5dffb40>
01   12/10/13 17:49:45.640      Receive string failed in HandleRequestSocket 18:ReceiveData failed Command_Impl1 Dev #49 <0xb5dffb40>
05   12/10/13 17:49:45.640      Dumping 1 locks <0xb5dffb40>
05   12/10/13 17:49:45.640      finished check for exceptions <0xb5dffb40>
05   12/10/13 17:49:45.640      OL: (0x9f06744) (>91) MessageQueue Command_Impl.cpp l:852 time: 7:00:00p (1386715785 s) thread: 3061214016 Rel: Y Got: Y <0xb5dffb40>
== ATTEMPT FRESH START ==
1   12/10/13 17:52:37   /usr/pluto/bin/Spawn_Device.sh 49 (spawning-device)   10831 Dev: 49; Already Running list: 15,16,18,19,29,30,31,45,
== FRESH START ==
1   12/10/13 17:52:37   /usr/pluto/bin/Spawn_Device.sh 49 (spawning-device)   device: 49 ip: localhost cmd_line: Generic_Serial_Device
0   12/10/13 17:52:37   49 (spawning-device)   Entering 49
========== NEW LOG SECTION ==========
1   12/10/13 17:52:37   49 (spawning-device)   Starting... 1
1   12/10/13 17:52:38   49 (spawning-device)   Found /usr/pluto/bin/Generic_Serial_Device
RCODE:
   0:require 'Ruby_Generic_Serial_Device'
   1:class Command < Ruby_Generic_Serial_Device::RubyCommandWrapper
   2:end
   3:class Device_49 < Ruby_Generic_Serial_Device::RubySerialIOWrapper
   4:#### 89 ####################################################################
   5:def cmd_89(repeat_command, cmd=nil)
   6:@returnParamArray.clear
   7:SendMyIrCommand("781E")
   8:return @returnParamArray
   9:end
  10:#### 90 ####################################################################
  11:def cmd_90(repeat_command, cmd=nil)
  12:@returnParamArray.clear
  13:SendMyIrCommand("781F")
  14:return @returnParamArray
  15:end
  16:#### 97 ####################################################################
  17:def cmd_97(cmd=nil)
  18:@returnParamArray.clear
  19:# Mute - Date: 2007-02-22 12:41:58
  20:
  21:if(@mute[cmd.devidto_])
  22:  SendMultiZoneCommand(cmd, ["07EA3", "07EA1", "07E66"])
  23:else
  24:  SendMultiZoneCommand(cmd, ["07EA2", "07EA0","07E26"])
  25:end
  26:@mute[cmd.devidto_]=!@mute[cmd.devidto_]
  27:
  28:return @returnParamArray
  29:end
  30:#### 161 ####################################################################
  31:def cmd_161(cmd=nil)
  32:@returnParamArray.clear
  33:SendIrCommand("07A54")
  34:return @returnParamArray
  35:end
  36:#### 162 ####################################################################
  37:def cmd_162(cmd=nil)
  38:@returnParamArray.clear
  39:SendIrCommand("07A15")
  40:
  41:return @returnParamArray
  42:end
  43:#### 163 ####################################################################
  44:def cmd_163(cmd=nil)
  45:@returnParamArray.clear
  46:SendIrCommand("07A14")
  47:return @returnParamArray
  48:end
  49:#### 165 ####################################################################
  50:def cmd_165(cmd=nil)
  51:@returnParamArray.clear
  52:SendMultiZoneCommand(cmd, ["07AC1", "07ACD", "07AFC"])
  53:return @returnParamArray
  54:end
  55:#### 166 ####################################################################
  56:def cmd_166(cmd=nil)
  57:@returnParamArray.clear
  58:SendIrCommand("07A16")
  59:return @returnParamArray
  60:end
  61:#### 174 ####################################################################
  62:def cmd_174(cmd=nil)
  63:@returnParamArray.clear
  64:SendIrCommand("07AC9")
  65:return @returnParamArray
  66:end
  67:#### 192 ####################################################################
  68:def cmd_192(pk_pipe, pk_device_pipes, cmd=nil)
  69:@returnParamArray.clear
  70:SendMyIrCommand("787E")
  71:return @returnParamArray
  72:end
  73:#### 193 ####################################################################
  74:def cmd_193(pk_pipe, cmd=nil)
  75:@returnParamArray.clear
  76:SendMyIrCommand("787F")
  77:return @returnParamArray
  78:end
  79:#### 228 ####################################################################
  80:def cmd_228(cmd=nil)
  81:@returnParamArray.clear
  82:SendIrCommand("27500") # that if Bass Sel is the same as LFE/Bass
  83:return @returnParamArray
  84:end
  85:#### 281 ####################################################################
  86:def cmd_281(cmd=nil)
  87:@returnParamArray.clear
  88:SendIrCommand("07AC0")
  89:return @returnParamArray
  90:end
  91:#### 282 ####################################################################
  92:def cmd_282(cmd=nil)
  93:@returnParamArray.clear
  94:SendIrCommand("07A0F")
  95:return @returnParamArray
  96:end
  97:#### 285 ####################################################################
  98:def cmd_285(cmd=nil)
  99:@returnParamArray.clear
 100:SendIrCommand("07A55")
 101:return @returnParamArray
 102:end
 103:#### 313 ####################################################################
 104:def cmd_313(level, cmd=nil)
 105:@returnParamArray.clear
 106:# Set Volume - Date: 2007-02-22 12:41:58
 107:
 108:SendMultiZoneCommand( cmd, ["230", "", "", ""], sprintf( "%x", level.to_i * 1.73 + 38) )
 109:
 110:SetDeviceDataInDB( cmd.devidto_, 158, level ) # 158 = DEVICEDATA_Volume_Level_CONST
 111:
 112:print "volume and corresponding device data set\n"
 113:
 114:return @returnParamArray
 115:end
 116:#### 350 ####################################################################
 117:def cmd_350(cmd=nil)
 118:@returnParamArray.clear
 119:ReceiveReportCommand()
 120:return @returnParamArray
 121:end
 122:#### 355 ####################################################################
 123:def cmd_355(cmd=nil)
 124:@returnParamArray.clear
 125:# Initialize --- Date: 21.02.2007
 126:$logFile = File.new("/var/log/pluto/yamaha.log", "w")
 127:
 128:@mute = [false, false, false, false];
 129:
 130:@input=-1
 131:for iRetry in 0...4
 132:    print "Initializing unit\n"
 133:    conn_.Send("\x11000\x03")
 134:    buf = conn_.RecvDelimited("\x03", 2000)
 135:    model_id = GetCurrentDeviceData( device_.devid_, 59 ) # 59 = DEVICEDATA_Configuration_CONST
 136:    if( !buf.nil? && !buf.index("\x12").nil? )
 137:        print "Initialized ok\n"
 138:      volume_level = GetCurrentDeviceData( device_.devid_, 207 ) # 59 = DEVICEDATA_Initial_Volume_CONST
 139:      if( !volume_level.empty? && volume_level!="ERR Parameter not found" )
 140:         print "Setting volume to ", volume_level, "\n"
 141:         cmd_313(volume_level)
 142:         SetDeviceDataInDB( device_.devid_, 158, volume_level ) # 158 = DEVICEDATA_Volume_Level_CONST
 143:      end
 144:        return
 145:    end
 146:    print "Failed to initialize.  Wait 1 secs and try again\n"
 147:    sleep(1)
 148:end
 149:
 150:#DisableDevice( device_.devid_, true )
 151:print "The device wouldn't respond. Disabling it.\n"
 152:
 153:return @returnParamArray
 154:end
 155:#### 361 ####################################################################
 156:def cmd_361(cmd=nil)
 157:@returnParamArray.clear
 158:SendMyIrCommand("784A")
 159:return @returnParamArray
 160:end
 161:#### PRIVATE METHODS ####################################################################
 162:# Private - Date: 2007-02-22 17:43
 163:def SendMyIrCommand(command)
 164:   for i in 0...4
 165:      conn_.Send("\x02\x00" + command + "\x03")
 166:      reply = ReceiveReportCommand()
 167:      if( !reply.nil? && reply.length()>4 )
 168:         print "Received good reply: ", reply, "\n"
 169:         return
 170:      else
 171:         buf = conn_.Recv(1000,1000);
 172:         print "Flushed buffer: ", buf, "\n"
 173:      end
 174:   end
 175:end
 176:
 177:def SendIrCommand(command)
 178:   for i in 0...4
 179:      conn_.Send("\x02" + command + "\x03")
 180:      reply = ReceiveReportCommand()
 181:      if( !reply.nil? && reply.length()>4 )
 182:         print "Received good reply: ", reply, "\n"
 183:         return
 184:      else
 185:         buf = conn_.Recv(1000,1000);
 186:         print "Flushed buffer: ", buf, "\n"
 187:      end
 188:   end
 189:end
 190:
 191:def ReceiveReportCommand()
 192:   for i in 0...200
 193:      buf = conn_.Recv(1,3000);
 194:      if( buf.length()==0 )
 195:         return
 196:      end # nothing to do
 197:      if( buf[0]==0x02 )
 198:         buf = conn_.Recv(7,500);
 199:         if( buf[6]!=0x03 )
 200:            print "Received malformed status: ", buf,"\n"
 201:            return ""
 202:         end
 203:
 204:         ProcessReportCommand(buf)
 205:         return buf
 206:      else
 207:         if( buf[0]==0x12 )
 208:            ReceiveConfigurationCommand()
 209:         else
 210:            print "Received unknown character: ", buf[0],"\n"
 211:         end
 212:      end
 213:   end
 214:end
 215:
 216:def ProcessReportCommand(command)
 217:   if( command[0,1]=="1" || command[0,1]=="2" )
 218:      print "Received command ", command[2,2], "\n"
 219:      if( command[2,2]=="20" )
 220:         if( command[4,2]=="00" )
 221:               cmd = Command.new(device_.devid_, -1001, 1, 2, 48);
 222:               cmd.params_[10] = "0";
 223:               SendCommand(cmd);
 224:         else
 225:            if( command[4,2]=="01" )
 226:               cmd = Command.new(device_.devid_, -1001, 1, 2, 48);
 227:               cmd.params_[10] = "1";
 228:               SendCommand(cmd);
 229:            end
 230:         end
 231:      end
 232:      if( command[2,2]=="21" )
 233:         if( command[5]<65 )
 234:                SwitchInput(command[5]-48)
 235:         else
 236:            SwitchInput(command[5]-55)
 237:         end
 238:      end
 239:   else
 240:      if( command[0,4]=="4026" )
 241:         volume = (command[4,2].hex - 38) / 1.73
 242:         SetDeviceDataInDB( device_.devid_, 158, volume.to_s ) # 158 = DEVICEDATA_Volume_Level_CONST
 243:         cmd = Command.new(device_.devid_, -1001, 1, 2, 71);
 244:         cmd.params_[30] = volume.to_s
 245:         SendCommand(cmd);
 246:      else
 247:         print "Incoming report command ", command, " doesn't need handling"
 248:      end
 249:   end
 250:end
 251:
 252:def ReceiveConfigurationCommand()
 253:   # This is called only after we already received the 0x12
 254:   print "ReceiveConfigurationCommand\n"
 255:   header = conn_.Recv(6,100)
 256:   slength = conn_.Recv(2,100)
 257:   ilength = hextodecimal(slength)
 258:   data = conn_.Recv(ilength,100)
 259:   term = conn_.Recv(3,100)
 260:   if( term[2]!=3 )
 261:      print "Data is malformed\n"
 262:      return false
 263:   end
 264:
 265:   if( ilength>=10 )
 266:      if( data[9]<65 )
 267:            SwitchInput(data[9]-48)
 268:      else
 269:         SwitchInput(data[9]-55)
 270:      end
 271:   end
 272:end
 273:
 274:def SwitchInput(input)
 275:   if( input==@input )
 276:      print "Input didn't change from ", input, "\n"
 277:      return
 278:   end
 279:   input_param = 0
 280:   @input = input
 281:   print "set to input ", input, "\n"
 282:   case input
 283:#   multi? dvd?
 284:      when 0
 285:         input_param = 163 # Phono
 286:      when 1
 287:         input_param = 162 # CD
 288:      when 2
 289:         input_param = 166 # Tuner
 290:      when 3
 291:         input_param = 420 # cd-r
 292:      when 4
 293:         input_param = 174 # md-tape
 294:      when 5
 295:         input_param = 165 # dvd
 296:      when 6
 297:         input_param = 161 # dtv
 298:      when 7
 299:         input_param = 281 # cbl-sat
 300:      when 9
 301:         input_param = 282 # vcr1
 302:      when 10
 303:         input_param = 283 # vcr2
 304:      when 12
 305:         input_param = 285 # vaux
 306:   end
 307:   
 308:   if( input_param==0 )
 309:      print "Unknown input ", input, "\n"
 310:      return
 311:   end
 312:
 313:   cmd = Command.new(device_.devid_, -1001, 1, 2, 49);
 314:   cmd.params_[41] = input_param.to_s()
 315:   SendCommand(cmd);
 316:end
 317:
 318:def hextodecimal(slength)
 319:   #slength is a 2 digit hex.  don't know the ruby equivalent of scanf
 320:   ilength = 0
 321:   if( slength[0]<65 ) # it's less than an A
 322:      ilength = (slength[0] - 48) * 16
 323:   else
 324:      ilength = (slength[0] - 55) * 16
 325:   end
 326:   if( slength[1]<65 ) # it's less than an A
 327:      ilength = ilength + slength[1] - 48
 328:   else
 329:      ilength = ilength + slength[1] - 55
 330:   end
 331:end
 332:
 333:def log(word)
 334:   $logFile.print( word + "\n" )
 335:   $logFile.flush()
 336:   print(word + "\n")
 337:end
 338:
 339:def SendMultiZoneCommand(cmd, commandsArray, commandParam="")
 340:   zone = GetZone(cmd.devidto_)
 341:   if( zone >= 0 and zone < commandsArray.size )
 342:      SendIrCommand(commandsArray[zone] + commandParam.to_s)
 343:   else
 344:      log("SendMultiZoneCommand: invalid zone " + zone.to_s)
 345:   end
 346:end
 347:
 348:def GetZone(deviceDestination)
 349:   if( device_.mapDevice_PortChannel_.has_key?(deviceDestination) and
 350:      device_.mapDevice_PortChannel_[deviceDestination] != nil and
 351:      !device_.mapDevice_PortChannel_[deviceDestination].empty? )
 352:      return device_.mapDevice_PortChannel_[deviceDestination].to_i
 353:   end
 354:   
 355:      return 0
 356:end
 357:
 358:def ShowZones()
 359:   log("####### Dev 2 PortChanel")
 360:   device_.mapDevice_PortChannel_.each do |key, value|
 361:      log(key.to_s + " => " + value.to_s)
 362:   end
 363:   
 364:   log("======= PortChanel 2 Dev")
 365:   device_.mapPortChannel_Device_.each do |key, value|
 366:      log(key.to_s + " => " + value.to_s)
 367:   end
 368:end
 369:#### 420 ####################################################################
 370:def cmd_420(cmd=nil)
 371:@returnParamArray.clear
 372:SendIrCommand("07A19")
 373:return @returnParamArray
 374:end
 375:#### 714 ####################################################################
 376:def cmd_714(cmd=nil)
 377:@returnParamArray.clear
 378:SendIrCommand("07A13")
 379:return @returnParamArray
 380:end
 381:#### 767 ####################################################################
 382:def cmd_767(cmd=nil)
 383:@returnParamArray.clear
 384:SendMyIrCommand("78D0")
 385:return @returnParamArray
 386:end
 387:#### 930 ####################################################################
 388:def cmd_930(cmd=nil)
 389:@returnParamArray.clear
 390:SendMyIrCommand("782A")
 391:return @returnParamArray
 392:end
 393:#### 985 ####################################################################
 394:def cmd_985(cmd=nil)
 395:@returnParamArray.clear
 396:SendMyIrCommand("7841")
 397:return @returnParamArray
 398:end
 399:#### START SETTERS ####################################################################
 400:def initialize()
 401:super
 402:@returnParamArray=Array.new
 403:end
 404:####  END  SETTERS ####################################################################
 405:end
Title: Re: gc100 and rs232 control
Post by: mikeybs on December 11, 2013, 02:11:52 am
command 350 is:
ReceiveReportCommand()
Title: Re: gc100 and rs232 control
Post by: mikeybs on December 11, 2013, 02:39:18 am
I just created a new group/codeset instead of attempting to use the existing one for yahama receivers rs232 and editing it....

I've defined the ruby codes for:     On/Off/HDMI1-4/Vol+/Vol-/Mute

I'm hoping that's enough to get going...


I rebooted my LMCE core and I'm still getting an error message for command 350...

command 350 is not defined by me in my new codeset, not sure what is going on...


here is the output of /var/log/pluto/49_Generic_Serial_Device.log

   12/10/13 20:28:24.502      Socket::ReceiveData 0x96b85f8 failed, bytes left 0 start: 82690000 1: 0 1b: 0 2: 0 2b: 0 m_Socket: 8 Command_Impl1 Dev #49 <0xb5dffb40>
05   12/10/13 20:28:24.647      Socket::ReceiveString2 ReceiveData failed m_Socket: -1 Command_Impl1 Dev #49 <0xb5dffb40>
01   12/10/13 20:28:24.647      Receive string failed in HandleRequestSocket 18:ReceiveData failed Command_Impl1 Dev #49 <0xb5dffb40>
05   12/10/13 20:28:24.678      Dumping 1 locks <0xb5dffb40>
05   12/10/13 20:28:24.678      finished check for exceptions <0xb5dffb40>
05   12/10/13 20:28:24.678      OL: (0x96b8744) (>145) MessageQueue Command_Impl.cpp l:852 time: 7:00:00p (1386725304 s) thread: 3061021504 Rel: Y Got: Y <0xb5dffb40>
01   12/10/13 20:28:24.618      Error while calling method: Cannot call class method: cmd_350
error: SIGHUP, line: 118
backtrace:
   in: (eval): 118
   from (eval):118:in `cmd_350'
 <0xb53ffb40>
== ATTEMPT FRESH START ==
1   12/10/13 20:31:13   /usr/pluto/bin/Spawn_Device.sh 49 (spawning-device)   11505 Dev: 49; Already Running list: 15,16,18,19,29,30,31,45,
== FRESH START ==
1   12/10/13 20:31:13   /usr/pluto/bin/Spawn_Device.sh 49 (spawning-device)   device: 49 ip: localhost cmd_line: Generic_Serial_Device
0   12/10/13 20:31:13   49 (spawning-device)   Entering 49
========== NEW LOG SECTION ==========
1   12/10/13 20:31:13   49 (spawning-device)   Starting... 1
1   12/10/13 20:31:13   49 (spawning-device)   Found /usr/pluto/bin/Generic_Serial_Device
RCODE:
   0:require 'Ruby_Generic_Serial_Device'
   1:class Command < Ruby_Generic_Serial_Device::RubyCommandWrapper
   2:end
   3:class Device_49 < Ruby_Generic_Serial_Device::RubySerialIOWrapper
   4:#### 89 ####################################################################
   5:def cmd_89(repeat_command, cmd=nil)
   6:@returnParamArray.clear
   7:conn_.Send("x02x00x37x38x31x45x03")
   8:return @returnParamArray
   9:end
  10:#### 90 ####################################################################
  11:def cmd_90(repeat_command, cmd=nil)
  12:@returnParamArray.clear
  13:conn_.Send("x02x00x37x38x31x46x03")
  14:return @returnParamArray
  15:end
  16:#### 97 ####################################################################
  17:def cmd_97(cmd=nil)
  18:@returnParamArray.clear
  19:conn_.Send("x02x00x37x38x39x43x03")
  20:return @returnParamArray
  21:end
  22:#### 151 ####################################################################
  23:def cmd_151(cmd=nil)
  24:@returnParamArray.clear
  25:conn_.Send("x02x00x37x38x44x42x03")
  26:return @returnParamArray
  27:end
  28:#### 192 ####################################################################
  29:def cmd_192(pk_pipe, pk_device_pipes, cmd=nil)
  30:@returnParamArray.clear
  31:conn_.Send("x02x00x37x38x37x45x03")
  32:return @returnParamArray
  33:end
  34:#### 193 ####################################################################
  35:def cmd_193(pk_pipe, cmd=nil)
  36:@returnParamArray.clear
  37:conn_.Send("x02x00x37x38x37x46x03")
  38:return @returnParamArray
  39:end
  40:#### 361 ####################################################################
  41:def cmd_361(cmd=nil)
  42:@returnParamArray.clear
  43:conn_.Send("x02x00x37x38x34x41x03")
  44:return @returnParamArray
  45:end
  46:#### 716 ####################################################################
  47:def cmd_716(cmd=nil)
  48:@returnParamArray.clear
  49:conn_.Send("x02x00x37x38x44x39x03")
  50:return @returnParamArray
  51:end
  52:#### 767 ####################################################################
  53:def cmd_767(cmd=nil)
  54:@returnParamArray.clear
  55:conn_.Send("x02x00x37x38x44x30x03")
  56:return @returnParamArray
  57:end
  58:#### 900 ####################################################################
  59:def cmd_900(cmd=nil)
  60:@returnParamArray.clear
  61:conn_.Send("x02x00x37x38x44x41x03")
  62:return @returnParamArray
  63:end
  64:#### 930 ####################################################################
  65:def cmd_930(cmd=nil)
  66:@returnParamArray.clear
  67:conn_.Send("x02x00x37x38x32x41x03")
  68:return @returnParamArray
  69:end
  70:#### 985 ####################################################################
  71:def cmd_985(cmd=nil)
  72:@returnParamArray.clear
  73:conn_.Send("x02x00x37x38x34x31x03")
  74:return @returnParamArray
  75:end
  76:#### START SETTERS ####################################################################
  77:def initialize()
  78:super
  79:@returnParamArray=Array.new
  80:end
  81:####  END  SETTERS ####################################################################
  82:end
Title: Re: gc100 and rs232 control
Post by: mikeybs on December 11, 2013, 07:06:23 am
ok I implemented a blank command 350 and now I get the following in my /var/log/pluto/49_Generic_Serial_Device.log

05   12/11/13 1:02:22.377      Got a reload command from 0  <0xb5cffb40>
05   12/11/13 1:02:22.643      void ClientSocket::Disconnect() on this socket: 0x86d95f8 (m_Socket: 8) <0xb76faac0>
Return code: 2
2   12/11/13 01:02:23   49 (spawning-device)   Device requests restart... count=1/50 dev=49
Wed Dec 11 01:02:23 EST 2013 Restart
========== NEW LOG SECTION ==========
1   12/11/13 01:02:32   49 (spawning-device)   Starting... 1
1   12/11/13 01:02:32   49 (spawning-device)   Found /usr/pluto/bin/Generic_Serial_Device
01   12/11/13 1:02:32.975      GSD Port is not specified. Instantiating non-IO Wrapper. <0xb5dffb40>
RCODE:
   0:require 'Ruby_Generic_Serial_Device'
   1:class Command < Ruby_Generic_Serial_Device::RubyCommandWrapper
   2:end
   3:class Device_49 < Ruby_Generic_Serial_Device::RubySerialWrapper
   4:#### 89 ####################################################################
   5:def cmd_89(repeat_command, cmd=nil)
   6:@returnParamArray.clear
   7:conn_.Send("x02x00x37x38x31x45x03")
   8:return @returnParamArray
   9:end
  10:#### 90 ####################################################################
  11:def cmd_90(repeat_command, cmd=nil)
  12:@returnParamArray.clear
  13:conn_.Send("x02x00x37x38x31x46x03")
  14:return @returnParamArray
  15:end
  16:#### 97 ####################################################################
  17:def cmd_97(cmd=nil)
  18:@returnParamArray.clear
  19:conn_.Send("x02x00x37x38x39x43x03")
  20:return @returnParamArray
  21:end
  22:#### 151 ####################################################################
  23:def cmd_151(cmd=nil)
  24:@returnParamArray.clear
  25:conn_.Send("x02x00x37x38x44x42x03")
  26:return @returnParamArray
  27:end
  28:#### 192 ####################################################################
  29:def cmd_192(pk_pipe, pk_device_pipes, cmd=nil)
  30:@returnParamArray.clear
  31:conn_.Send("x02x00x37x38x37x45x03")
  32:return @returnParamArray
  33:end
  34:#### 193 ####################################################################
  35:def cmd_193(pk_pipe, cmd=nil)
  36:@returnParamArray.clear
  37:conn_.Send("x02x00x37x38x37x46x03")
  38:return @returnParamArray
  39:end
  40:#### 361 ####################################################################
  41:def cmd_361(cmd=nil)
  42:@returnParamArray.clear
  43:conn_.Send("x02x00x37x38x34x41x03")
  44:return @returnParamArray
  45:end
  46:#### 716 ####################################################################
  47:def cmd_716(cmd=nil)
  48:@returnParamArray.clear
  49:conn_.Send("x02x00x37x38x44x39x03")
  50:return @returnParamArray
  51:end
  52:#### 767 ####################################################################
  53:def cmd_767(cmd=nil)
  54:@returnParamArray.clear
  55:conn_.Send("x02x00x37x38x44x30x03")
  56:return @returnParamArray
  57:end
  58:#### 900 ####################################################################
  59:def cmd_900(cmd=nil)
  60:@returnParamArray.clear
  61:conn_.Send("x02x00x37x38x44x41x03")
  62:return @returnParamArray
  63:end
  64:#### 930 ####################################################################
  65:def cmd_930(cmd=nil)
  66:@returnParamArray.clear
  67:conn_.Send("x02x00x37x38x32x41x03")
  68:return @returnParamArray
  69:end
  70:#### 985 ####################################################################
  71:def cmd_985(cmd=nil)
  72:@returnParamArray.clear
  73:conn_.Send("x02x00x37x38x34x31x03")
  74:return @returnParamArray
  75:end
  76:#### START SETTERS ####################################################################
  77:def initialize()
  78:super
  79:@returnParamArray=Array.new
  80:end
  81:####  END  SETTERS ####################################################################
  82:end
Title: Re: gc100 and rs232 control
Post by: tschak909 on December 11, 2013, 02:11:53 pm
The key error is this:

01   12/11/13 1:02:32.975      GSD Port is not specified. Instantiating non-IO Wrapper. <0xb5dffb40>


This means you don't have either a:

(a) COM Port on PC, or
(b) TCP Port

device data specified in your device template. Since this is an RS232 template, you need at the very least a COM Port on PC device data, along with at least Baud Rate.

-Thom
Title: Re: gc100 and rs232 control
Post by: mikeybs on December 11, 2013, 07:55:41 pm
odd, for some reason the COM Port on PC on the receiver device got blanked...  I changed it back to the virtual gc100 serial port and things have gotten more interesting....

here is some output after a core reboot, I'm thinking it looks healthy...

/var/log/pluto/49_Generic_Serial_Device.log:

05   12/11/13 13:16:25.662      Socket::ReceiveData 0x8e005f8 failed, bytes left 0 start: 5280000 1: 0 1b: 0 2: 0 2b: 0 m_Socket: 8 Command_Impl1 Dev #49 <0xb5dffb40>
05   12/11/13 13:16:25.662      Socket::ReceiveString2 ReceiveData failed m_Socket: -1 Command_Impl1 Dev #49 <0xb5dffb40>
01   12/11/13 13:16:25.662      Receive string failed in HandleRequestSocket 18:ReceiveData failed Command_Impl1 Dev #49 <0xb5dffb40>
05   12/11/13 13:16:25.663      Dumping 1 locks <0xb5dffb40>
05   12/11/13 13:16:25.663      finished check for exceptions <0xb5dffb40>
05   12/11/13 13:16:25.664      OL: (0x8e00744) (>101) MessageQueue Command_Impl.cpp l:852 time: 7:00:00p (1386785785 s) thread: 3061005120 Rel: Y Got: Y <0xb5dffb40>
== ATTEMPT FRESH START ==
1   12/11/13 13:18:59   /usr/pluto/bin/Spawn_Device.sh 49 (spawning-device)   10546 Dev: 49; Already Running list: 15,16,18,19,29,30,31,45,
== FRESH START ==
1   12/11/13 13:18:59   /usr/pluto/bin/Spawn_Device.sh 49 (spawning-device)   device: 49 ip: localhost cmd_line: Generic_Serial_Device
0   12/11/13 13:18:59   49 (spawning-device)   Entering 49
========== NEW LOG SECTION ==========
1   12/11/13 13:18:59   49 (spawning-device)   Starting... 1
1   12/11/13 13:18:59   49 (spawning-device)   Found /usr/pluto/bin/Generic_Serial_Device
RCODE:......



I still don't have any autogenerated scenarios, either that or I just don't know how to use/find them

Messages are definitely being sent to and received from my receiver though, I can see them in /var/log/pluto/socat_ttyS_45_0.log

Right now the only devices defined by me are the verizon STB, the receiver, and the tv:  Verizon STB-> HMDI3 of receiver -> HDMI1 of tv

Now if I change the receiver to HDMI2, then turn the TV off, then turn the TV back on, Linuxmce will change the receiver to HDMI3 after the TV powers up.  I'm guessing it does this because HDMI3 is the only input I have in use for the receiver so it assumes I want to use it.

So far turning the TV off and back on using the TV remote control is the only way I have found that makes Linuxmce send any commands to my devices. 

I would like to create a scenario that will turn the TV on if it's off and change it to HDMI1, turn the receiver on if it's off and change it to HDMI3, and power on the verizon STB

And I would like another scenario that turns everything off.

I'm guessing the verizon STB will prove tricky since it does not have discrete on/off commands.  Hopefully that won't prove too annoying...

Should scenarios like these be automatically generated for me?  Does it mean I still have not configured things properly...

On my orbiter I have tried clicking the Entertainment icon, then selecting my entertainment area, then trying to power it on/off and volume up/down, but nothing happens.

At least I do feel like I am making progress :)
Title: Re: gc100 and rs232 control
Post by: tschak909 on December 11, 2013, 08:58:44 pm
Basically, because you don't have a media director in that room, you'll need to make an entertainment area, and manually create scenarios within the Wizard > Media Scenarios section.

-Thom
Title: Re: gc100 and rs232 control
Post by: mikeybs on December 11, 2013, 10:23:59 pm
I attempted to create two media scenarios called "verizon" and "dvd player".  I am not attempting to control the dvd player in any way, I just want the receiver and tv to respond appropriately.

Choosing either one from my orbiter causes the dce router to reboot and reload my orbiter...

I am happy to post any relevant logs, just let me know what you'd like to see...
Title: Re: gc100 and rs232 control
Post by: tschak909 on December 11, 2013, 10:31:28 pm
Please pastebin your DCE Router log. That is very strange. Also paste your generic serial device log for your gc100.

-Thom
Title: Re: gc100 and rs232 control
Post by: CentralMedia on December 11, 2013, 10:38:52 pm
I had an issue, where when I added my Directv box to a TV in a room, without the room being configured with an MD, it would cause the router to reload, I simple used my sons machine temporarily to create an MD and all worked well after that.

Title: Re: gc100 and rs232 control
Post by: mikeybs on December 11, 2013, 10:44:40 pm
gc100 log

http://pastebin.com/EBhB9LYc


generic serial device log

http://pastebin.com/h8FfVE39



dce router log

http://pastebin.com/PkrzwDzS
Title: Re: gc100 and rs232 control
Post by: mikeybs on December 11, 2013, 10:50:51 pm
I've got nothing good to use for an MD right now :(

I suppose I could wrangle something up in a day or two if it's my only option

I do have a raspberry pi, but I am not able to get it to boot up as an MD, I am posting in another thread about that....

If I get that working maybe I'll be able to make some better progress
Title: Re: gc100 and rs232 control
Post by: tschak909 on December 11, 2013, 10:56:40 pm
Looks like you need to go into advanced on each of the AV devices, and make sure the correct Entertainment Area is checked.

-Thom
Title: Re: gc100 and rs232 control
Post by: mikeybs on December 11, 2013, 11:35:29 pm
I've done that.  For every AV device I have them set to Manually Configure EA, I have the correct EA checked and I have them placed in the correct room...
Title: Re: gc100 and rs232 control
Post by: mikeybs on December 11, 2013, 11:47:23 pm
I only have a single EA that I set up myself as a non-pluto TV EA
Title: Re: gc100 and rs232 control
Post by: tschak909 on December 11, 2013, 11:48:27 pm
Very strange, it's failing because it can't find pipes for your scenario.

-Thom
Title: Re: gc100 and rs232 control
Post by: mikeybs on December 11, 2013, 11:52:58 pm
so is there anywhere I can go from here?  Should I try to get my hands on a MD?  I was hoping not to have to use one... I mostly just want to be able to control my AV equipment, I don't have the need for the multimedia features an MD provides.
Title: Re: gc100 and rs232 control
Post by: CentralMedia on December 12, 2013, 12:02:42 am
I did not have to keep on the MD (the pc), its back working as my sons pc, all went as expected when created the MD though, now when I click the scenario that was pre-configured before the MD, it switch the tv as expected and a sound bar I also have and puts on the cable box
Title: Re: gc100 and rs232 control
Post by: tschak909 on December 12, 2013, 03:47:12 am
This is where remote assistance would come in handy, unfortunately, we've disabled it because it's not very secure, and nobody has come up with a replacement yet...

Is there a way I can remotely connect to your web admin, so I can see what's going on ?

-Thom
Title: Re: gc100 and rs232 control
Post by: mikeybs on December 12, 2013, 08:04:18 am
yeah I can get you in remotely, I'll let you use ssh and port forwarding to see the webmin.  Let me know when a good time for you is and I'll do my best to be available...
Title: Re: gc100 and rs232 control
Post by: mikeybs on December 12, 2013, 08:06:57 am
if you send me your email I will email you the credentials to get in, I just don't want to post the credentials in the forum for the whole world to see
Title: Re: gc100 and rs232 control
Post by: tschak909 on December 12, 2013, 02:05:24 pm
thom.cherryhomes@gmail.com
Title: Re: gc100 and rs232 control
Post by: mikeybs on January 28, 2014, 09:58:21 pm
well I've started all over again with a fresh install of the latest 12.04 dvd image and now I have an extra PC to use as a media director in the room I am trying to control the AV equipment in.

A scenario now appears for my cable box on the orbiter screen so that is progress.  I am guessing that is because I now have a dedicated media director in the room.  Clicking on it just turns my orbiter screen black on my tv and the cable box input is not selected on my receiver as hoped.

I believe I have identified the problem though

after launching the scenario I see this

cat /var/log/pluto/socat_ttyS_48_0.log
2014/01/28 15:38:07.227962  length=8 from=586 to=593
.30110F.> 2014/01/28 15:38:07.427839  length=8 from=594 to=601
.301210.> 2014/01/28 15:38:16.232581  length=8 from=602 to=609
.30110E.> 2014/01/28 15:38:16.465356  length=8 from=610 to=617
.30120F.< 2014/01/28 15:41:20.038248  length=21 from=24 to=44
x02x00x37x38x37x45x03< 2014/01/28 15:41:27.066101  length=21 from=45 to=65
x02x00x37x38x44x30x03< 2014/01/28 15:41:29.079447  length=21 from=66 to=86
x02x00x37x38x37x45x03< 2014/01/28 15:41:36.098627  length=21 from=87 to=107
x02x00x37x38x32x41x03


My scenario is the output from 15:41...

It appears I am doing something wrong with the ruby commands.  Earlier in the output you can see the results of sending commands with /usr/pluto/bin/TestSerialPort and you can see they look much different.

I am attempting to use ruby snippets like the following in the device template for my receiver:
conn_.Send("x02x00x37x38x37x45x03")

And as you can see they are not producing well formed output.  Can anyone help me with the ruby?
Title: Re: gc100 and rs232 control
Post by: tschak909 on January 28, 2014, 10:25:59 pm
you need to do \xXX\xXX\xXX ... note the backslash.

-Thom
Title: Re: gc100 and rs232 control
Post by: mikeybs on June 13, 2014, 10:36:39 pm
I had this working for months and now all of a sudden it has stopped working...

I am able to send the receiver commands with success if I use /usr/pluto/bin/TestSerialPort

but the commands no longer work if I use MessageSend

I'm not sure what could have happened.  The COM port on device is still defined correctly.  The setup appears to be unchanged from what I can tell...

Here is the output in the DCERouter log when I attempt to turn off the receiver using MessageSend


08   06/13/14 16:31:01.131      Received Message from 0 (unknown / ) to 52 (YSP5100 / Home Theater), type 1 id 193 Command:Off, retry none, parameters: <0x70176b40>
08   06/13/14 16:31:01.131        Parameter 97(PK_Pipe): -1 <0x70176b40>
05   06/13/14 16:31:01.181      Socket::ReceiveData 0xb4cca670 failed, bytes left 0 start: 5410000 1: 0 1b: 0 2: 0 2b: 0 m_Socket: 163 Incoming_Conn Socket 163 ::ffff:192.168.60.222 <0x70176b40>
05   06/13/14 16:31:01.181      Socket::ReceiveString2 ReceiveData failed m_Socket: -1 Incoming_Conn Socket 163 ::ffff:192.168.60.222 <0x70176b40>
05   06/13/14 16:31:01.181      TCPIP: Closing connection to -1003 (Router Dev #0) 0xb4cca670 m_Socket: -1 <0x70176b40>
05   06/13/14 16:31:01.181      Router::RemoveAndDeleteSocket 0xb4cca670 -1003 <0x70176b40>
Title: Re: gc100 and rs232 control
Post by: tschak909 on June 14, 2014, 05:44:32 pm
The PK_Pipe=-1 is suspicious... do any of your commands in the scenarios fill in the pk_pipe command parameter?

-Thom