Pulse-Eight / libcec

USB CEC Adapter communication Library http://libcec.pulse-eight.com/
Other
705 stars 282 forks source link

ioctl CEC_TRANSMIT failed using pyCecClient #592

Closed foxy82 closed 2 years ago

foxy82 commented 2 years ago

I'm running on Rasbian using bullseye and a USB adapter. I compiled using the instructions in the repo.

When I use cec-client things look ok however when I use the python client I get a lot of errors:

pi@raspberrypi:~/libcec/src/pyCecClient $ python3 pyCecClient.py
<module 'cec' from '/usr/local/lib/python3.9/dist-packages/cec.py'>
libCEC version 6.0.2 loaded: compiled on Linux-4.9.0-0.bpo.6-armmp ... , features: P8_USB, DRM, P8_detect, randr, Exynos, Linux, AOCEC
NOTICE:  [1513]     connection opened
NOTICE:  [2453]     connection opened
found a CEC adapter:
port:     /dev/ttyACM0
vendor:   0x2548
product:  0x1002
found a CEC adapter:
port:     Linux
vendor:   0x0
product:  0x0
WARNING: [2475]     CLinuxCECAdapterCommunication::Open - physical address is invalid
NOTICE:  [2479]     connection opened
TRAFFIC: [2483]     << f0
TRAFFIC: [4626]     << f0
NOTICE:  [6786]     setting HDMI port to 1 on device TV (0)
TRAFFIC: [6786]     << f0
TRAFFIC: [8946]     << f0
TRAFFIC: [11106]     << 11
ERROR:   [11106]     CLinuxCECAdapterCommunication::Write - ioctl CEC_TRANSMIT failed - tx_status=00 errno=64
TRAFFIC: [11106]     << 11
ERROR:   [11106]     CLinuxCECAdapterCommunication::Write - ioctl CEC_TRANSMIT failed - tx_status=00 errno=64
scan    <------------------------------------------------------------- I typed this 
connection opened
Enter command:requesting CEC bus information ...
CEC bus information
===================
device #1: Recorder 1
address:       4096
active source: False
vendor:        Pulse Eight
CEC version:   1.4
OSD name:      pyLibCec
power status:  on

NOTICE:  [11108]     setting HDMI port to 1 on device TV (0)
TRAFFIC: [11108]     << 10
TRAFFIC: [13266]     << 10
TRAFFIC: [15427]     << 1f:84:10:00:01
ERROR:   [15427]     CLinuxCECAdapterCommunication::Write - ioctl CEC_TRANSMIT failed - tx_status=00 errno=64
TRAFFIC: [15427]     << 1f:84:10:00:01
ERROR:   [15427]     CLinuxCECAdapterCommunication::Write - ioctl CEC_TRANSMIT failed - tx_status=00 errno=64
NOTICE:  [15427]     CEC client registered: libCEC version = 6.0.2, client version = 6.0.2, firmware version = 0, logical address(es) = Recorder 1 (1) , base device: TV (0), HDMI port number: 1, physical address: 1.0.0.0, compiled on Linux-4.9.0-0.bpo.6-armmp ... , features: P8_USB, DRM, P8_detect, randr, Exynos, Linux, AOCEC

