Skip to content

Commit

Permalink
Merge pull request #43 from nemomobile/diag
Browse files Browse the repository at this point in the history
[diag] update diag mode to newer android standard. Fixes JB#31988
  • Loading branch information
philippedeswert committed Oct 12, 2015
2 parents 6e4a9c4 + d764ae5 commit 778071a
Show file tree
Hide file tree
Showing 9 changed files with 74 additions and 4 deletions.
6 changes: 5 additions & 1 deletion config/dyn-modes/diag_mode.ini
Expand Up @@ -7,7 +7,7 @@ network_interface = rndis0

[options]
sysfs_path = /sys/class/android_usb/android0/functions
sysfs_value = rndis,adb,diag,serial
sysfs_value = diag,serial,rmnet,qdss,adb,rndis
sysfs_reset_value = none
softconnect_path = /sys/class/android_usb/android0/enable
softconnect = 1
Expand All @@ -16,4 +16,8 @@ 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
android_extra_sysfs_value2 = smd
android_extra_sysfs_path3 = /sys/class/android_usb/android0/f_rmnet/transports
android_extra_sysfs_value3 = qti,bam
android_extra_sysfs_path4 = /sys/class/android_usb/android0/f_qdss/transports
android_extra_sysfs_value4 = qti,bam_dmux
idProduct = 0A04
19 changes: 19 additions & 0 deletions config/dyn-modes/diag_mode_old.ini
@@ -0,0 +1,19 @@
[mode]
name = diag_mode
module = none
appsync = 1
network = 1
network_interface = rndis0

[options]
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
android_extra_sysfs_value2 = smd
idProduct = 0A04
1 change: 1 addition & 0 deletions config/run/adb-diag.ini
Expand Up @@ -2,3 +2,4 @@
name = adbd.service
mode = diag_mode
systemd = 1
post = 1
4 changes: 4 additions & 0 deletions config/run/diag-adb-prepare.ini
@@ -0,0 +1,4 @@
[info]
name = adbd-prepare.service
mode = diag_mode
systemd = 1
2 changes: 1 addition & 1 deletion configure.ac
@@ -1,4 +1,4 @@
AC_INIT([usb_moded], [0.85])
AC_INIT([usb_moded], [0.85.1])
AM_INIT_AUTOMAKE([-Wall -Werror foreign])

AM_CONFIG_HEADER([config.h])
Expand Down
6 changes: 6 additions & 0 deletions debian/changelog
@@ -1,3 +1,9 @@
usb-moded (0.85.1) unstable; urgency=low

* [diag] update diag mode to newer android standard.

-- Philippe De Swert <philippe.deswert@jolla.com> Mon, 05 Oct 2015 16:41:10 +0300

usb-moded (0.85) unstable; urgency=low

* [usb-moded] Do not retry network when there is no need.
Expand Down
24 changes: 22 additions & 2 deletions rpm/usb-moded.spec
@@ -1,6 +1,6 @@
Name: usb-moded
Version: 0.82
Release: 5
Version: 0.85
Release: 1
Summary: USB mode controller
Group: System/System Control
License: LGPLv2
Expand Down Expand Up @@ -117,6 +117,20 @@ system bus.
This package contains the diag config for use with the android
gadget driver.

%package diag-mode-androidv5-qcom
Summary: USB mode controller - android v5 or newer diag mode config for qcom
Group: Config

%description diag-mode-androidv5-qcom
Usb_moded is a daemon to control the USB states. For this
it loads unloads the relevant usb gadget modules, keeps track
of the filesystem(s) and notifies about changes on the DBUS
system bus.

This package contains the diag config for use with the android
gadget driver.


%package acm-mode-android
Summary: USB mode controller - android acm mode config
Group: Config
Expand Down Expand Up @@ -384,8 +398,14 @@ systemctl daemon-reload || :

%files diag-mode-android
%defattr(-,root,root,-)
%{_sysconfdir}/usb-moded/dyn-modes/diag_mode_old.ini
%{_sysconfdir}/usb-moded/run/adb-diag.ini

%files diag-mode-androidv5-qcom
%defattr(-,root,root,-)
%{_sysconfdir}/usb-moded/dyn-modes/diag_mode.ini
%{_sysconfdir}/usb-moded/run/adb-diag.ini
%{_sysconfdir}/usb-moded/run/diag-adb-prepare.ini

%files acm-mode-android
%defattr(-,root,root,-)
Expand Down
8 changes: 8 additions & 0 deletions src/usb_moded-dyn-config.c
Expand Up @@ -50,6 +50,10 @@ void list_item_free(mode_list_elem *list_item)
free(list_item->android_extra_sysfs_value);
free(list_item->android_extra_sysfs_path2);
free(list_item->android_extra_sysfs_value2);
free(list_item->android_extra_sysfs_path3);
free(list_item->android_extra_sysfs_value3);
free(list_item->android_extra_sysfs_path4);
free(list_item->android_extra_sysfs_value4);
free(list_item->idProduct);
#ifdef CONNMAN
free(list_item->connman_tethering);
Expand Down Expand Up @@ -142,9 +146,13 @@ static struct mode_list_elem *read_mode_file(const gchar *filename)
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);
list_item->android_extra_sysfs_path4 = g_key_file_get_string(settingsfile, MODE_OPTIONS_ENTRY, MODE_ANDROID_EXTRA_SYSFS_PATH4, NULL);
//log_debug("Android extra mode sysfs path2 = %s\n", list_item->android_extra_sysfs_path2);
list_item->android_extra_sysfs_value = g_key_file_get_string(settingsfile, MODE_OPTIONS_ENTRY, MODE_ANDROID_EXTRA_SYSFS_VALUE, NULL);
list_item->android_extra_sysfs_value2 = g_key_file_get_string(settingsfile, MODE_OPTIONS_ENTRY, MODE_ANDROID_EXTRA_SYSFS_VALUE2, NULL);
list_item->android_extra_sysfs_value3 = g_key_file_get_string(settingsfile, MODE_OPTIONS_ENTRY, MODE_ANDROID_EXTRA_SYSFS_VALUE3, NULL);
list_item->android_extra_sysfs_value4 = g_key_file_get_string(settingsfile, MODE_OPTIONS_ENTRY, MODE_ANDROID_EXTRA_SYSFS_VALUE4, NULL);
//log_debug("Android extra value2 = %s\n", list_item->android_extra_sysfs_value2);
list_item->idProduct = g_key_file_get_string(settingsfile, MODE_OPTIONS_ENTRY, MODE_IDPRODUCT, NULL);
list_item->nat = g_key_file_get_integer(settingsfile, MODE_OPTIONS_ENTRY, MODE_HAS_NAT, NULL);
Expand Down
8 changes: 8 additions & 0 deletions src/usb_moded-dyn-config.h
Expand Up @@ -47,6 +47,10 @@ android engineers prefered to have sysfs entries... go figure... */
/* 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_HAS_NAT "nat"
Expand Down Expand Up @@ -77,6 +81,10 @@ typedef struct mode_list_elem
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 :( */
char *android_extra_sysfs_value2; /* static value that never changes that needs to be set by sysfs :( */
char *android_extra_sysfs_path3; /* path for static value that never changes that needs to be set by sysfs :( */
char *android_extra_sysfs_value3; /* static value that never changes that needs to be set by sysfs :( */
char *android_extra_sysfs_path4; /* path for static value that never changes that needs to be set by sysfs :( */
char *android_extra_sysfs_value4; /* static value that never changes that needs to be set by sysfs :( */
char *idProduct; /* product id to assign to a specific profile */
int nat; /* If NAT should be set up in this mode or not */
int dhcp_server; /* if a DHCP server needs to be configured and started or not */
Expand Down

0 comments on commit 778071a

Please sign in to comment.