Jump to content


Photo

HDMI-CEC driver & device


  • Please log in to reply
131 replies to this topic

#1 bacicciosat

  • Senior Member
  • 540 posts

+100
Excellent

Posted 10 August 2011 - 16:07

@pieterg

I have seen your commits about.
What tests have you made and what works in your experience ?

I wrote a little driver and input device model for e2
I can successfully communicate with Samsung Anynet+ system.
I can set the device name in Tv osd and i can use the passthrough remote control function.
I wrote a little function to translate Hdmi-cec rc codes in enigma2 key events so i can control the box from the tv remote control.

But all this game works only with Anynet+ recent tv
and i have to set the physical address manually.

Some users have report it working on a pair of Sony bravia models too. But in my tests on my Bravia KDL S325600 it accept all commands but reject the 0x8E request so i cannot have tv remote control events.

Re: HDMI-CEC driver & device #2 pieterg

  • PLi® Core member
  • 32,766 posts

+245
Excellent

Posted 10 August 2011 - 16:18

I have written the e2 component (in our e2 repository), and tested it with a few lines of python code (not in any repository).

I can swich on and off my Panasonic plasma, haven't tried more fancy commands. Tried input selection, but the TV does seem to ignore them.
It seems different brands are implementing different commands, only the most basic (such as power on/off) seem to be standard.

I know that Sjaaky has written some experimental code to communicate with his AV receiver (remote control events), but I do not know the current status.

So I think the device is usable, we just have to find nice applications for it, and write a nice plugin around it ;)

Re: HDMI-CEC driver & device #3 bacicciosat

  • Senior Member
  • 540 posts

+100
Excellent

Posted 10 August 2011 - 16:54

Yes i have seen non-standard opcodes sent by my Bravia.
But my Samsung with Anynet+ is fully compatible with all Hdmi-Cec standard codes and it works fine.
I have not a Panasonic to make tests so i cannot try it. I have seen a debug report of a Panasonic and it seems to me promising.
Maybe some kind of tricky can be performed, like for example to pass to tv the same vendor id.
P.s. The standby function seems to work with all models but the wakeup not.

Re: HDMI-CEC driver & device #4 Dimitrij

  • PLi® Core member
  • 10,323 posts

+350
Excellent

Posted 10 August 2011 - 18:19

I have a Samsung 40A457C1DXBT with Anynet +.
Can it get on / off automatically, depending on the tuner ET9000?
If there are plugins?

Re: HDMI-CEC driver & device #5 Sjaaky

  • Senior Member
  • 7,443 posts

+41
Good

Posted 11 August 2011 - 10:45

@bacicciosat, sounds good! Currently I control the volume of my av receiver with the et9000 remote through hdmi-cec. The power button is supposed to turn on and turn off the av receiver and television as well as the et9000. But 'turn on' doesn't work 90% of the time on my sony bravia, the television 'crashes' and it takes more than a minute before the television responds to any input. Turn off does work though.

So all in all my girlfriend is happy, because she only has to use 1 rc. But the solution is tailored to just my needs. A lot more development is be needed to turn it into an generally useful plugin.

btw, do you know this site: http://www.cec-o-matic.com/ ? It is very very helpful.

Re: HDMI-CEC driver & device #6 bacicciosat

  • Senior Member
  • 540 posts

+100
Excellent

Posted 11 August 2011 - 10:57

btw, do you know this site: http://www.cec-o-matic.com/ ? It is very very helpful.



Yes i know this site, and i spent many hours with pdf of hdmi-cec specs.
I have a good result and i can now control both my television and my Vu+ box with only one remote control (tv remote control).
Here is the buttons map i have done and integrated in bh image:

I will prepare a git with the driver i have wrote so you can check it

Attached Files

  • Attached File  rc_5.png   425.41KB   185 downloads


Re: HDMI-CEC driver & device #7 bacicciosat

  • Senior Member
  • 540 posts

+100
Excellent

Posted 11 August 2011 - 13:36

The driver used both the classes: eRCDriver and eRCDevice
The eRCDevice class is needed to produce e2 key events when we receive a hdmi-cec message button/press/release : (0x44 0x45)

The driver manage automatically the reply to standard Hdmi-Cec opcodes:
0x46, 0x8f, 0x83, 0x85, 0x86, 0x8d
This is enough in Anynet+ Samsung tv to estabilish a full communication with the tv:
(report address, set active source, set OSD name, set menu status (0x8e)
This last opcode is the most important. If it is accepted by Tv you will have the remote control tv passthrough activated. In this case you will receive a button pres/release command (0x44, 0x45) every time a button is pressed on the tv remote control.
The parameter of the opcode is the key-id pressed.
The driver have a little function to remap the keyid sent by Hdmi-Cec in e2 keyd events.
This allow the box to be controlled from the Tv remote control.

The driver is here: http://sourceforge.n...penstb/hdmi-cec

Re: HDMI-CEC driver & device #8 Sjaaky

  • Senior Member
  • 7,443 posts

+41
Good

Posted 11 August 2011 - 13:48

Cool, thank you.

I bet the reason my sony tv stops responding is because I don't respond properly to all cec request.

Re: HDMI-CEC driver & device #9 bacicciosat

  • Senior Member
  • 540 posts

+100
Excellent

Posted 11 August 2011 - 14:02

Cool, thank you.

I bet the reason my sony tv stops responding is because I don't respond properly to all cec request.


I have reports that this driver works with Sony Bravia KDL40EX402
But i am sure it don't works on Bravia KDL 5600 series that seems to use a non-standard Hdmi-Cec codes.
So i don't know if it can work with your tv.

Re: HDMI-CEC driver & device #10 hemertje

  • Forum Moderator
    PLi® Core member
  • 33,503 posts

+118
Excellent

Posted 11 August 2011 - 15:50

nice development bacicciosat, thx for sharing!

on the Glassfibre 1GB DVB-C...


Re: HDMI-CEC driver & device #11 bacicciosat

  • Senior Member
  • 540 posts

+100
Excellent

Posted 11 August 2011 - 16:25

nice development bacicciosat, thx for sharing!


Thx to PLI team for all the precious work you make for all sat community.
All my sources will be always available for PLI team.
We all have to thank Pli team for your Open Source style and approach.

Re: HDMI-CEC driver & device #12 VU+NL

  • Senior Member
  • 6,424 posts

+12
Neutral

Posted 11 August 2011 - 18:58

Thx to PLI team for all the precious work you make for all sat community.
All my sources will be always available for PLI team.
We all have to thank Pli team for your Open Source style and approach.

Hear, hear /images/smiley/more/023.gif
VU+ DUO/UNO/Digiality 85cm multifocus-4 X twin-Inverto-LNB's/Triax 88 USALS/Logitech Harmony 300, 555, 600, 900 en 1100

Re: HDMI-CEC driver & device #13 pieterg

  • PLi® Core member
  • 32,766 posts

+245
Excellent

Posted 11 August 2011 - 21:23

btw, you have a 'small' memory leak ;)

__u8 *buf = new __u8[256];

Re: HDMI-CEC driver & device #14 bacicciosat

  • Senior Member
  • 540 posts

+100
Excellent

Posted 11 August 2011 - 22:13

btw, you have a 'small' memory leak ;)

__u8 *buf = new __u8[256];



Eh eh, now you have to commit the fix.
/images/smiley/smile.gif

Re: HDMI-CEC driver & device #15 pieterg

  • PLi® Core member
  • 32,766 posts

+245
Excellent

Posted 13 August 2011 - 21:18

I merged your remotecontroll stuff to our repository (hope you don't mind) so I could do some debugging with my panasonic.
Unfortunately, I cannot get it to respond to anything except the standby/wakeup commands which were already working.

I've added a few additional commands, and replied to them, even reported to be 'panasonic', but that still doesn't seem to make the 'TP link' option happy.
Also, no remotecontrol passthrough.
How did you get your TV to enable the passthrough? Some menu option? Or does it do so automatically when it detects an active source?

Anyway, I've finally added a simple hdmicec setup plugin, so people can configure standby/wakeup or active/inactive (or disable the whole thing if they wish)

Re: HDMI-CEC driver & device #16 bacicciosat

  • Senior Member
  • 540 posts

+100
Excellent

Posted 13 August 2011 - 23:43

I merged your remotecontroll stuff to our repository (hope you don't mind) so I could do some debugging with my panasonic.


Very good, maybe we can make progresses.
The repository is there to work togheter you are admin too of the project and all is shared.

Unfortunately, I cannot get it to respond to anything except the standby/wakeup commands which were already working.


This is not normal. You television have to reply in any case to commands.
If it doesn't reply it is because it expects different replyes or is because you are not sending data in correct format. At the beginning i had the same problem so i asked a trick to Vu devel and they replyed to me to use __u8 type to send data.
For this reason i suggest to you to test with exactly the driver i have posted, because it is the only way that i have success. I have tested your struct cec message but it seems to me to remember that it doesn't worked so i have introduced use the __u8 type.
The reason because the command 0x36 works always is that it have not parameters i suppose.
I have a report of one of my team member of the driver on Panasonic. The passthrough command seems to be not accepted but it seems to understand the commands.
So i suppose that you should have something similar with your tv.
[BlackHole-HDMICEC] received from 00 command: 46 7f 00 00
[BlackHole-HDMICEC] message sent to 00: 47 42 6c 61
[BlackHole-HDMICEC] received from 00 command: 00 47 00 00
As you can see the Panasonic in this case send command 0x46 (asking the preferred OSD name for the box) and after we send our name with 0x47 command it denied our requests with this command:
received from 00 command: 00 47 00 00
command 0x00 means that our command is rejected and the first parameter is the opcode of the command reject (0x47). Usually it have to explain the cause too in the followers parameters but in this case we have not any cause: 00 00

So the Tv don't ignore our commands but it accept or not. I suggest to use __u8 type to make tests.

I've added a few additional commands, and replied to them, even reported to be 'panasonic', but that still doesn't seem to make the 'TP link' option happy.
Also, no remotecontrol passthrough.
How did you get your TV to enable the passthrough? Some menu option? Or does it do so automatically when it detects an active source?


Usually when you send active source tv ask the preferred osd name and then the menu state.
When you reply to the menu state request with the parameter "0" it means that you want that the tv remote passthrough is activated.

Unfortunately i am in vacation at my seaside home now and i haven't here a Samsung tv with Anynet+ to produce a debug to show to you.

But i have a part of the debug of a Sony Bravia working
[BlackHole-HDMICEC] received from 00 command: 83 7f 00 00
[BlackHole-HDMICEC] message sent to 0f: 84 20 00 01
[BlackHole-HDMICEC] received from 00 command: 46 7f 00 00
[BlackHole-HDMICEC] message sent to 00: 47 42 6c 61
[BlackHole-HDMICEC] received from 00 command: 8c 7f 00 00

Anyway, I've finally added a simple hdmicec setup plugin, so people can configure standby/wakeup or active/inactive (or disable the whole thing if they wish)


I have integrated in the image settings the config of Hdmi-cec and i send a kind of inizialization sequence to the tv where the settings are saved.
Something like:
def saveMyHdmiSettings(self):
	   
	   config.hdmicec.tvstandby.save()
	   config.hdmicec.tvwakeup.save()
	   config.hdmicec.boxstandby.save()
	   config.hdmicec.on.save()
	   config.hdmicec.port.save()	   
	   configfile.save()
			 
	   self.bhHdmiInit()
	   
    def bhHdmiInit(self):
	   from enigma import eHdmiCEC
	   eHdmiCEC.getInstance().sendMessage(0x0F, 0x82)
	   eHdmiCEC.getInstance().sendMessage(0, 0x8E)
	   self.session.openWithCallback(self.bhClose, MessageBox, "Hdmi-Cec inizialized.\nYou can now try to use your tv rc to control your Vu+ Box.", MessageBox.TYPE_INFO)

Let me know if there will be progressess.

Re: HDMI-CEC driver & device #17 pieterg

  • PLi® Core member
  • 32,766 posts

+245
Excellent

Posted 14 August 2011 - 00:54

I'm not too sure about the __u8, that's just another typedef to an unsigned char.
Quite sure the message structure is correct, the tv is clearly accepting the commands I'm sending.
(when I omit the active source reply, which has more than one byte data, the tv does not switch to the correct hdmi input. so that command is working)

Panasonic seems to be using vendor specific commands (starting with a0), so the only chance would probably be to capture communication with a working device, and emulate that.

vendor specific command:

eHdmiCEC: received message A0 00 80 45 20 00 00

then there's the vendor id exchange (notice I fake panasonic):

eHdmiCEC: received message 8C
eHdmiCEC: send message 87 00 80 45

and then silence.

So no menu queries.

Only a streaming path request (86), and an address change (80) from 0.0.0.0 to 1.0.0.0 when the tv is switched on.


Re: HDMI-CEC driver & device #18 bacicciosat

  • Senior Member
  • 540 posts

+100
Excellent

Posted 14 August 2011 - 07:30

Ok so you need someone with a recent Samsung tv that test your code and report the debug messages of Hdmi-Cec commands.
I think a bravia too should work at least in set the preferred OSD name.
Here are the Samsung and Sony tv menu after the command:
case 0x47:
    buf[1] = 11;
    memcpy(buf+3, "BlackHole", 10);

Attached Files

  • Attached File  bh.jpg   274.6KB   118 downloads
  • Attached File  bravia.jpg   7.42KB   107 downloads


Re: HDMI-CEC driver & device #19 bacicciosat

  • Senior Member
  • 540 posts

+100
Excellent

Posted 14 August 2011 - 08:31

P.s. pieterg i think we need to use the same code to understand what work and what not.
I can compile an image for my team with your driver so it can be tested from my staff with Bravia and Samsung and we can have reports if the drivers work or not.
So please push your drivers in openstb repository and we will work on the code posted there.
We can use it for test purposes to be sure to have the same code.
We have to consider too that my tests are made on Vu+. I don't know if you are testing driver on Vu or Et.
Maybe there is something different between the way in wich Vu and Et manage hdmi-cec

Re: HDMI-CEC driver & device #20 bacicciosat

  • Senior Member
  • 540 posts

+100
Excellent

Posted 14 August 2011 - 10:40

I'm not too sure about the __u8, that's just another typedef to an unsigned char.
Quite sure the message structure is correct, the tv is clearly accepting the commands I'm sending.


You are right pieterg your code is brilliant and you don't need to use u8
I have compiled an image with your driver and tested on my vu uno with a Sony Bravia
The code work fine and the set name function too. We have in television menu the name we have set: linux stb.
Here is the debug of your driver with my Bravia.

eHdmiCEC: received message
eHdmiCEC: received message 83
eHdmiCEC: send message 84 57 6B
eHdmiCEC: received message 46
eHdmiCEC: send message 47 6C 69 6E 75 78 20 73 74 62 00

I have modifyed the code too to test the menuon function and to be sure to send the setactive state.
It is a little trick only for test:
if (message.length)
		  {
			 sendMessage(message.address, message.length, message.data);
		  }
		  if (message.data[0] == 0x47)
		  {
			 sleep(1);
			 message.data[0] = 0x82; /* report active / inactive */
			 getPhysicalAddress(&message.data[1]);
			 message.length = 3;
			 sendMessage(0x0f, message.length, message.data);
			 sleep(1);
			 message.data[0] = 0x8e; /* menu status */
			 message.data[1] = 0; /* menu activated */
			 message.length = 2;
			 sendMessage(0, message.length, message.data);
		  }

With this addition i had this debug:
eHdmiCEC: received message 46
eHdmiCEC: send message 47 6C 69 6E 75 78 20 73 74 62 00
eHdmiCEC: send message 82 ED 8E
eHdmiCEC: send message 8E 00
ERROR reading PES (fd=40) - ERROR reading PES (fd=40) - Value too large for defined data type
eHdmiCEC: received message 00 8E 00

Maybe the abort message sent by tv: 00 8E 00 contains the reason of the reject of menu active command that cause that the passtrough remote control is not activated, but we have to change code to read the debug messages because we have the error: Value too large for defined data type. Maybe it contains an ascii string ?

By the way it sould work on Samsung systems.
Here is the shot of your driver working on my Bravia for set osd name command

Attached Files




8 user(s) are reading this topic

0 members, 8 guests, 0 anonymous users