Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[dyn-config] Drop unused softconnect keys
The "softconnect" attributes were used to configure android usb specific
enable/disable sysfs controls. These attributes are no longer used, and
at least in theory the same config files can be used for both android
usb and configfs based systems.

Remove unused attributes.

Signed-off-by: Simo Piiroinen <simo.piiroinen@jollamobile.com>
  • Loading branch information
spiiroin committed Aug 24, 2018
1 parent 6435068 commit b1c56eb
Show file tree
Hide file tree
Showing 16 changed files with 8 additions and 65 deletions.
3 changes: 0 additions & 3 deletions config/diag/qa_diagnostic_mode.ini
Expand Up @@ -8,9 +8,6 @@ network = 0
sysfs_path = /sys/class/android_usb/android0/functions
sysfs_value = adb,diag
sysfs_reset_value = none
softconnect_path = /sys/class/android_usb/android0/enable
softconnect = 1
softconnect_disconnect = 0
android_extra_sysfs_path = /sys/class/android_usb/android0/f_diag/clients
android_extra_sysfs_value = diag
idProduct = 0A05
3 changes: 0 additions & 3 deletions config/dyn-modes/adb_mode.ini
Expand Up @@ -11,8 +11,5 @@ sysfs_value = rndis,adb
android_extra_sysfs_path = /sys/class/android_usb/android0/f_ffs/aliases
android_extra_sysfs_value = adb
sysfs_reset_value = none
softconnect_path = /sys/class/android_usb/android0/enable
softconnect = 1
softconnect_disconnect = 0
idProduct = 0A03
dhcp_server = 1
3 changes: 0 additions & 3 deletions config/dyn-modes/android_acm.ini
Expand Up @@ -6,8 +6,5 @@ module = none
sysfs_path = /sys/class/android_usb/android0/functions
sysfs_value = acm
sysfs_reset_value = none
softconnect_path = /sys/class/android_usb/android0/enable
softconnect = 1
softconnect_disconnect = 0
android_extra_sysfs_path = /sys/class/android_usb/android/f_acm/acm_transports
android_extra_sysfs_value = tty
3 changes: 0 additions & 3 deletions config/dyn-modes/android_at.ini
Expand Up @@ -6,8 +6,5 @@ module = none
sysfs_path = /sys/class/android_usb/android0/functions
sysfs_value = serial
sysfs_reset_value = none
softconnect_path = /sys/class/android_usb/android0/enable
softconnect = 1
softconnect_disconnect = 0
android_extra_sysfs_path = /sys/class/android_usb/android0/f_serial/transports
android_extra_sysfs_value = smd,tty
3 changes: 0 additions & 3 deletions config/dyn-modes/connection_sharing-android-connman.ini
Expand Up @@ -6,8 +6,5 @@ module = none
sysfs_path = /sys/class/android_usb/android0/functions
sysfs_value = rndis
sysfs_reset_value = none
softconnect_path = /sys/class/android_usb/android0/enable
softconnect = 1
softconnect_disconnect = 0
idProduct = 0A02
connman_tethering = /net/connman/technology/gadget
3 changes: 0 additions & 3 deletions config/dyn-modes/connection_sharing.ini
Expand Up @@ -9,8 +9,5 @@ appsync = 1
sysfs_path = /sys/class/android_usb/android0/functions
sysfs_value = rndis
sysfs_reset_value = none
softconnect_path = /sys/class/android_usb/android0/enable
softconnect = 1
softconnect_disconnect = 0
idProduct = 0A02
nat = 1
3 changes: 0 additions & 3 deletions config/dyn-modes/developer_mode-android.ini
Expand Up @@ -9,8 +9,5 @@ appsync = 1
sysfs_path = /sys/class/android_usb/android0/functions
sysfs_value = rndis
sysfs_reset_value = none
softconnect_path = /sys/class/android_usb/android0/enable
softconnect = 1
softconnect_disconnect = 0
idProduct = 0A02
dhcp_server = 1
3 changes: 0 additions & 3 deletions config/dyn-modes/diag_mode.ini
Expand Up @@ -9,9 +9,6 @@ network_interface = rndis0
sysfs_path = /sys/class/android_usb/android0/functions
sysfs_value = diag,serial,rmnet,qdss,adb,rndis
sysfs_reset_value = none
softconnect_path = /sys/class/android_usb/android0/enable
softconnect = 1
softconnect_disconnect = 0
android_extra_sysfs_path = /sys/class/android_usb/android0/f_diag/clients
android_extra_sysfs_value = diag
android_extra_sysfs_path2 = /sys/class/android_usb/android0/f_serial/transports
Expand Down
3 changes: 0 additions & 3 deletions config/dyn-modes/diag_mode_old.ini
Expand Up @@ -9,9 +9,6 @@ network_interface = rndis0
sysfs_path = /sys/class/android_usb/android0/functions
sysfs_value = rndis,adb,diag,serial
sysfs_reset_value = none
softconnect_path = /sys/class/android_usb/android0/enable
softconnect = 1
softconnect_disconnect = 0
android_extra_sysfs_path = /sys/class/android_usb/android0/f_diag/clients
android_extra_sysfs_value = diag
android_extra_sysfs_path2 = /sys/class/android_usb/android0/f_serial/transports
Expand Down
3 changes: 0 additions & 3 deletions config/dyn-modes/mtp_mode-android-ffs.ini
Expand Up @@ -6,7 +6,4 @@ module = none
sysfs_path = /sys/class/android_usb/android0/functions
sysfs_value = ffs
sysfs_reset_value = none
softconnect_path = /sys/class/android_usb/android0/enable
softconnect = 1
softconnect_disconnect = 0
idProduct = 0A07
3 changes: 0 additions & 3 deletions config/dyn-modes/mtp_mode-android.ini
Expand Up @@ -6,6 +6,3 @@ module = none
sysfs_path = /sys/class/android_usb/android0/functions
sysfs_value = mtp
sysfs_reset_value = none
softconnect_path = /sys/class/android_usb/android0/enable
softconnect = 1
softconnect_disconnect = 0
3 changes: 0 additions & 3 deletions config/dyn-modes/pc_suite-android.ini
Expand Up @@ -6,7 +6,4 @@ module = none
sysfs_path = /sys/class/android_usb/android0/functions
sysfs_value = ffs
sysfs_reset_value = none
softconnect_path = /sys/class/android_usb/android0/enable
softconnect = 1
softconnect_disconnect = 0
idProduct = 0A07
3 changes: 0 additions & 3 deletions config/dyn-modes/vfat_android.ini
Expand Up @@ -7,7 +7,4 @@ appsync = 1
sysfs_path = /sys/class/android_usb/android0/functions
sysfs_value = mass_storage
sysfs_reset_value = none
softconnect_path = /sys/class/android_usb/android0/enable
softconnect = 1
softconnec_disconnect = 0
idProduct = 55AA
9 changes: 1 addition & 8 deletions docs/usb_moded-doc.txt
Expand Up @@ -237,8 +237,7 @@ Those files will be read on start and usb_moded will keep a list of apps to laun
for a certain mode. This also means that if you change the files or add/remove some
you need to restart usb_moded. Later when the mode is activated, usb_moded will start
each of them after the module has been loaded and keep track if they have been started.
It will warn you if that failed. This works together with an optional softconnect option
that will need kernel support.
It will warn you if that failed.

These services will start before the whole setup for the usb is done. In case the application
only works after everything has been set up, you can start the application at the end by adding
Expand All @@ -264,9 +263,6 @@ network_interface = usb0
sysfs_path = /* in case you need to echo parameters somewhere in a sysfs path */
sysfs_value = /* the values */
sysfs_reset_value = /* in case a reset value needs to be written */
softconnect_path = /* a path in case the module needs activation with a softconnect option */
softconnect = /* value to be written to enable */
softconnect_disconnect = /* value to be written for disable */

Only the mode name and module are mandatory. In case you do not use modules, use none as the value
for module (as for the android gadget for example. See the android section for more info)
Expand Down Expand Up @@ -330,9 +326,6 @@ network_interface = rndis0
sysfs_path = /sys/class/android_usb/android0/functions
sysfs_value = rndis
sysfs_reset_value = none
softconnect_path = /sys/class/android_usb/android0/enable
softconnect = 1
softconnec_disconnect = 0
idProduct = 0002


Expand Down
12 changes: 0 additions & 12 deletions src/usb_moded-dyn-config.c
Expand Up @@ -61,9 +61,6 @@ void dynconfig_free_list_item(mode_list_elem *list_item)
free(list_item->sysfs_path);
free(list_item->sysfs_value);
free(list_item->sysfs_reset_value);
free(list_item->softconnect);
free(list_item->softconnect_disconnect);
free(list_item->softconnect_path);
free(list_item->android_extra_sysfs_path);
free(list_item->android_extra_sysfs_value);
free(list_item->android_extra_sysfs_path2);
Expand Down Expand Up @@ -160,9 +157,6 @@ static struct mode_list_elem *dynconfig_read_mode_file(const gchar *filename)
list_item->sysfs_value = g_key_file_get_string(settingsfile, MODE_OPTIONS_ENTRY, MODE_SYSFS_VALUE, NULL);
//log_debug("Dynamic mode sysfs value = %s\n", list_item->sysfs_value);
list_item->sysfs_reset_value = g_key_file_get_string(settingsfile, MODE_OPTIONS_ENTRY, MODE_SYSFS_RESET_VALUE, NULL);
list_item->softconnect = g_key_file_get_string(settingsfile, MODE_OPTIONS_ENTRY, MODE_SOFTCONNECT, NULL);
list_item->softconnect_disconnect = g_key_file_get_string(settingsfile, MODE_OPTIONS_ENTRY, MODE_SOFTCONNECT_DISCONNECT, NULL);
list_item->softconnect_path = g_key_file_get_string(settingsfile, MODE_OPTIONS_ENTRY, MODE_SOFTCONNECT_PATH, NULL);
list_item->android_extra_sysfs_path = g_key_file_get_string(settingsfile, MODE_OPTIONS_ENTRY, MODE_ANDROID_EXTRA_SYSFS_PATH, NULL);
list_item->android_extra_sysfs_path2 = g_key_file_get_string(settingsfile, MODE_OPTIONS_ENTRY, MODE_ANDROID_EXTRA_SYSFS_PATH2, NULL);
list_item->android_extra_sysfs_path3 = g_key_file_get_string(settingsfile, MODE_OPTIONS_ENTRY, MODE_ANDROID_EXTRA_SYSFS_PATH3, NULL);
Expand Down Expand Up @@ -200,11 +194,5 @@ static struct mode_list_elem *dynconfig_read_mode_file(const gchar *filename)
dynconfig_free_list_item(list_item);
return NULL;
}
if(list_item->softconnect && list_item->softconnect_path == NULL)
{
/* free list_item as it will not be used */
dynconfig_free_list_item(list_item);
return NULL;
}
return(list_item);
}
13 changes: 7 additions & 6 deletions src/usb_moded-dyn-config.h
Expand Up @@ -46,27 +46,31 @@
# define MODE_NETWORK_INTERFACE_KEY "network_interface"
# define MODE_OPTIONS_ENTRY "options"
# define MODE_SYSFS_PATH "sysfs_path"

