2014-02-22, 16:39
(2014-02-06, 21:38)doug Wrote:Code:import time, serial
ser = serial.Serial(port='/dev/ttyUSB0', baudrate=38400, timeout=1)
ser.write("\x08\x22\x00\x00\x00\x02\xd6")
time.sleep(0.25)
result=ser.read(ser.inWaiting())
print result
ser.close()
This will send a command, wait 1/4 second and print the result. My pioneer responds in less than 0.05 seconds; you can decrease the delay later but I set it higher to have a better chance of the response getting received.
Alright, I figured out that when I moved things around I had broken my serial cable so there was no connection. I found the power toggle command by guessing. If x02\xd6 is off and x01\xd5 was on then I thought x00\xd4 might toggle and I was right! lol. Now I dont have a keyboard.xml file anywhere in my userdata folder. I am running xbmc 12.2 in xbmcbuntu. I have a keymaps folder that only has one noBS.xml which just has one edit to remove the backslash function. How do I get this python script to run when I press the power button and NOT put the computer to sleep or shutdown or anything? Also, Could I run it when xbmc becomes idle and again when its unidle?