1

I'm trying to use this script to turn on a TCL TV and change the input to RPi using cec-client:

echo 'on 0' | cec-client -s
echo '4f:82:10:00' | cec-client -s

It will turn the TV on, but not change the input. If the TV's on, it will change the input. But it won't do both. The logs from each test are below.

I already tried:

  • adding a time delay before changing the input
  • checking that the TV status was on before changing the input
  • including sudo in front of the change input command

LOG: TV on, input successfully changes to RPi


    opening a connection to the CEC adapter...
    DEBUG:   [             233] Broadcast (F): osd name set to 'Broadcast'
    DEBUG:   [             234] Open - vc_cec initialised
    DEBUG:   [             234] logical address changed to Free use (e)
    NOTICE:  [             234] connection opened
    DEBUG:   [             234] processor thread started
    DEBUG:   [             234] << Broadcast (F) -> TV (0): POLL
    DEBUG:   [             235] initiator 'Broadcast' is not supported by the CEC adapter. using 'Free use' instead
    TRAFFIC: [             235] << e0
    DEBUG:   [             295] >> POLL sent
    DEBUG:   [             295] TV (0): device status changed into 'present'
    DEBUG:   [             295] << requesting vendor ID of 'TV' (0)
    TRAFFIC: [             295] << e0:8c
    TRAFFIC: [             506] >> 0f:87:8a:c7:2e


    DEBUG:   [             506] TV (0): vendor = Unknown (8ac72e)


    DEBUG:   [             506] >> TV (0) -> Broadcast (F): device vendor id (87)

    DEBUG:   [             506] expected response received (87: device vendor id)
    NOTICE:  [             506] registering new CEC client - v4.0.4
    DEBUG:   [             506] detecting logical address for type 'recording device'
    DEBUG:   [             506] trying logical address 'Recorder 1'
    DEBUG:   [             506] << Recorder 1 (1) -> Recorder 1 (1): POLL
    TRAFFIC: [             506] << 11
    TRAFFIC: [             776] << 11
    DEBUG:   [            1047] >> POLL not sent
    DEBUG:   [            1047] using logical address 'Recorder 1'
    DEBUG:   [            1047] Recorder 1 (1): device status changed into 'handled by libCEC'
    DEBUG:   [            1047] Recorder 1 (1): power status changed from 'unknown' to 'on'
    DEBUG:   [            1047] Recorder 1 (1): vendor = Pulse Eight (001582)
    DEBUG:   [            1047] Recorder 1 (1): CEC version 1.4
    DEBUG:   [            1047] AllocateLogicalAddresses - device '0', type 'recording device', LA '1'
    DEBUG:   [            1048] Recorder 1 (1): osd name set to 'CECTester'
    DEBUG:   [            1048] logical address changed to Recorder 1 (1)
    DEBUG:   [            1048] Recorder 1 (1): menu language set to 'eng'
    DEBUG:   [            1048] GetPhysicalAddress - physical address = 1000
    DEBUG:   [            1048] AutodetectPhysicalAddress - autodetected physical address '1000'
    DEBUG:   [            1048] Recorder 1 (1): physical address changed from ffff to 1000
    DEBUG:   [            1048] << Recorder 1 (1) -> broadcast (F): physical address 1000
    TRAFFIC: [            1048] << 1f:84:10:00:01
    NOTICE:  [            1199] CEC client registered: libCEC version = 4.0.4, client version = 4.0.4, firmware version = 1, logical address(es) = Recorder 1 (1) , physical address: 1.0.0.0, compiled on Linux-4.15.0-48-generic ... , features: P8_USB, DRM, P8_detect, randr, RPi, Exynos, AOCEC
    DEBUG:   [            1199] << Recorder 1 (1) -> TV (0): OSD name 'CECTester'
    TRAFFIC: [            1199] << 10:47:43:45:43:54:65:73:74:65:72
    DEBUG:   [            1560] << requesting power status of 'TV' (0)
    TRAFFIC: [            1560] << 10:8f
    TRAFFIC: [            1680] >> 01:46

    DEBUG:   [            1680] << Recorder 1 (1) -> TV (0): OSD name 'CECTester'
    TRAFFIC: [            1680] << 10:47:43:45:43:54:65:73:74:65:72

    DEBUG:   [            1681] >> TV (0) -> Recorder 1 (1): give osd name (46)
    TRAFFIC: [            1981] >> 01:8c
    DEBUG:   [            1981] << Recorder 1 (1) -> TV (0): vendor id Pulse Eight (1582)
    TRAFFIC: [            1981] << 1f:87:00:15:82
    DEBUG:   [            1981] >> TV (0) -> Recorder 1 (1): give device vendor id (8C)
    TRAFFIC: [            2223] >> 01:90:00
    DEBUG:   [            2223] TV (0): power status changed from 'unknown' to 'on'
    DEBUG:   [            2223] >> TV (0) -> Recorder 1 (1): report power status (90)
    DEBUG:   [            2223] expected response received (90: report power status)
    TRAFFIC: [            2223] << 4f:82:10:00
    WARNING: [            2343] unhandled response received: opcode=82 initiator=1 destination=f response=0
    TRAFFIC: [            2440] >> 01:8c
    DEBUG:   [            2440] >> TV (0) -> Recorder 1 (1): give device vendor id (8C)
    DEBUG:   [            3223] command 'active source' timeout
    DEBUG:   [            3724] unregistering all CEC clients
    NOTICE:  [            3724] unregistering client: libCEC version = 4.0.4, client version = 4.0.4, firmware version = 1, logical address(es) = Recorder 1 (1) , physical address: 1.0.0.0, compiled on Linux-4.15.0-48-generic ... , features: P8_USB, DRM, P8_detect, randr, RPi, Exynos, AOCEC
    DEBUG:   [            3724] Recorder 1 (1): power status changed from 'on' to 'unknown'
    DEBUG:   [            3724] Recorder 1 (1): vendor = Unknown (000000)
    DEBUG:   [            3724] Recorder 1 (1): CEC version unknown
    DEBUG:   [            3724] Recorder 1 (1): osd name set to 'Recorder 1'
    DEBUG:   [            3724] Recorder 1 (1): device status changed into 'unknown'
    DEBUG:   [            3724] unregistering all CEC clients
    TRAFFIC: [            3724] >> 01:46


    DEBUG:   [            3724] >> TV (0) -> Recorder 1 (1): give osd name (46)
    DEBUG:   [            4235] UnregisterLogicalAddress - releasing previous logical address
    DEBUG:   [            4236] logical address changed to Broadcast (f)