/* This is list of gadget functions, except for
* host-mode config ... */
# define MODE_SYSFS_VALUE "sysfs_value"
# define MODE_SYSFS_RESET_VALUE "sysfs_reset_value"
# define MODE_SOFTCONNECT "softconnect"
# define MODE_SOFTCONNECT_DISCONNECT "softconnect_disconnect"
# define MODE_SOFTCONNECT_PATH "softconnect_path"

/* Instead of hard-coding values that never change or have only one option,
android engineers prefered to have sysfs entries... go figure... */
# define MODE_ANDROID_EXTRA_SYSFS_PATH "android_extra_sysfs_path"
# define MODE_ANDROID_EXTRA_SYSFS_VALUE "android_extra_sysfs_value"

/* in combined android gadgets we sometime need more than one extra sysfs path or value */
# define MODE_ANDROID_EXTRA_SYSFS_PATH2 "android_extra_sysfs_path2"
# define MODE_ANDROID_EXTRA_SYSFS_VALUE2 "android_extra_sysfs_value2"
# define MODE_ANDROID_EXTRA_SYSFS_PATH3 "android_extra_sysfs_path3"
# define MODE_ANDROID_EXTRA_SYSFS_VALUE3 "android_extra_sysfs_value3"
# define MODE_ANDROID_EXTRA_SYSFS_PATH4 "android_extra_sysfs_path4"
# define MODE_ANDROID_EXTRA_SYSFS_VALUE4 "android_extra_sysfs_value4"

/* For windows different modes/usb profiles need their own idProduct */
# define MODE_IDPRODUCT "idProduct"
# define MODE_IDVENDOROVERRIDE "idVendorOverride"
# define MODE_HAS_NAT "nat"
# define MODE_HAS_DHCP_SERVER "dhcp_server"

# ifdef CONNMAN
# define MODE_CONNMAN_TETHERING "connman_tethering"
# endif
Expand All @@ -89,9 +93,6 @@ typedef struct mode_list_elem
char *sysfs_path; /**< Path to set sysfs options */
char *sysfs_value; /**< Option name/value to write to sysfs */
char *sysfs_reset_value; /**< Value to reset the the sysfs to default */
char *softconnect; /**< Value to be written to softconnect interface */
char *softconnect_disconnect; /**< Value to set on the softconnect interface to disable after disconnect */
char *softconnect_path; /**< Path for the softconnect */
char *android_extra_sysfs_path; /**< Path for static value that never changes that needs to be set by sysfs :( */
char *android_extra_sysfs_value; /**< Static value that never changes that needs to be set by sysfs :( */
char *android_extra_sysfs_path2; /**< Path for static value that never changes that needs to be set by sysfs :( */
Expand Down

0 comments on commit b1c56eb

Please sign in to comment.