Pulse-Eight / libcec

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

How can I create two sources? #593

Open foxy82 opened 2 years ago

foxy82 commented 2 years ago

Using the python client I want to create several devices on the bus and properly name them.

Using the pyCecClient as a base I updated the config like so:

self.cecconfig.deviceTypes.Add(cec.CEC_DEVICE_TYPE_RECORDING_DEVICE)
self.cecconfig.deviceTypes.Add(cec.CEC_DEVICE_TYPE_PLAYBACK_DEVICE)

This means my tv shows two sources but the first problem is I don't know how to give the second source a user friendly name it appears as "Playback 1" whilst the first source has the strDeviceName.

My second issue is that upon selecting "Playback 1" using my TV's sources button it will briefly select "Playback 1" and then revert to the Recorder - why won't it stay on Playback 1? Is it anything to do with the addresses being the same?

pi@raspberrypi:~/myCec $ ./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:  [511]     connection opened
NOTICE:  [1451]     connection opened
found a CEC adapter:
port:     /dev/ttyACM0
vendor:   0x2548
product:  0x1002
found a CEC adapter:
port:     Linux
vendor:   0x0
product:  0x0
Using CEC Adapter on port: /dev/ttyACM0
NOTICE:  [1713]     connection opened
[command received] >> 0f:87:08:00:46
NOTICE:  [2474]     setting HDMI port to 1 on device TV (0)
NOTICE:  [2888]     setting HDMI port to 1 on device TV (0)
NOTICE:  [3276]     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) Playback 1 (4) , 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
[command received] >> 01:90:01
connection opened
Enter command:scan
requesting CEC bus information ...
[command received] >> 01:9e:05
[command received] >> 01:90:01
CEC bus information
===================
device #0: TV
address:       0
active source: False
vendor:        Sony
CEC version:   1.4
OSD name:      TV
power status:  standby

device #1: Recorder 1
address:       4096
active source: False
vendor:        Pulse Eight
CEC version:   1.4
OSD name:      pyLibCec
power status:  on

device #4: Playback 1
address:       4096
active source: False
vendor:        Pulse Eight
CEC version:   1.4
OSD name:      Playback 1
power status:  on

Enter command:self
<cec.cec_logical_addresses; proxy of <Swig Object of type 'CEC::cec_logical_addresses *' at 0xb558b170> >
Addresses controlled by libCEC: Recorder 1, Playback 1
Enter command: