Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[modesetting] Do not use "none" as usb function
Use of "none" string as no-usb-function place holder causes journal spamming
as kernels are likely to return EINVAL error when it is actually used.

Substitute "none" with empty string when written to usb function control
file.

Signed-off-by: Simo Piiroinen <simo.piiroinen@jollamobile.com>
  • Loading branch information
spiiroin committed Apr 26, 2017
1 parent 29ac408 commit c7fe1a2
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/usb_moded-modesetting.c
Expand Up @@ -116,6 +116,16 @@ int write_to_file(const char *path, const char *text)
if(!text || !path)
return err;

/* There is usb-moded code and configuration files that use
* "none" as a place-holder for no-function. Attempting to
* write that into sysfs leads to journal spamming due to
* EINVAL error return. Substituting "none" with an empty
* string avoids that. */
if( !strcmp(path, "/sys/class/android_usb/android0/functions") &&
!strcmp(text, "none") ) {
text = "";
}

#if LOG_ENABLE_DEBUG
if(log_level >= LOG_DEBUG)
{
Expand Down

0 comments on commit c7fe1a2

Please sign in to comment.