Skip to content
Permalink
Browse files
[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 c7fe1a2685a88383d0a69df5358ac42650d5f327
Showing with 10 additions and 0 deletions.
  1. +10 −0 src/usb_moded-modesetting.c
@@ -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)
{

0 comments on commit c7fe1a2

Please sign in to comment.