Advertisement
Guest User

Untitled

a guest
Aug 9th, 2017
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 16.28 KB | None | 0 0
  1. Device LG RS232 (newer models), # 64
  2. Device Template LG RS232 (newer models), device category TVs/Plasmas/LCD's/Projectors, manufacturer LG.
  3.  
  4. 447 lines, displaying from 0 to 447
  5. 1
  6.  
  7. == ATTEMPT FRESH START ==
  8. 1 04/06/11 18:04:10 /usr/pluto/bin/Spawn_Device.sh 64 (spawning-device) 29146 Dev: 64; Already Running list: 41,42,44,43,48,45,46,47,49,
  9. == FRESH START ==
  10. 1 04/06/11 18:04:10 /usr/pluto/bin/Spawn_Device.sh 64 (spawning-device) device: 64 ip: dcerouter cmd_line: Generic_Serial_Device
  11. 0 04/06/11 18:04:10 64 (spawning-device) Entering 64
  12. ========== NEW LOG SECTION ==========
  13. 1 04/06/11 18:04:10 64 (spawning-device) Starting... 1
  14. 1 04/06/11 18:04:11 64 (spawning-device) Found /usr/pluto/bin/Generic_Serial_Device
  15. 05 04/06/11 18:04:11.122 Connection for client socket reported NEED RELOAD IP=192.168.80.2 MAC=00:01:2e:2f:39:5e, device 64 last error 2 <0xb71138d0>
  16. 05 04/06/11 18:04:11.123 The router must be reloaded before this device is fully functional <0xb71138d0>
  17. 05 04/06/11 18:04:11.128 void ClientSocket::Disconnect() on this socket: 0xa068d78 (m_Socket: 5) <0xb71138d0>
  18. 05 04/06/11 18:04:11.146 Connection for client socket reported NEED RELOAD IP=192.168.80.2 MAC=00:01:2e:2f:39:5e, device 64 last error 2 <0xb71138d0>
  19. 05 04/06/11 18:04:11.148 Running without DeviceData, will try to add device <0xb58cfb90>
  20. 01 04/06/11 18:04:11.188 GSD Port is not specified. Instantiating non-IO Wrapper. <0xb58cfb90>
  21. RCODE:
  22. 0:require 'Ruby_Generic_Serial_Device'
  23. 1:class Command < Ruby_Generic_Serial_Device::RubyCommandWrapper
  24. 2:end
  25. 3:class Device_64 < Ruby_Generic_Serial_Device::RubySerialWrapper
  26. 4:#### 63 ####################################################################
  27. 5:def cmd_63(streamid, cmd=nil)
  28. 6:@returnParamArray.clear
  29. 7:SendKey("8E")
  30. 8:return @returnParamArray
  31. 9:end
  32. 10:#### 64 ####################################################################
  33. 11:def cmd_64(streamid, cmd=nil)
  34. 12:@returnParamArray.clear
  35. 13:SendKey("8F")
  36. 14:return @returnParamArray
  37. 15:end
  38. 16:#### 86 ####################################################################
  39. 17:def cmd_86(cmd=nil)
  40. 18:@returnParamArray.clear
  41. 19:SendKey("43")
  42. 20:return @returnParamArray
  43. 21:end
  44. 22:#### 89 ####################################################################
  45. 23:def cmd_89(repeat_command, cmd=nil)
  46. 24:@returnParamArray.clear
  47. 25:SetVolume("up")
  48. 26:return @returnParamArray
  49. 27:end
  50. 28:#### 90 ####################################################################
  51. 29:def cmd_90(repeat_command, cmd=nil)
  52. 30:@returnParamArray.clear
  53. 31:SetVolume("down")
  54. 32:return @returnParamArray
  55. 33:end
  56. 34:#### 92 ####################################################################
  57. 35:def cmd_92(streamid, cmd=nil)
  58. 36:@returnParamArray.clear
  59. 37:SendKey("BA")
  60. 38:return @returnParamArray
  61. 39:end
  62. 40:#### 95 ####################################################################
  63. 41:def cmd_95(streamid, eject, cmd=nil)
  64. 42:@returnParamArray.clear
  65. 43:SendKey("B1")
  66. 44:return @returnParamArray
  67. 45:end
  68. 46:#### 97 ####################################################################
  69. 47:def cmd_97(cmd=nil)
  70. 48:@returnParamArray.clear
  71. 49:if(@mute)
  72. 50: Command("ke","00")
  73. 51:else
  74. 52: Command("ke","01")
  75. 53:end
  76. 54:@mute=!@mute
  77. 55:return @returnParamArray
  78. 56:end
  79. 57:#### 136 ####################################################################
  80. 58:def cmd_136(cmd=nil)
  81. 59:@returnParamArray.clear
  82. 60:SendKey("1A")
  83. 61:return @returnParamArray
  84. 62:end
  85. 63:#### 139 ####################################################################
  86. 64:def cmd_139(streamid, cmd=nil)
  87. 65:@returnParamArray.clear
  88. 66:SendKey("B0")
  89. 67:return @returnParamArray
  90. 68:end
  91. 69:#### 154 ####################################################################
  92. 70:def cmd_154(cmd=nil)
  93. 71:@returnParamArray.clear
  94. 72:Command("xb","60")
  95. 73:return @returnParamArray
  96. 74:end
  97. 75:#### 166 ####################################################################
  98. 76:def cmd_166(cmd=nil)
  99. 77:@returnParamArray.clear
  100. 78:EmbeddedTuner("10")
  101. 79:return @returnParamArray
  102. 80:end
  103. 81:#### 192 ####################################################################
  104. 82:def cmd_192(pk_pipe, pk_device_pipes, cmd=nil)
  105. 83:@returnParamArray.clear
  106. 84:Command("ka","01",5)
  107. 85:SetVolume(@volume)
  108. 86:return @returnParamArray
  109. 87:end
  110. 88:#### 193 ####################################################################
  111. 89:def cmd_193(pk_pipe, cmd=nil)
  112. 90:@returnParamArray.clear
  113. 91:SendCommand("ka","00",1)
  114. 92:return @returnParamArray
  115. 93:end
  116. 94:#### 200 ####################################################################
  117. 95:def cmd_200(streamid, cmd=nil)
  118. 96:@returnParamArray.clear
  119. 97:SendKey("40")
  120. 98:return @returnParamArray
  121. 99:end
  122. 100:#### 201 ####################################################################
  123. 101:def cmd_201(streamid, cmd=nil)
  124. 102:@returnParamArray.clear
  125. 103:SendKey("41")
  126. 104:return @returnParamArray
  127. 105:end
  128. 106:#### 202 ####################################################################
  129. 107:def cmd_202(streamid, cmd=nil)
  130. 108:@returnParamArray.clear
  131. 109:SendKey("07")
  132. 110:return @returnParamArray
  133. 111:end
  134. 112:#### 203 ####################################################################
  135. 113:def cmd_203(streamid, cmd=nil)
  136. 114:@returnParamArray.clear
  137. 115:SendKey("06")
  138. 116:return @returnParamArray
  139. 117:end
  140. 118:#### 204 ####################################################################
  141. 119:def cmd_204(cmd=nil)
  142. 120:@returnParamArray.clear
  143. 121:SendKey("10")
  144. 122:return @returnParamArray
  145. 123:end
  146. 124:#### 205 ####################################################################
  147. 125:def cmd_205(cmd=nil)
  148. 126:@returnParamArray.clear
  149. 127:SendKey("11")
  150. 128:return @returnParamArray
  151. 129:end
  152. 130:#### 206 ####################################################################
  153. 131:def cmd_206(cmd=nil)
  154. 132:@returnParamArray.clear
  155. 133:SendKey("12")
  156. 134:return @returnParamArray
  157. 135:end
  158. 136:#### 207 ####################################################################
  159. 137:def cmd_207(cmd=nil)
  160. 138:@returnParamArray.clear
  161. 139:SendKey("13")
  162. 140:return @returnParamArray
  163. 141:end
  164. 142:#### 208 ####################################################################
  165. 143:def cmd_208(cmd=nil)
  166. 144:@returnParamArray.clear
  167. 145:SendKey("14")
  168. 146:return @returnParamArray
  169. 147:end
  170. 148:#### 209 ####################################################################
  171. 149:def cmd_209(cmd=nil)
  172. 150:@returnParamArray.clear
  173. 151:SendKey("15")
  174. 152:return @returnParamArray
  175. 153:end
  176. 154:#### 210 ####################################################################
  177. 155:def cmd_210(cmd=nil)
  178. 156:@returnParamArray.clear
  179. 157:SendKey("16")
  180. 158:return @returnParamArray
  181. 159:end
  182. 160:#### 211 ####################################################################
  183. 161:def cmd_211(cmd=nil)
  184. 162:@returnParamArray.clear
  185. 163:SendKey("17")
  186. 164:return @returnParamArray
  187. 165:end
  188. 166:#### 212 ####################################################################
  189. 167:def cmd_212(cmd=nil)
  190. 168:@returnParamArray.clear
  191. 169:SendKey("18")
  192. 170:return @returnParamArray
  193. 171:end
  194. 172:#### 213 ####################################################################
  195. 173:def cmd_213(cmd=nil)
  196. 174:@returnParamArray.clear
  197. 175:SendKey("19")
  198. 176:return @returnParamArray
  199. 177:end
  200. 178:#### 240 ####################################################################
  201. 179:def cmd_240(streamid, cmd=nil)
  202. 180:@returnParamArray.clear
  203. 181:SendKey("28")
  204. 182:return @returnParamArray
  205. 183:end
  206. 184:#### 313 ####################################################################
  207. 185:def cmd_313(level, cmd=nil)
  208. 186:@returnParamArray.clear
  209. 187:@volume=level.to_i()
  210. 188:SetVolume(@volume)
  211. 189:return @returnParamArray
  212. 190:end
  213. 191:#### 316 ####################################################################
  214. 192:def cmd_316(cmd=nil)
  215. 193:@returnParamArray.clear
  216. 194:Command("xb","20")
  217. 195:return @returnParamArray
  218. 196:end
  219. 197:#### 317 ####################################################################
  220. 198:def cmd_317(cmd=nil)
  221. 199:@returnParamArray.clear
  222. 200:Command("xb","21")
  223. 201:return @returnParamArray
  224. 202:end
  225. 203:#### 355 ####################################################################
  226. 204:def cmd_355(cmd=nil)
  227. 205:@returnParamArray.clear
  228. 206:# Initialize --- Date: 28.02.2008
  229. 207:# all responses should be terminated by 'x'.
  230. 208:# some sets won't respond to ka 01 ff when the tv is off. others do.
  231. 209:@mute = false;
  232. 210:# read in our device data now since it will never change
  233. 211:@SetID = device_.devdata_[1] # Get the "Set ID" from device data
  234. 212:@volume = device_.devdata_[208] # 208 = DEVICEDATA_Initial_Volume_CONST
  235. 213:@TunerType = device_.devdata_[230] # 230 = DEVICEDATA_Source_CONST
  236. 214:
  237. 215:result = InitVolume()
  238. 216:if (result == true)
  239. 217: return
  240. 218:end
  241. 219:
  242. 220:DisableDevice( device_.devid_, true )
  243. 221:log "The device wouldn't respond. Disabling it.\n"
  244. 222:return @returnParamArray
  245. 223:end
  246. 224:#### 364 ####################################################################
  247. 225:def cmd_364(cmd=nil)
  248. 226:@returnParamArray.clear
  249. 227:SendKey("4C")
  250. 228:return @returnParamArray
  251. 229:end
  252. 230:#### PRIVATE METHODS ####################################################################
  253. 231:def log(line)
  254. 232: $log = File.open("/var/log/pluto/" + device_.devid_.to_s + "_Generic_Serial_Device.log", "a")
  255. 233: $log.puts "(***):" + line.to_s
  256. 234: $log.close
  257. 235:end
  258. 236:
  259. 237:def SendKey(key)
  260. 238: SendCommand("mc",key,1)
  261. 239:end
  262. 240:
  263. 241:def Command(command,data,*extraargs)
  264. 242: out = SendCommand(command,"ff",1)
  265. 243: # only actually send the command if the device isn't already in that mode/setting
  266. 244: if (out[0] == true && out[1] != data)
  267. 245: if (extraargs[0] == nil)
  268. 246: timeout = 1
  269. 247: else
  270. 248: timeout = extraargs[0]
  271. 249: end
  272. 250: out = SendCommand(command,data,timeout)
  273. 251: end
  274. 252: return out
  275. 253:end
  276. 254:
  277. 255:def SendCommand(command,data,timeout)
  278. 256: $cmd = [command,@SetID,data].join(" ")
  279. 257: conn_.Send($cmd + "\r")
  280. 258: # wait up to 8 seconds since it may be very slow if this is an 'on' command
  281. 259: buf = conn_.RecvDelimited("x", timeout * 1000)
  282. 260: if( !buf.nil? && (!buf.index("01 OK").nil? || !buf.index("01 NG").nil?))
  283. 261: #print "Received good reply in less than ", timeout, "ms: ", buf, "\n"
  284. 262: if (buf.index("OK"))
  285. 263: data = buf[buf.index("OK") + 2, 2]
  286. 264: result = true
  287. 265: else
  288. 266: result = false
  289. 267: end
  290. 268: return [result, data]
  291. 269: else
  292. 270: buf = conn_.Recv(1000,1000);
  293. 271: #print "Flushed buffer: ", buf, "invalid response in ", timeout, "seconds\n"
  294. 272: return [false]
  295. 273: end
  296. 274:end
  297. 275:
  298. 276:def EmbeddedTuner(data)
  299. 277: # select the embedded tuner. use device data to determine cable vs antenna
  300. 278: # add 1 for cable
  301. 279: data = data.to_i()
  302. 280: if (@TunerType != nil)
  303. 281: data += @TunerType.to_i()
  304. 282: end
  305. 283: Command("xb","%02d" % data)
  306. 284:end
  307. 285:
  308. 286:def SetVolume(level)
  309. 287: #if (!level.is_a? Integer)
  310. 288: if (@volume == nil || (!@volume.is_a? Integer))
  311. 289: InitVolume()
  312. 290: end
  313. 291:
  314. 292: if (level == "up")
  315. 293: @volume += 1
  316. 294: elsif (level == "down")
  317. 295: @volume -= 1
  318. 296: else
  319. 297: @volume = level.to_i()
  320. 298: end
  321. 299: # set the volume
  322. 300: Command("kf","" + "%02X" % @volume)
  323. 301:end
  324. 302:
  325. 303:def InitVolume()
  326. 304: # need to check if we know the volume before setting it. if we dont, get it
  327. 305: # check if we already have it in memory first
  328. 306: if (@volume == nil || (!@volume.is_a? Integer))
  329. 307: # no volume info in the db, get it from the tv
  330. 308: #check if tv is on
  331. 309: unless (SendCommand("ka","ff",1))
  332. 310: # turn the tv on
  333. 311: SendCommand("ka","01",3)
  334. 312: tvon = true # so we can turn it off later
  335. 313: end
  336. 314: # ask for the volume
  337. 315: result = SendCommand("kf","ff",1)
  338. 316: if (result[1] != nil)
  339. 317: @volume = result[1].to_i(16) # TV uses hex values
  340. 318: if (tvon == true)
  341. 319: # be nice and turn the TV off now that we are done with it, if it was off to begin with
  342. 320: SendCommand("ka","00",1)
  343. 321: end
  344. 322: log "returning true"
  345. 323: return true
  346. 324: else
  347. 325: # could not get volume, use a sane default and let the init function know that we could not turn the tv on
  348. 326: @volume = 10
  349. 327: return false
  350. 328: end
  351. 329:
  352. 330: else
  353. 331: return true
  354. 332: end
  355. 333:end
  356. 334:#### 548 ####################################################################
  357. 335:def cmd_548(text, streamid, cmd=nil)
  358. 336:@returnParamArray.clear
  359. 337:SendKey("43")
  360. 338:return @returnParamArray
  361. 339:end
  362. 340:#### 712 ####################################################################
  363. 341:def cmd_712(cmd=nil)
  364. 342:@returnParamArray.clear
  365. 343:Command("xb","40")
  366. 344:return @returnParamArray
  367. 345:end
  368. 346:#### 713 ####################################################################
  369. 347:def cmd_713(cmd=nil)
  370. 348:@returnParamArray.clear
  371. 349:Command("xb"," 41")
  372. 350:return @returnParamArray
  373. 351:end
  374. 352:#### 763 ####################################################################
  375. 353:def cmd_763(cmd=nil)
  376. 354:@returnParamArray.clear
  377. 355:SendKey("5B")
  378. 356:return @returnParamArray
  379. 357:end
  380. 358:#### 767 ####################################################################
  381. 359:def cmd_767(cmd=nil)
  382. 360:@returnParamArray.clear
  383. 361:Command("xb","91")
  384. 362:return @returnParamArray
  385. 363:end
  386. 364:#### 873 ####################################################################
  387. 365:def cmd_873(cmd=nil)
  388. 366:@returnParamArray.clear
  389. 367:EmbeddedTuner("00")
  390. 368:return @returnParamArray
  391. 369:end
  392. 370:#### 930 ####################################################################
  393. 371:def cmd_930(cmd=nil)
  394. 372:@returnParamArray.clear
  395. 373:Command("xb","92")
  396. 374:return @returnParamArray
  397. 375:end
  398. 376:#### 937 ####################################################################
  399. 377:def cmd_937(cmd=nil)
  400. 378:@returnParamArray.clear
  401. 379:SendKey("AA")
  402. 380:return @returnParamArray
  403. 381:end
  404. 382:#### 964 ####################################################################
  405. 383:def cmd_964(cmd=nil)
  406. 384:@returnParamArray.clear
  407. 385:SendKey("00")
  408. 386:return @returnParamArray
  409. 387:end
  410. 388:#### 965 ####################################################################
  411. 389:def cmd_965(cmd=nil)
  412. 390:@returnParamArray.clear
  413. 391:SendKey("01")
  414. 392:return @returnParamArray
  415. 393:end
  416. 394:#### 984 ####################################################################
  417. 395:def cmd_984(cmd=nil)
  418. 396:@returnParamArray.clear
  419. 397:Command("xb","90")
  420. 398:return @returnParamArray
  421. 399:end
  422. 400:#### 985 ####################################################################
  423. 401:def cmd_985(cmd=nil)
  424. 402:@returnParamArray.clear
  425. 403:Command("xb","93")
  426. 404:return @returnParamArray
  427. 405:end
  428. 406:#### 1086 ####################################################################
  429. 407:def cmd_1086(cmd=nil)
  430. 408:@returnParamArray.clear
  431. 409:Command("xb","42")
  432. 410:return @returnParamArray
  433. 411:end
  434. 412:#### START SETTERS ####################################################################
  435. 413:def initialize()
  436. 414:super
  437. 415:@returnParamArray=Array.new
  438. 416:end
  439. 417:#### END SETTERS ####################################################################
  440. 418:end
  441. 420:01 04/06/11 18:04:11.527 Error while calling method: Cannot call class method: cmd_355
  442. error: undefined local variable or method `conn_' for #, line: 257
  443. backtrace:
  444. in: (eval): 257
  445. from (eval):257:in `SendCommand'
  446. from (eval):309:in `InitVolume'
  447. from (eval):215:in `cmd_355'
  448. <0xb50ceb90>
  449. 05 04/06/11 18:05:08.092 Got a reload command from 0 <0xb58cfb90>
  450. 05 04/06/11 18:05:08.377 void ClientSocket::Disconnect() on this socket: 0xa063e70 (m_Socket: 8) <0xb71138d0>
  451. Return code: 2
  452. 2 04/06/11 18:05:08 64 (spawning-device) Device requests restart... count=1/50 dev=64
  453. 2 04/06/11 18:05:08 64 (spawning-device) Device was disabled or removed. Stopping and marking as not running.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement