Add support for libcec based control #187

Closed
adamcik opened this Issue Sep 9, 2012 · 13 comments

Comments

Projects
None yet
5 participants
Owner

adamcik commented Sep 9, 2012

Using libcec we could control devices and/or be controlled via HDMI CEC. See http://www.pulse-eight.com/store/products/104-usb-hdmi-cec-adapter.aspx

Owner

adamcik commented Apr 29, 2013

This would also allow for input switching, volume control and finally note that the raspi ha built in support for cec :-)

Owner

adamcik commented May 6, 2013

Since the raspi has builtin cec support this would be great for pimusicbox etc. Must have features:

  • Turning devices on
  • Switching to correct input

Nice to have:

  • cecmixer that controls the reciever volume (ideally also having it be notified of volume changes, and maybe a max allowed volume).

For figuring out how to send controls I would recommend http://www.cec-o-matic.com/ While making libcec usable in Python could be done with cffi. Things like figuring out the right remote address to send to should probably be left to libcec or otherwise left out of scope.

adamcik referenced this issue in pimusicbox/pimusicbox May 6, 2013

Open

CEC support in musicbox #17

Owner

adamcik commented May 9, 2013

Playing a bit with this it turns out that raspbian does not ship with a working libcec for raspi. Other gotcha for cffi is that libcec in wheezy has a broken cecc.h file. So after messing around and finally building a working libcec from git, I ran into not having access to the video device. So after adding myself to the video group I've successfully switched sources, queried, changed and muted volume via the predefined commands in cec-client and some custom ones. Passing the git version through cpp -nostdinc cecc.h does give a ffi.cdef friendly file at least, but the C interface feels a bit clunky so far.

Looking at the current state of this it might very well be the case that one is better of writing a c++ or c wrapper that is geared solely at exposing the features we need and easier to wrap in python.

Other thing to note is that one should keep in mind that libcec is GPL licensed when actually making this extension. And just in case someone else looks at this, plan is not to make this part of mopidy itself, but create a Mopidy-CEC extension, and as of the time of writing I'm working on this any further. So feel free to jump in and help us make this happen :-)

Member

kingosticks commented May 9, 2013

Sorry, just to be clear, you are still working on this further? (The last sentence sounds like you aren't)

Owner

adamcik commented May 9, 2013

I want this to happen, but I feel I've spent enough time on it this time around, so it's put on hold until some later time or until some else jumps on it :-)

Owner

adamcik commented Oct 4, 2013

This is no longer being worked on, of course anyone is welcome to bring this effort back to life as an extension.

adamcik closed this Oct 4, 2013

I'm writing a python module for libCEC which might be helpful: https://github.com/trainman419/python-cec

Contributor

ZenithDK commented Nov 10, 2013

That's pretty neat - I guess we can add a TV as an output and then toggling it on and off will power on and off the TV?
And control the TV/AV receiver volume directly?

Member

kingosticks commented Nov 10, 2013

And also pause/play/skip maybe? I currently use the xbmc mpc plugin to
achieve this functionality indirectly but this would be neater. Not sure if
could work alongside xbmc or something else that's listening for cec
commands on the same hdmi, you'd somehow how to select between devices.
On Nov 10, 2013 8:30 PM, "Lasse Bigum" notifications@github.com wrote:

That's pretty neat - I guess we can add a TV as an output and then
toggling it on and off will power on and off the TV?
And control the TV/AV receiver volume directly?


Reply to this email directly or view it on GitHubhttps://github.com/mopidy/mopidy/issues/187#issuecomment-28159700
.

Owner

adamcik commented Nov 10, 2013

Only one one program may access it at a time as far as I know. As such having a cecd or something else that provides other programs access would be nice.

Member

kingosticks commented Jun 7, 2014

Pulse Eight claimed to be working on a client-server model but that was 2 years ago and they appear to have lost interest. There is the libcec-daemon project which looks interesting but it doesn't solve my desire to have virtual devices on the same HDMI and select between them. I doubt the CEC protocol supports it, so you'd have to sacrifice XBMC control to get this feature. So better off just using the XBMC MPD plugin.

But I did had a play with @trainman419's python-cec project which was very simple to get working (he provides a newer libcec package) and receive key presses from. It should support your two must-have features although I didn't try.

Is this still being worked on? XBMC also uses the Pulse Eight library, and that works well with HDMI CEC.

Member

kingosticks commented Nov 25, 2016 edited

Nobody is currently working on this AFAIK but anyone is welcome to pick this up and create an extension.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment