Author Topic: Ruby snippets help please  (Read 5419 times)

maybeoneday

  • Guru
  • ****
  • Posts: 194
    • View Profile
Ruby snippets help please
« on: October 06, 2008, 06:06:41 pm »
Hi all,

I'm trying to create a device template for a CambridgeAudio 540R  receiver, with rs232.The tech dept assures me that the protocol is applicable to V2/V3 and 340  variants (mine is v2)

http://www.cambridgeaudio.com/assets/documents/AP227921Azur540RV3SerialControlProtocolV1.pdf

So, I've created the template, included volume and input change commands (just to test for now), updated connection wizard,reloaded router  (at each stage) and  ......nothing  ,   except the receiver is clicking when i hit remote keys.

It's connected via  pl2303 usb/serial converter plus the serial cable I've been successfully using on the TV, and the  usb connection is showing up in the template,  (pci0000:00/0000:00:1a.1+1  )


The examples given  in the manual follow this format:

                              #2,01,02\r


which I've entered into the template as,

                              <$"#2,01,02\r"$>


and , as I said, the only result is a faint clicking when using the remote.ANY help/pointers would be greatly appreciated,

thanks in advance,

Ian

hari

  • Administrator
  • LinuxMCE God
  • *****
  • Posts: 2428
    • View Profile
    • ago control
Re: Ruby snippets help please
« Reply #1 on: October 06, 2008, 06:18:03 pm »
clicking??

general recommendations: make sure you have the right cable. Test with a terminal emulator like minicom or use the /usr/pluto/bin/TestSerialPort tool to verify basic operation.

best regards,
Hari
rock your home - http://www.agocontrol.com home automation

maybeoneday

  • Guru
  • ****
  • Posts: 194
    • View Profile
Re: Ruby snippets help please
« Reply #2 on: October 06, 2008, 06:51:43 pm »
Hari,
many thanks for quick response,    yes clicking !  on any keypress of remote,so by my logic "something " is getting through,
Will read up on your suggestions ,(another learning curve) and get back to you,
regards,
Ian


hari

  • Administrator
  • LinuxMCE God
  • *****
  • Posts: 2428
    • View Profile
    • ago control
Re: Ruby snippets help please
« Reply #3 on: October 06, 2008, 07:23:11 pm »
are you aware that #2,01,02\r changes the input? My AV receiver also "clicks" when changing the input..

maybe you want to toggle the input to something else, resend the command and see if it changes the input back.

br hari
rock your home - http://www.agocontrol.com home automation

maybeoneday

  • Guru
  • ****
  • Posts: 194
    • View Profile
Re: Ruby snippets help please
« Reply #4 on: October 06, 2008, 07:47:39 pm »
Hari,

WELL spotted......but no cigar,that was just an example of how the manual formatted commands and how I'd put it into the template...thinking I'd made  some obvious error...

the funny thing is , the receiver was clicking on any remote key,not just  the vol+/- and 2 inputs I'd entered.
Its now connected direct to serial and clicking has stopped, still no other effect tho,so am presently working thro other receiver templates to try and find some inspiration,who knows ?, "maybeoneday",
I'll get my head around this beast !!!
best regards,
Ian

hari

  • Administrator
  • LinuxMCE God
  • *****
  • Posts: 2428
    • View Profile
    • ago control
Re: Ruby snippets help please
« Reply #5 on: October 06, 2008, 08:49:54 pm »
again, it really helps that you can manually controll the beast. As it talks ascii, that is pretty easy. Just send that string over minicom, set the serial port up for the right speed, baud rate and flow control.

The TestSerialPort tool does the same. It is used by the pnp scripts for serial device detection. You can see it here: http://svn.charonmedia.org/svn/trunk/src/pnp_detection_scripts/20_MarantzReceiver.sh

The Marantz expects the string "@AMT:1\r" to mute, just as an example. I can test if the device is hooked up properly with that command (assuming our serial port is /dev/ttyUSB1):

/usr/pluto/bin/TestSerialPort -p /dev/ttyUSB1 -P N81 -b 9600 -t "@AMT:1\r"

If you don't get reaction from your amp from that (substituting with your own command string/baud rate/...), it is a connection problem. If it executes the command, you must have an error in your GSD.

best regards,
Hari
rock your home - http://www.agocontrol.com home automation

maybeoneday

  • Guru
  • ****
  • Posts: 194
    • View Profile
Re: Ruby snippets help please
« Reply #6 on: October 06, 2008, 10:07:17 pm »
Hi Hari,
really appreciate the help,
tried TestSerialPort as you suggested, keeps returning Unknown: #(whatever command)  so I assume it must be the serial cable  (belkin "laplink") , I'll pick up both varieties of serial cable (straight thro' and crossover) tomorrow and let you know the  result,
regards,
Ian

hari

  • Administrator
  • LinuxMCE God
  • *****
  • Posts: 2428
    • View Profile
    • ago control
Re: Ruby snippets help please
« Reply #7 on: October 06, 2008, 10:14:06 pm »
I assume you ran something like that?

/usr/pluto/bin/TestSerialPort -p /dev/ttyUSB0 -P N81 -b 9600 -t "#2,01,02\r"

that should not give any errors...

best regards,
hari
rock your home - http://www.agocontrol.com home automation

maybeoneday

  • Guru
  • ****
  • Posts: 194
    • View Profile
Re: Ruby snippets help please
« Reply #8 on: October 07, 2008, 01:51:14 pm »
Hi Hari,
have swapped out the cables, setup tv thro usb/serial , so receiver is now connected to /dev ttyS0.

Ran (many times/commands):

linuxmce@dcerouter:~$ /usr/pluto/bin/TestSerialPort -p /dev/ttyS0 -P N81 -b 9600 -t "#1,01,0\r"


and get no errors,  But ,  nothing happens on receiver.
Have re contacted  tech support to make sure 232 control is possible with  540V2 and asked for  any further insights .Will let you know of any developments,
many thanks,

Ian

hari

  • Administrator
  • LinuxMCE God
  • *****
  • Posts: 2428
    • View Profile
    • ago control
Re: Ruby snippets help please
« Reply #9 on: October 07, 2008, 07:07:42 pm »
/usr/pluto/bin/TestSerialPort -p /dev/ttyUSB1 -P N81 -b 9600 -t "@AMT:1\r"

Hari,

Does LMCE use the "regular" ASCII control characters, as given in http://en.wikipedia.org/wiki/Control_character?

Thanks,

Mark

dunno, look at the Generic_Serial_Device code,

best regards,
Hari
rock your home - http://www.agocontrol.com home automation

maybeoneday

  • Guru
  • ****
  • Posts: 194
    • View Profile
Re: Ruby snippets help please
« Reply #10 on: October 09, 2008, 12:53:44 pm »
Hi hari ,

Cambridge tech support have reversed their original statement, 232 is NOT supported on 540R  V2..........bummer !

Thanks for your help , sorry it was a waste of time,
regards,
Ian