That is basically what I have been trying:
log('Sending Menu Command')
<$"ka 01 01\r"$>
And the device is definitely started as shown by the log without any errors. Below means that the driver is working correctly right? Are there any other logs I can view to help with troubleshooting this?
Thanks.
/var/log/pluto/39_Generic_Serial_Device.log
05 11/05/12 8:00:37.053 Going to rotate logs... <0xb57b4b90>
05 11/05/12 18:14:51.780 Got a reload command from 0 <0xb57b4b90>
05 11/05/12 18:14:57.276 void ClientSocket::Disconnect() on this socket: 0x933b630 (m_Socket:
<0xb6fb88d0>
Return code: 2
2 11/05/12 18:14:57 39 (spawning-device) Device requests restart... count=1/50 dev=39
Mon Nov 5 18:14:57 CST 2012 Restart
========== NEW LOG SECTION ==========
1 11/05/12 18:15:05 39 (spawning-device) Starting... 1
1 11/05/12 18:15:05 39 (spawning-device) Found /usr/pluto/bin/Generic_Serial_Device
05 11/05/12 18:15:05.439 Creating child 40 <0xb71458d0>
05 11/05/12 18:15:05.439 Note: Device manager has attached a device of type 2125 that this has no custom event handler for. It will not fire events. <0xb71458d0>
05 11/05/12 18:15:05.439 Note: Device manager has attached a device of type 2125 that this has no custom handler for. This is normal for IR. <0xb71458d0>
05 11/05/12 18:15:05.439 Creating child 41 <0xb71458d0>
05 11/05/12 18:15:05.439 Note: Device manager has attached a device of type 2166 that this has no custom event handler for. It will not fire events. <0xb71458d0>
05 11/05/12 18:15:05.439 Note: Device manager has attached a device of type 2166 that this has no custom handler for. This is normal for IR. <0xb71458d0>
RCODE:
0:require 'Ruby_Generic_Serial_Device'
1:class Command < Ruby_Generic_Serial_Device::RubyCommandWrapper
2:end
3:class Device_39 < Ruby_Generic_Serial_Device::RubySerialIOWrapper
4:#### 89 ####################################################################
5:def cmd_89(repeat_command, cmd=nil)
6:@returnParamArray.clear
7:print "raising volume from ", @volume, "\n"
8:cmd_313(@volume+1)
9:return @returnParamArray
10:end
11:#### 90 ####################################################################
12:def cmd_90(repeat_command, cmd=nil)
13:@returnParamArray.clear
14:print "lowering volume from ", @volume, "\n"
15:cmd_313(@volume-1)
16:
17:return @returnParamArray
18:end
19:#### 97 ####################################################################
20:def cmd_97(cmd=nil)
21:@returnParamArray.clear
22:if(@mute)
23: SendCommand("ke 01 00",10000,4)
24:else
25: SendCommand("ke 01 01",10000,4)
26:end
27:@mute=!@mute
28:return @returnParamArray
29:end
30:#### 154 ####################################################################
31:def cmd_154(cmd=nil)
32:@returnParamArray.clear
33:SendCommand("kb 01 60",1000,4)
34:return @returnParamArray
35:end
36:#### 166 ####################################################################
37:def cmd_166(cmd=nil)
38:@returnParamArray.clear
39:SendCommand("kb 01 01",1000,4)
40:return @returnParamArray
41:end
42:#### 192 ####################################################################
43:def cmd_192(pk_pipe, pk_device_pipes, cmd=nil)
44:@returnParamArray.clear
45:conn_.Send("ka 01 00")
46:
47:return @returnParamArray
48:end
49:#### 193 ####################################################################
50:def cmd_193(pk_pipe, cmd=nil)
51:@returnParamArray.clear
52:conn_.Send("ka 01 01\r")
53:
54:return @returnParamArray
55:end
56:#### 313 ####################################################################
57:def cmd_313(level, cmd=nil)
58:@returnParamArray.clear
59:@volume=level.to_i()
60:ilevel = (@volume * 0.64).to_i
61:print "setting volume to ", ilevel , "\n"
62:
63:if ilevel <10
64: SendCommand("kf 01 0" + ilevel.to_s,1000,4)
65:else
66: SendCommand("kf 01 " + ilevel.to_s,1000,4)
67:end
68:SetDeviceDataInDB( device_.devid_, 158, ilevel .to_s) # 158 = DEVICEDATA_Volume_Level_CONST
69:print "volume and corresponding device data set\n"
70:
71:return @returnParamArray
72:end
73:#### 316 ####################################################################
74:def cmd_316(cmd=nil)
75:@returnParamArray.clear
76:SendCommand("kb 01 02",1000,4)
77:return @returnParamArray
78:end
79:#### 317 ####################################################################
80:def cmd_317(cmd=nil)
81:@returnParamArray.clear
82:SendCommand("kb 01 21",1000,4)
83:return @returnParamArray
84:end
85:#### 355 ####################################################################
86:def cmd_355(cmd=nil)
87:@returnParamArray.clear
88:# Initialize --- Date: 28.02.2008
89:# the docs are wrong. they say responses are terminated with a \r. In reality some sets do, others don't.
90:# some sets won't respond to ka 01 ff when the tv is off. others do.
91:@mute = false;
92:
93:# unfortunately we have to turn the device on if it's off to know that it's alive or else it won't respond to anything
94:@input=-1
95:for iRetry in 0...4
96: print "Initializing unit\n"
97: conn_.Send("ka 01 ff\r")
98: # wait 2 seconds for the status command, which won't work if the tv is off
99: buf = conn_.RecvDelimited("x", 2000)
100: if( !buf.nil? && !buf.index("01 OK").nil? )
101: print "Initialized ok - tv is on\n"
102: volume_level = GetCurrentDeviceData( device_.devid_, 207 ) # 59 = DEVICEDATA_Initial_Volume_CONST
103: if( !volume_level.empty? && volume_level!="ERR Parameter not found" )
104: print "Setting volume to ", volume_level, "\n"
105: cmd_313(volume_level)
106: SetDeviceDataInDB( device_.devid_, 39, volume_level ) # 39 = DEVICEDATA_Volume_Level_CONST
107: end
108: return
109: end
110: print "TV is either off or not connected\n"
111:
112: # try turning it on
113: conn_.Send("ka 01 01\r")
114:
115: # wait 10 seconds for the TV to respond
116: buf = conn_.RecvDelimited("x", 10000)
117: if( !buf.nil? && !buf.index("01 OK").nil? )
118: print "Initialized ok - tv was off\n"
119: # wait 1 second and turn it off again so it returns to it's prior state
120: sleep(1)
121: volume_level = GetCurrentDeviceData( device_.devid_, 207 ) # 59 = DEVICEDATA_Initial_Volume_CONST
122: if( !volume_level.empty? && volume_level!="ERR Parameter not found" )
123: print "Setting volume to ", volume_level, "\n"
124: cmd_313(volume_level)
125: SetDeviceDataInDB( device_.devid_, 39, volume_level ) # 39 = DEVICEDATA_Volume_Level_CONST
126: end
127: conn_.Send("ka 01 00\r")
128: return
129: end
130:
131: print "TV is not connected\n"
132:
133: sleep(1)
134:end
135:
136:#DisableDevice( device_.devid_, true )
137:print "The device wouldn't respond. Disabling it.\n"
138:return @returnParamArray
139:end
140:#### 361 ####################################################################
141:def cmd_361(cmd=nil)
142:@returnParamArray.clear
143:SendCommand("kb 01 90",1000,4)
144:return @returnParamArray
145:end
146:#### PRIVATE METHODS ####################################################################
147:# Private - Date: 28.02.2008
148:# the docs are wrong. they say responses are terminated with a \r. In reality some sets do, others don't.
149:
150:def SendCommand(command,timeout,retransmit)
151: for i in 0...retransmit
152: conn_.Send(command + "\r")
153: # wait up to 8 seconds since it may be very slow if this is an 'on' command
154:
155: buf = conn_.RecvDelimited("x", timeout)
156:
157: if( !buf.nil? && (!buf.index("01 OK").nil? || !buf.index("01 NG").nil?))
158: print "Received good reply in less than ", timeout, "ms: ", buf, "\n"
159: return
160: else
161: buf = conn_.Recv(1000,1000);
162: print "Flushed buffer: ", buf, "invalid resonse in ", timeout, "seconds\n"
163: end
164: end
165:end
166:#### 712 ####################################################################
167:def cmd_712(cmd=nil)
168:@returnParamArray.clear
169:SendCommand("kb 01 05",1000,4)
170:return @returnParamArray
171:end
172:#### 767 ####################################################################
173:def cmd_767(cmd=nil)
174:@returnParamArray.clear
175:SendCommand("kb 01 91",1000,4)
176:return @returnParamArray
177:end
178:#### 873 ####################################################################
179:def cmd_873(cmd=nil)
180:@returnParamArray.clear
181:SendCommand("kb 01 00",1000,4)
182:return @returnParamArray
183:end
184:#### 930 ####################################################################
185:def cmd_930(cmd=nil)
186:@returnParamArray.clear
187:SendCommand("kb 01 92",1000,4)
188:return @returnParamArray
189:end
190:#### START SETTERS ####################################################################
191:def initialize()
192:super
193:@returnParamArray=Array.new
194:end
195:#### END SETTERS ####################################################################
196:end