Today I have finally figured out that I was over thinking the problem with
reading the HDMI status. I was thinking I was going to have to do some
fancy I2C code rather than ,as I have now learned, let the driver do the
work.
For those who are new to the BBB like myself here is a quick tip for HDMI.
There are two pieces of information that interested me the most they being
when a display was connected and disconnected and the maximum resolution
for that display. So based on a tip from another thread I found two files
under Ubuntu 12.04.3 LTS ubuntu-armhf :
/sys/class/drm/card0-HDMI-A-1/status
/sys/class/drm/card0-HDMI-A-1/modes
The status file stores a simple "connected" or "disconnected". Currently I
am polling the file once every couple of seconds as I have not figured out
the interrupt yet.
The modes file stores all of the possible resolution combinations in a file
delimited by '\n' highest resolutions first or nothing at all if there is
no screen connected.
Just a little c++ snippet of determining current status:
#define HDMI_CONNECT_DISCONNECT "/sys/class/drm/card0-HDMI-A-1/status"
FILE *pHDMIConnectionStatus = fopen(HDMI_CONNECT_DISCONNECT, "r");
if (pHDMIConnectionStatus == NULL)
{
sprintf(szErrorMsg,"Error could not open %s\n", HDMI_CONNECT_DISCONNECT);
perror(szErrorMsg);
}
else
{
if(fgets(szHDMIStatus, 15, pHDMIConnectionStatus) != NULL)
{
if (strcmp(szHDMIStatus, "connected\n") == 0)
{
//HDMI connected
bHDMIConnected = true;
}
else
{
//HDMI disconnected
bHDMIConnected = false;
}
}
printf("HDMI Display Connected: %s\n", bHDMIConnected?"YES":"NO");
fclose(pHDMIConnectionStatus);
Enjoy!
--
Dan Metcalf -- KB3UUN
--
For more options, visit http://beagleboard.org/discuss
---
You received this message because you are subscribed to the Google Groups
"BeagleBoard" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.