Enter command:TRAFFIC: [15427]     << 10
TRAFFIC: [17586]     << 10
TRAFFIC: [19748]     << 10
TRAFFIC: [21906]     << 10
TRAFFIC: [24067]     << 10
TRAFFIC: [26226]     << 10
TRAFFIC: [28387]     << 12
ERROR:   [28387]     CLinuxCECAdapterCommunication::Write - ioctl CEC_TRANSMIT failed - tx_status=00 errno=64
TRAFFIC: [28387]     << 12
ERROR:   [28387]     CLinuxCECAdapterCommunication::Write - ioctl CEC_TRANSMIT failed - tx_status=00 errno=64
TRAFFIC: [28387]     << 13
ERROR:   [28387]     CLinuxCECAdapterCommunication::Write - ioctl CEC_TRANSMIT failed - tx_status=00 errno=64
TRAFFIC: [28387]     << 13
ERROR:   [28387]     CLinuxCECAdapterCommunication::Write - ioctl CEC_TRANSMIT failed - tx_status=00 errno=64
TRAFFIC: [28388]     << 14
ERROR:   [28388]     CLinuxCECAdapterCommunication::Write - ioctl CEC_TRANSMIT failed - tx_status=00 errno=64
TRAFFIC: [28388]     << 14
ERROR:   [28388]     CLinuxCECAdapterCommunication::Write - ioctl CEC_TRANSMIT failed - tx_status=00 errno=64
TRAFFIC: [28388]     << 15
ERROR:   [28388]     CLinuxCECAdapterCommunication::Write - ioctl CEC_TRANSMIT failed - tx_status=00 errno=64
TRAFFIC: [28388]     << 15
ERROR:   [28388]     CLinuxCECAdapterCommunication::Write - ioctl CEC_TRANSMIT failed - tx_status=00 errno=64
TRAFFIC: [28389]     << 16
ERROR:   [28389]     CLinuxCECAdapterCommunication::Write - ioctl CEC_TRANSMIT failed - tx_status=00 errno=64
TRAFFIC: [28389]     << 16
ERROR:   [28389]     CLinuxCECAdapterCommunication::Write - ioctl CEC_TRANSMIT failed - tx_status=00 errno=64
TRAFFIC: [28389]     << 17
ERROR:   [28389]     CLinuxCECAdapterCommunication::Write - ioctl CEC_TRANSMIT failed - tx_status=00 errno=64
TRAFFIC: [28389]     << 17
ERROR:   [28389]     CLinuxCECAdapterCommunication::Write - ioctl CEC_TRANSMIT failed - tx_status=00 errno=64
TRAFFIC: [28389]     << 18
ERROR:   [28389]     CLinuxCECAdapterCommunication::Write - ioctl CEC_TRANSMIT failed - tx_status=00 errno=64
TRAFFIC: [28389]     << 18
ERROR:   [28390]     CLinuxCECAdapterCommunication::Write - ioctl CEC_TRANSMIT failed - tx_status=00 errno=64
TRAFFIC: [28390]     << 19
ERROR:   [28390]     CLinuxCECAdapterCommunication::Write - ioctl CEC_TRANSMIT failed - tx_status=00 errno=64
TRAFFIC: [28390]     << 19
ERROR:   [28390]     CLinuxCECAdapterCommunication::Write - ioctl CEC_TRANSMIT failed - tx_status=00 errno=6

Running cec-client has some ack errors but does return the scan details:

pi@raspberrypi:~/libcec/src/pyCecClient $ cec-client
No device type given. Using 'recording device'
CEC Parser created - libCEC version 6.0.2
no serial port given. trying autodetect:
 path:     /sys/devices/platform/soc/20980000.usb/usb1/1-1/1-1.3
 com port: /dev/ttyACM0