LOG: TV off, Script turns TV on but doesn't change input


    opening a connection to the CEC adapter...
    DEBUG:   [             203] Broadcast (F): osd name set to 'Broadcast'
    DEBUG:   [             203] Open - vc_cec initialised
    DEBUG:   [             203] logical address changed to Free use (e)
    NOTICE:  [             204] connection opened
    DEBUG:   [             204] processor thread started
    DEBUG:   [             204] << Broadcast (F) -> TV (0): POLL
    DEBUG:   [             204] initiator 'Broadcast' is not supported by the CEC adapter. using 'Free use' instead
    TRAFFIC: [             204] << e0
    DEBUG:   [             264] >> POLL sent
    DEBUG:   [             264] TV (0): device status changed into 'present'
    DEBUG:   [             264] << requesting vendor ID of 'TV' (0)
    TRAFFIC: [             264] << e0:8c
    DEBUG:   [             640] GetPhysicalAddress - physical address = 1000
    TRAFFIC: [             949] >> 0e:83
    TRAFFIC: [            1139] >> 0f:80:00:00:10:00
    DEBUG:   [            1140] >> TV (0) -> Broadcast (F): routing change (80)
    DEBUG:   [            1140] TV (0): power status changed from 'unknown' to 'on'
    TRAFFIC: [            1300] >> 0f:87:8a:c7:2e
    DEBUG:   [            1300] >> TV (0) -> Broadcast (F): device vendor id (87)
    DEBUG:   [            1300] TV (0): vendor = Unknown (8ac72e)
    DEBUG:   [            1300] expected response received (87: device vendor id)
    NOTICE:  [            1301] registering new CEC client - v4.0.4
    DEBUG:   [            1301] detecting logical address for type 'recording device'
    DEBUG:   [            1301] trying logical address 'Recorder 1'
    DEBUG:   [            1301] << Recorder 1 (1) -> Recorder 1 (1): POLL
    TRAFFIC: [            1301] << 11
    TRAFFIC: [            1571] << 11
    DEBUG:   [            1841] >> POLL not sent
    DEBUG:   [            1842] using logical address 'Recorder 1'
    DEBUG:   [            1842] Recorder 1 (1): device status changed into 'handled by libCEC'
    DEBUG:   [            1842] Recorder 1 (1): power status changed from 'unknown' to 'on'
    DEBUG:   [            1842] Recorder 1 (1): vendor = Pulse Eight (001582)
    DEBUG:   [            1842] Recorder 1 (1): CEC version 1.4
    DEBUG:   [            1842] AllocateLogicalAddresses - device '0', type 'recording device', LA '1'
    DEBUG:   [            1842] logical address changed to Recorder 1 (1)
    DEBUG:   [            1842] Recorder 1 (1): osd name set to 'CECTester'
    DEBUG:   [            1842] Recorder 1 (1): menu language set to 'eng'
    DEBUG:   [            1842] GetPhysicalAddress - physical address = 1000
    DEBUG:   [            1842] AutodetectPhysicalAddress - autodetected physical address '1000'
    DEBUG:   [            1842] Recorder 1 (1): physical address changed from ffff to 1000
    DEBUG:   [            1842] << Recorder 1 (1) -> broadcast (F): physical address 1000
    TRAFFIC: [            1842] << 1f:84:10:00:01
    NOTICE:  [            1993] CEC client registered: libCEC version = 4.0.4, client version = 4.0.4, firmware version = 1, logical address(es) = Recorder 1 (1) , physical address: 1.0.0.0, compiled on Linux-4.15.0-48-generic ... , features: P8_USB, DRM, P8_detect, randr, RPi, Exynos, AOCEC
    DEBUG:   [            1993] << Recorder 1 (1) -> TV (0): OSD name 'CECTester'
    TRAFFIC: [            1993] << 10:47:43:45:43:54:65:73:74:65:72
    DEBUG:   [            2353] << requesting power status of 'TV' (0)
    TRAFFIC: [            2354] << 10:8f
    TRAFFIC: [            2354] >> 01:46
    DEBUG:   [            2354] >> TV (0) -> Recorder 1 (1): give osd name (46)
    DEBUG:   [            2474] << Recorder 1 (1) -> TV (0): OSD name 'CECTester'
    TRAFFIC: [            2474] << 10:47:43:45:43:54:65:73:74:65:72
    TRAFFIC: [            2775] >> 01:8c
    DEBUG:   [            2775] >> TV (0) -> Recorder 1 (1): give device vendor id (8C)

    DEBUG:   [            2775] << Recorder 1 (1) -> TV (0): vendor id Pulse Eight (1582)
    TRAFFIC: [            2776] << 1f:87:00:15:82

    TRAFFIC: [            3017] >> 01:90:00

    DEBUG:   [            3017] >> TV (0) -> Recorder 1 (1): report power status (90)
    DEBUG:   [            3017] expected response received (90: report power status)
    TRAFFIC: [            3018] << 4f:82:10:00
    WARNING: [            3138] unhandled response received: opcode=82 initiator=1 destination=f response=0
    TRAFFIC: [            3223] >> 0f:85
    DEBUG:   [            3223] >> TV (0) -> Broadcast (F): request active source (85)
    DEBUG:   [            4018] command 'active source' timeout
    DEBUG:   [            4518] unregistering all CEC clients
    NOTICE:  [            4518] unregistering client: libCEC version = 4.0.4, client version = 4.0.4, firmware version = 1, logical address(es) = Recorder 1 (1) , physical address: 1.0.0.0, compiled on Linux-4.15.0-48-generic ... , features: P8_USB, DRM, P8_detect, randr, RPi, Exynos, AOCEC
    DEBUG:   [            4519] Recorder 1 (1): power status changed from 'on' to 'unknown'
    DEBUG:   [            4519] Recorder 1 (1): vendor = Unknown (000000)
    DEBUG:   [            4519] Recorder 1 (1): CEC version unknown
    DEBUG:   [            4519] Recorder 1 (1): osd name set to 'Recorder 1'
    DEBUG:   [            4519] Recorder 1 (1): device status changed into 'unknown'
    DEBUG:   [            4519] unregistering all CEC clients
    TRAFFIC: [            4519] >> 01:8c
    DEBUG:   [            4519] >> TV (0) -> Recorder 1 (1): give device vendor id (8C)
    TRAFFIC: [            4519] >> 01:46
    DEBUG:   [            4519] >> TV (0) -> Recorder 1 (1): give osd name (46)
    DEBUG:   [            5205] UnregisterLogicalAddress - releasing previous logical address
    DEBUG:   [            5206] logical address changed to Broadcast (f)

