trainman419 / python-cec

Other
171 stars 42 forks source link

cec.transmit() doesn't send correct parameters #27

Closed David-Strebel-CardinalPeak closed 6 years ago

David-Strebel-CardinalPeak commented 6 years ago

I'm trying to transmit the cec frame 15:44:44 with the code below. However, the cec frame that I see being sent by my pulse-eight adapter is 15:44:36:35. Any help on this issue would be appreciated.

destination = 0x5 opcode = 0x44 parameters = bytes(0x41) cec.transmit(destination, opcode, parameters)

nforro commented 6 years ago

The problem is here:

parameters = bytes(0x41)

This actually creates bytes object of size 0x41 filled with zeroes.

You should use this instead (notice the square brackets):

parameters = bytes([0x41])

However, passing such a large bytes object to cec.transmit() is unexpected and can lead to a crash, so that definitely needs fixing.

David-Strebel-CardinalPeak commented 6 years ago

When doing: parameters = bytes([0x44]), I transmit the frame 15:44:5b:36:38:5d. Is there any other method I could to use to send the frame 15:44:44?

nforro commented 6 years ago

Where does that come from? A log message? It works fine here on Raspberry Pi:

<< 15:44:44

You can try to transmit the data using cec-client:

echo "tx 15:44:44" | cec-client -s