opening a connection to the CEC adapter...
DEBUG:   [             280]     Broadcast (F): osd name set to 'Broadcast'
DEBUG:   [             286]     connection opened, clearing any previous input and waiting for active transmissions to end before starting
DEBUG:   [            1296]     communication thread started
DEBUG:   [            1358]     usbcec: enabling controlled mode
NOTICE:  [            1539]     connection opened
DEBUG:   [            1545]     << Broadcast (F) -> TV (0): POLL
TRAFFIC: [            1546]     << f0
DEBUG:   [            1550]     processor thread started
DEBUG:   [            1595]     usbcec: updating line timeout: 3
DEBUG:   [            1742]     >> POLL sent
DEBUG:   [            1742]     TV (0): device status changed into 'present'
DEBUG:   [            1742]     << requesting vendor ID of 'TV' (0)
TRAFFIC: [            1742]     << f0:8c
TRAFFIC: [            2011]     >> 0f:87:08:00:46
DEBUG:   [            2011]     TV (0): vendor = Sony (080046)
DEBUG:   [            2013]     expected response received (87: device vendor id)
DEBUG:   [            2013]     registering new CEC client - v6.0.2
DEBUG:   [            2017]     >> TV (0) -> Broadcast (F): device vendor id (87)
DEBUG:   [            2074]     usbcec: autonomous mode = disabled
DEBUG:   [            2131]     usbcec: logical address = Recorder 1
DEBUG:   [            2190]     usbcec: device type = recording device
DEBUG:   [            2201]     usbcec: logical address mask = 206
DEBUG:   [            2276]     usbcec: physical address = 1000
DEBUG:   [            2336]     usbcec: CEC version = 1.4
DEBUG:   [            2336]     SetClientVersion - using client version '6.0.2'
NOTICE:  [            2336]     setting HDMI port to 1 on device TV (0)
DEBUG:   [            2336]     SetConfiguration: double tap timeout = 200ms, repeat rate = 0ms, release delay = 500ms
DEBUG:   [            2336]     detecting logical address for type 'recording device'
DEBUG:   [            2336]     trying logical address 'Recorder 1'
DEBUG:   [            2336]     << Recorder 1 (1) -> Recorder 1 (1): POLL
TRAFFIC: [            2337]     << 11
DEBUG:   [            2429]     CEC transmission - received response - TRANSMIT_FAILED_ACK
TRAFFIC: [            2430]     << 11
DEBUG:   [            2516]     CEC transmission - received response - TRANSMIT_FAILED_ACK
DEBUG:   [            2516]     >> POLL not sent
DEBUG:   [            2516]     using logical address 'Recorder 1'
DEBUG:   [            2516]     Recorder 1 (1): device status changed into 'handled by libCEC'
DEBUG:   [            2516]     Recorder 1 (1): power status changed from 'unknown' to 'on'
DEBUG:   [            2516]     Recorder 1 (1): vendor = Pulse Eight (001582)
DEBUG:   [            2516]     Recorder 1 (1): CEC version 1.4
DEBUG:   [            2516]     AllocateLogicalAddresses - device '0', type 'recording device', LA '1'
DEBUG:   [            2522]     usbcec: updating ackmask: 0002
DEBUG:   [            2577]     Recorder 1 (1): osd name set to 'CECTester'
DEBUG:   [            2578]     Recorder 1 (1): menu language set to 'eng'
DEBUG:   [            2578]     GetPhysicalAddress - trying to get the physical address via ADL
DEBUG:   [            2580]     GetPhysicalAddress - ADL returned physical address 0000
DEBUG:   [            2580]     GetPhysicalAddress - trying to get the physical address via nvidia driver
DEBUG:   [            2580]     GetPhysicalAddress - nvidia driver returned physical address 0000
DEBUG:   [            2580]     GetPhysicalAddress - trying to get the physical address via drm files
DEBUG:   [            2582]     GetPhysicalAddress - drm files returned physical address 0000
DEBUG:   [            2582]     GetPhysicalAddress - trying to get the physical address from the OS
DEBUG:   [            2594]     GetPhysicalAddress - OS returned physical address 0000
NOTICE:  [            2594]     setting HDMI port to 1 on device TV (0)
DEBUG:   [            2595]     Recorder 1 (1): physical address changed from ffff to 1000
DEBUG:   [            2595]     << Recorder 1 (1) -> broadcast (F): physical address 1000
TRAFFIC: [            2595]     << 1f:84:10:00:01
DEBUG:   [            2807]     using device/input physical address 0000
NOTICE:  [            2808]     CEC client registered: libCEC version = 6.0.2, client version = 6.0.2, firmware version = 8, firmware build date: Fri Jul 21 09:08:24 2017 +0000, logical address(es) = Recorder 1 (1) , base device: TV (0), HDMI port number: 1, physical address: 1.0.0.0, compiled on Linux-4.9.0-0.bpo.6-armmp ... , features: P8_USB, DRM, P8_detect, randr, Exynos, Linux, AOCEC
DEBUG:   [            2808]     << Recorder 1 (1) -> TV (0): OSD name 'CECTester'
TRAFFIC: [            2808]     << 10:47:43:45:43:54:65:73:74:65:72
DEBUG:   [            3191]     << requesting power status of 'TV' (0)
TRAFFIC: [            3191]     << 10:8f
TRAFFIC: [            3407]     >> 01:90:01
DEBUG:   [            3408]     TV (0): power status changed from 'unknown' to 'standby'
DEBUG:   [            3409]     expected response received (90: report power status)
waiting for input
DEBUG:   [            3413]     >> TV (0) -> Recorder 1 (1): report power status (90)
scan <------------------------------------------------------------- I typed this 
requesting CEC bus information ...
DEBUG:   [            5886]     << Recorder 1 (1) -> Recorder 2 (2): POLL
TRAFFIC: [            5891]     << 12
DEBUG:   [            5996]     CEC transmission - received response - TRANSMIT_FAILED_ACK
TRAFFIC: [            5998]     << 12
DEBUG:   [            6091]     CEC transmission - received response - TRANSMIT_FAILED_ACK
DEBUG:   [            6093]     >> POLL not sent
DEBUG:   [            6093]     Recorder 2 (2): device status changed into 'not present'
DEBUG:   [            6093]     << Recorder 1 (1) -> Tuner 1 (3): POLL
TRAFFIC: [            6094]     << 13
DEBUG:   [            6186]     CEC transmission - received response - TRANSMIT_FAILED_ACK
TRAFFIC: [            6186]     << 13
DEBUG:   [            6280]     CEC transmission - received response - TRANSMIT_FAILED_ACK
DEBUG:   [            6281]     >> POLL not sent
DEBUG:   [            6282]     Tuner 1 (3): device status changed into 'not present'
DEBUG:   [            6282]     << Recorder 1 (1) -> Playback 1 (4): POLL
TRAFFIC: [            6282]     << 14
DEBUG:   [            6375]     CEC transmission - received response - TRANSMIT_FAILED_ACK
TRAFFIC: [            6375]     << 14
DEBUG:   [            6470]     CEC transmission - received response - TRANSMIT_FAILED_ACK
DEBUG:   [            6472]     >> POLL not sent
DEBUG:   [            6472]     Playback 1 (4): device status changed into 'not present'
DEBUG:   [            6472]     << Recorder 1 (1) -> Audio (5): POLL
TRAFFIC: [            6472]     << 15
DEBUG:   [            6565]     CEC transmission - received response - TRANSMIT_FAILED_ACK
TRAFFIC: [            6566]     << 15
DEBUG:   [            6659]     CEC transmission - received response - TRANSMIT_FAILED_ACK
DEBUG:   [            6661]     >> POLL not sent
DEBUG:   [            6661]     Audio (5): device status changed into 'not present'
DEBUG:   [            6661]     << Recorder 1 (1) -> Tuner 2 (6): POLL
TRAFFIC: [            6661]     << 16
DEBUG:   [            6755]     CEC transmission - received response - TRANSMIT_FAILED_ACK
TRAFFIC: [            6755]     << 16
DEBUG:   [            6848]     CEC transmission - received response - TRANSMIT_FAILED_ACK
DEBUG:   [            6850]     >> POLL not sent
DEBUG:   [            6850]     Tuner 2 (6): device status changed into 'not present'
DEBUG:   [            6850]     << Recorder 1 (1) -> Tuner 3 (7): POLL
TRAFFIC: [            6850]     << 17
DEBUG:   [            6939]     CEC transmission - received response - TRANSMIT_FAILED_ACK
TRAFFIC: [            6939]     << 17
DEBUG:   [            7030]     CEC transmission - received response - TRANSMIT_FAILED_ACK
DEBUG:   [            7032]     >> POLL not sent
DEBUG:   [            7032]     Tuner 3 (7): device status changed into 'not present'
DEBUG:   [            7032]     << Recorder 1 (1) -> Playback 2 (8): POLL
TRAFFIC: [            7032]     << 18
DEBUG:   [            7126]     CEC transmission - received response - TRANSMIT_FAILED_ACK
TRAFFIC: [            7126]     << 18
DEBUG:   [            7221]     CEC transmission - received response - TRANSMIT_FAILED_ACK
DEBUG:   [            7221]     >> POLL not sent
DEBUG:   [            7221]     Playback 2 (8): device status changed into 'not present'
DEBUG:   [            7221]     << Recorder 1 (1) -> Recorder 3 (9): POLL
TRAFFIC: [            7221]     << 19
DEBUG:   [            7316]     CEC transmission - received response - TRANSMIT_FAILED_ACK
TRAFFIC: [            7317]     << 19
DEBUG:   [            7409]     CEC transmission - received response - TRANSMIT_FAILED_ACK
DEBUG:   [            7410]     >> POLL not sent
DEBUG:   [            7411]     Recorder 3 (9): device status changed into 'not present'
DEBUG:   [            7411]     << Recorder 1 (1) -> Tuner 4 (A): POLL
TRAFFIC: [            7411]     << 1a
DEBUG:   [            7504]     CEC transmission - received response - TRANSMIT_FAILED_ACK
TRAFFIC: [            7505]     << 1a
DEBUG:   [            7598]     CEC transmission - received response - TRANSMIT_FAILED_ACK
DEBUG:   [            7600]     >> POLL not sent
DEBUG:   [            7600]     Tuner 4 (A): device status changed into 'not present'
DEBUG:   [            7600]     << Recorder 1 (1) -> Playback 3 (B): POLL
TRAFFIC: [            7600]     << 1b
DEBUG:   [            7694]     CEC transmission - received response - TRANSMIT_FAILED_ACK
TRAFFIC: [            7696]     << 1b
DEBUG:   [            7788]     CEC transmission - received response - TRANSMIT_FAILED_ACK
DEBUG:   [            7789]     >> POLL not sent
DEBUG:   [            7790]     Playback 3 (B): device status changed into 'not present'
DEBUG:   [            7790]     << Recorder 1 (1) -> Reserved 1 (C): POLL
TRAFFIC: [            7790]     << 1c
DEBUG:   [            7882]     CEC transmission - received response - TRANSMIT_FAILED_ACK
TRAFFIC: [            7882]     << 1c
DEBUG:   [            7975]     CEC transmission - received response - TRANSMIT_FAILED_ACK
DEBUG:   [            7977]     >> POLL not sent
DEBUG:   [            7977]     Reserved 1 (C): device status changed into 'not present'
DEBUG:   [            7977]     << Recorder 1 (1) -> Reserved 2 (D): POLL
TRAFFIC: [            7977]     << 1d
DEBUG:   [            8072]     CEC transmission - received response - TRANSMIT_FAILED_ACK
TRAFFIC: [            8073]     << 1d
DEBUG:   [            8166]     CEC transmission - received response - TRANSMIT_FAILED_ACK
DEBUG:   [            8168]     >> POLL not sent
DEBUG:   [            8168]     Reserved 2 (D): device status changed into 'not present'
DEBUG:   [            8168]     << Recorder 1 (1) -> Free use (E): POLL
TRAFFIC: [            8168]     << 1e
DEBUG:   [            8263]     CEC transmission - received response - TRANSMIT_FAILED_ACK
TRAFFIC: [            8265]     << 1e
DEBUG:   [            8356]     CEC transmission - received response - TRANSMIT_FAILED_ACK
DEBUG:   [            8358]     >> POLL not sent
DEBUG:   [            8358]     Free use (E): device status changed into 'not present'
DEBUG:   [            8358]     << requesting active source
TRAFFIC: [            8358]     << 1f:85
DEBUG:   [            9422]     expected response not received (82: active source)
TRAFFIC: [            9422]     << 1f:85
DEBUG:   [           10478]     expected response not received (82: active source)
DEBUG:   [           10479]     << requesting CEC version of 'TV' (0)
TRAFFIC: [           10479]     << 10:9f
TRAFFIC: [           10693]     >> 01:9e:05
DEBUG:   [           10693]     TV (0): CEC version 1.4
DEBUG:   [           10695]     expected response received (9E: cec version)
DEBUG:   [           10695]     << requesting menu language of 'TV' (0)
TRAFFIC: [           10695]     << 10:91
DEBUG:   [           10698]     >> TV (0) -> Recorder 1 (1): cec version (9E)
TRAFFIC: [           10961]     >> 0f:32:65:6e:67
DEBUG:   [           10961]     TV (0): menu language set to 'eng'
DEBUG:   [           10963]     expected response received (32: set menu language)
DEBUG:   [           10964]     << requesting active source
TRAFFIC: [           10964]     << 1f:85
DEBUG:   [           10967]     >> TV (0) -> Broadcast (F): set menu language (32)
DEBUG:   [           12026]     expected response not received (82: active source)
TRAFFIC: [           12026]     << 1f:85
CEC bus information
===================
device #0: TV
address:       0.0.0.0
active source: no
vendor:        Sony
osd string:    TV
CEC version:   1.4
power status:  standby
language:      eng

device #1: Recorder 1
address:       1.0.0.0
active source: no
vendor:        Pulse Eight
osd string:    CECTester
CEC version:   1.4
power status:  on
language:      eng

currently active source: unknown (-1)
DEBUG:   [           13084]     expected response not received (82: active source)
foxy82 commented 2 years ago

Never mind. I was running on. Pi with a USB adapter as the pi isn't the video source I want to work with. The pyCecClient.py found both the usb and the Pi hdmi port and was trying to use the unconnected hdmi port and not the usb adapter.

I changed which adapter was returned in DetectAdapter