Crossposted

2
  • With my Samsung TV on 'TV' input then switched to standby, the following turns on the TV on TV input then selects hdmi2 where my Pi4 is connected: echo 'on 0' | cec-client -s -d 1;echo 'tx 4f:82:20:00' | cec-client -s -d 1
    – CoderMike
    Sep 10, 2019 at 16:20
  • Thank you. Those are the same commands I'm using but for some reason when the TV is on standby it will turn it on but not change the input.
    – Amy
    Sep 12, 2019 at 0:46

2 Answers 2

1

Try using echo "as" | cec-client -s.

I'm not sure why your way isn't working (unfortunately switching inputs via tx doesn't work for me in any scenario), but using as should accomplish what you want.

as is the command to activate the source. From my testing, as acts like "one-touch-play" meaning it activates the source and turns on the TV if it's off.

Also, you can echo 'h' into cec-client to see the list of available commands. Use -d 1 to only see the list and not all the debug info. (e.g. echo h | cec-client -s -d 1)

0

Even though the original post is a few years old, I have encountered this problem as well. Seeing as I stumbled upon this post here, someone else might find this helpful.

Solution

From the warning, it would seem that the TV(0) is not responding to the message 4F:82:10:00. From what I can tell the source ID in your message does not correspond with the source ID of your device. Changing the message from 4F:82:10:00 to 1F:82:10:00, should fix the issue.

Explanation

The first byte in the message, in this case 4F, contains the source ID and destination ID, like <source><destination>.

  • <source> = 4: the message is sent from a device with source ID 4
  • <destinatio> = F: the message is broadcasted

In the debug message, the device ID is enclosed between brackets following the OSD name, like this:

  • <OSD name> (<device ID>).

In your case, these are: Recorder 1 (1) and TV (0). As you can see the source ID of your device, which I think is Recorder 1, is 1 not 4. So changing the source ID in your message should fix the problem.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.