CEC-HDMI Control TV/Receive TV Remote controller presses

General discussion about anything related to Ultibo.
mark
Posts: 1223
Joined: Mon Oct 03, 2016 2:12 am
Location: Indianapolis, US

Re: CEC-HDMI Control TV/Receive TV Remote controller presses

Postby mark » Mon Oct 23, 2017 10:13 am

mark wrote:So, since I don't have a lab tv that works I'm going to get a new one instead of pursuing access to other tv's.
In the mean time I discovered one button on the toy remote (and as yet none on the phone app) that will send a user button press. It is a play/pause button that sends both the press and release messages on a single depression of the button. There is no distinction between pause and play.

Since I'm not ready to purchase the new tv, I'm going to experiment with what is about the simplest input signal possible. It is a lot like inserting/removing the sd card which I use to reset config.txt without resorting to windows or linux.

The toy remote has an input selection button that on the first press displays the current input name and subsequent presses indicate the next input. If pressed enough times to get back to the current input, there won't be any change. If left on a new input for a second or so, then that new input will be activated. I'll experiment with that model. Mark.
Ultibo - The Internet of Things that Just Work
mark
Posts: 1223
Joined: Mon Oct 03, 2016 2:12 am
Location: Indianapolis, US

Re: CEC-HDMI Control TV/Receive TV Remote controller presses

Postby mark » Mon Oct 30, 2017 6:58 am

I've been able to receive the play/pause button so I updated http://github.com/markfirmware/ultibo-cec

I'm now simply working in the master branch. I don't think I'll have an opportunity to do further work on this for at least a month.

Regards, Mark
pjde wrote:Hi Mark

Played around using my Panasonic TV and HDD recorder.

I could get the following workings :-

GetCECVersion, CECVersion, GetDevicePowerStatus, ReportPowerStatus, GetMenuLanguage, SetMenuLanguage, Standby, ImageViewOn.

The following issued a feature abort :-

GiveOSDName, SetOSDString

The following didn't do anything :-

ActiveSource, SetStreamPath, UserControlPressed, UserControlReleased

Don't know if this helps at all. Can post my latest test program if required.

Regards

Paul
Ultibo - The Internet of Things that Just Work
mark
Posts: 1223
Joined: Mon Oct 03, 2016 2:12 am
Location: Indianapolis, US

Re: CEC-HDMI Control TV/Receive TV Remote controller presses

Postby mark » Wed Jan 24, 2018 5:05 am

Garry, there is a cec call back from the vc4 library that is registered with

Code: Select all

Procedure vc_cec_register_callback (callback : TCECServiceCallback; Data : pointer);
cdecl;
external libvchostif name 'vc_cec_register_callback';
Can you tell me in which ultibo thread the call back will be executed? Thanks, Mark.
pjde wrote:Hi Mark

I have been looking at the CEC as well.

Attached is my very preliminary interface into the VC4 libraries.
...
Ultibo - The Internet of Things that Just Work
User avatar
Ultibo
Site Admin
Posts: 2002
Joined: Sat Dec 19, 2015 3:49 am
Location: Australia

Re: CEC-HDMI Control TV/Receive TV Remote controller presses

Postby Ultibo » Wed Jan 24, 2018 11:34 pm

mark wrote:Can you tell me in which ultibo thread the call back will be executed?

The vc_cec_register_callback() function adds the callback to the notify_fn member of the cecservice_client structure.

This notify_fn is then executed by cecservice_notify_func() which is the thread function of the 'HCEC Notify' thread.

However this thread is created by calling vcos_thread_create() and underlying that is a call to pthread_create(), nowhere is the thread name passed to the underlying OS (possibly because pThreads doesn't support it) so the name is only visible internally to the vcos functions.

In Ultibo a call to pthread_create() will create a thread with the name 'POSIX Thread', there may be multiple threads with this name depending on what other functions have been called. Within your callback you can simply call ThreadGetCurrent (or GetThreadID or GetCurrentThreadId) to find out which thread is executing.
Ultibo.org | Make something amazing
https://ultibo.org
mark
Posts: 1223
Joined: Mon Oct 03, 2016 2:12 am
Location: Indianapolis, US

Re: CEC-HDMI Control TV/Receive TV Remote controller presses

Postby mark » Fri Jan 26, 2018 3:19 am

Momentarily stalled as my sd card writer is broken. Trying to set the program_usb_boot_mode=1 so that I can get a usb flash drive to run raspbian from which I can repair my now misconfigured sd cards. Mark.
Ultibo - The Internet of Things that Just Work
mark
Posts: 1223
Joined: Mon Oct 03, 2016 2:12 am
Location: Indianapolis, US

Re: CEC-HDMI Control TV/Receive TV Remote controller presses

Postby mark » Sat Jan 27, 2018 6:11 am

mark wrote:Momentarily stalled as my sd card writer is broken. Trying to set the program_usb_boot_mode=1 so that I can get a usb flash drive to run raspbian from which I can repair my now misconfigured sd cards. Mark.

A different usb drive and I've recovered.

There are four major design factors:
  • cec standard
  • vc4 lib
  • ultibo architecture and standards
  • custom
  • none of the above
I am ignoring all of the factors except custom at this time. My only requirement is to receive button presses and it works. So I've updated https://github.com/markfirmware/ultibo-cec with a branch called simplebuttonpresses that will log to the screen any user control buttons that are pressed (and also released.)
Ultibo - The Internet of Things that Just Work
Gavinmc42
Posts: 1387
Joined: Sun Jun 05, 2016 12:38 pm
Location: Brisbane, Australia

Re: CEC-HDMI Control TV/Receive TV Remote controller presses

Postby Gavinmc42 » Thu May 17, 2018 7:44 am

Found this in the boot config.txt of Fedora28 for Pi3 Aarch64.
Not sure if it means anything for CEC under Ultibo.

# Allow OS rather than firmware control CEC
mask_gpu_interrupt1=0x100
User avatar
Ultibo
Site Admin
Posts: 2002
Joined: Sat Dec 19, 2015 3:49 am
Location: Australia

Re: CEC-HDMI Control TV/Receive TV Remote controller presses

Postby Ultibo » Thu May 17, 2018 7:57 am

Gavinmc42 wrote:
# Allow OS rather than firmware control CEC
mask_gpu_interrupt1=0x100

As far as I know that is related to allowing the Eric Anholt kernel drivers to perform functions like CEC instead of the firmware, since we don't have those drivers then it would probably stop CEC from working in Ultibo.
Ultibo.org | Make something amazing
https://ultibo.org

Return to “Discussion”

Who is online

Users browsing this forum: No registered users and 3 guests