Skip to content

Commit

Permalink
i2c_checK_open_bus_alive(): do not use /sys to check if display still…
Browse files Browse the repository at this point in the history
… connected

apparently unreliable, at least w driver vfd on Raspberry Pi

may address issue #413

also:
- iftest out unused i2c_check_edid_exists_by_businfo()
- documentation
  • Loading branch information
rockowitz committed May 8, 2024
1 parent f4a6d7c commit 3787e40
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion src/i2c/i2c_bus_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -464,9 +464,17 @@ i2c_check_edid_exists_by_dh(Display_Handle * dh) {
}


#ifdef UNUSED
/** Attempts to read the EDID on the I2C bus specified in
* a #Businfo record.
*
* @param businfo
* @return true if the EDID can be read, false if not
*/
bool i2c_check_edid_exists_by_businfo(I2C_Bus_Info * businfo) {
bool debug = false;
DBGTRC_STARTING(debug, DDCA_TRC_NONE, "busno = %d", businfo->busno);

bool result = false;
int fd = -1;
Error_Info * erec = i2c_open_bus(businfo->busno, CALLOPT_ERR_MSG, &fd);
Expand All @@ -481,9 +489,11 @@ bool i2c_check_edid_exists_by_businfo(I2C_Bus_Info * businfo) {
}
else
ERRINFO_FREE(erec);

DBGTRC_RET_BOOL(debug, DDCA_TRC_NONE, result, "");
return result;
}
#endif


#ifdef OUT
Expand Down Expand Up @@ -512,7 +522,7 @@ Error_Info * i2c_check_bus_responsive_using_drm(const char * drm_connector_name)
#endif


/**
/** Tests if an open display handle is still
*
* @param dh display handle
* @retval NULL ok
Expand All @@ -534,6 +544,7 @@ Error_Info * i2c_check_open_bus_alive(Display_Handle * dh) {

Error_Info * result = NULL;
bool edid_exists = false;
#ifdef SYSFS_PROBLEMATIC // apparently not by driver vfd on Raspberry pi
if (businfo->drm_connector_name) {
edid_exists = GET_ATTR_EDID(NULL, "/sys/class/drm/", businfo->drm_connector_name, "edid");
// edid_exists = i2c_check_bus_responsive_using_drm(businfo->drm_connector_name); // fails for Nvidia
Expand All @@ -542,6 +553,10 @@ Error_Info * i2c_check_open_bus_alive(Display_Handle * dh) {
// read edid
edid_exists = i2c_check_edid_exists_by_dh(dh);
}
#else
edid_exists = i2c_check_edid_exists_by_dh(dh);
#endif

if (!edid_exists) {
result = ERRINFO_NEW(DDCRC_DISCONNECTED,
"/dev/i2c-%d", dh->dref->io_path.path.i2c_busno);
Expand Down

0 comments on commit 3787e40

Please sign in to comment.