Commit 3c056167 authored by Philippe De Swert's avatar Philippe De Swert

[usb-moded] Finalize diagnostic mode

Signed-off-by: default avatarPhilippe De Swert <philippe.deswert@jollamobile.com>
parent ef5d87bf
[mode]
name = qa_diag_mode
module = none
appsync = 1
network = 0
[options]
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
[info]
name = adbd.service
mode = qa_diag_mode
systemd = 1
Name: usb-moded
Version: 0.67.1
Version: 0.68
Release: 0
Summary: USB mode controller
Group: System/System Control
......@@ -205,6 +205,14 @@ This package provides the default configuration for usb-moded, so
basic functionality is provided (i.e. usb networking, ask and charging
modes with the android gadget driver)
%package usb-moded-diagnostics-config
Summary: USB mode controller - config data for diagnostics mode
Group: Config
%description usb-moded-diagnostics-config
This package contains the diagnostics info needed to configure a
diagnotic mode
%prep
%setup -q
......@@ -229,7 +237,9 @@ install -m 644 -D %{SOURCE1} %{buildroot}/lib/systemd/system/%{name}.service
install -d %{buildroot}/%{_sysconfdir}/usb-moded
install -d %{buildroot}/%{_sysconfdir}/usb-moded/run
install -d %{buildroot}/%{_sysconfdir}/usb-moded/dyn-modes
install -d %{buildroot}/%{_sysconfdir}/usb-moded/diag
install -m 644 -D config/dyn-modes/* %{buildroot}/%{_sysconfdir}/usb-moded/dyn-modes/
install -m 644 -D config/diag/* %{buildroot}/%{_sysconfdir}/usb-moded/diag/
install -m 644 -D config/run/* %{buildroot}/%{_sysconfdir}/usb-moded/run/
install -d $RPM_BUILD_ROOT/lib/systemd/system/multi-user.target.wants/
ln -s ../%{name}.service $RPM_BUILD_ROOT/lib/systemd/system/multi-user.target.wants/%{name}.service
......@@ -331,3 +341,7 @@ systemctl daemon-reload
%files usb-moded-defaults-android
%defattr(-,root,root,-)
%files usb-moded-diagnostics-config
%defattr(-,root,root,-)
%{_sysconfdir}/usb-moded/diag/qa_diag_mode.ini
%{_sysconfdir}/usb-moded/run/qa-diag.ini
......@@ -39,6 +39,7 @@ GList *read_mode_list(int diag)
GList *modelist = NULL;
const gchar *dirname;
struct mode_list_elem *list_item;
gchar *full_filename = NULL;
if(diag)
confdir = g_dir_open(DIAG_DIR_PATH, 0, NULL);
......@@ -49,7 +50,13 @@ GList *read_mode_list(int diag)
while((dirname = g_dir_read_name(confdir)) != NULL)
{
log_debug("Read file %s\n", dirname);
list_item = read_mode_file(dirname);
if(diag)
full_filename = g_strconcat(DIAG_DIR_PATH, "/", dirname, NULL);
else
full_filename = g_strconcat(MODE_DIR_PATH, "/", dirname, NULL);
list_item = read_mode_file(full_filename);
/* free full_filename immediately as we do not use it anymore */
free(full_filename);
if(list_item)
modelist = g_list_append(modelist, list_item);
}
......@@ -65,14 +72,9 @@ static struct mode_list_elem *read_mode_file(const gchar *filename)
GKeyFile *settingsfile;
gboolean test = FALSE;
struct mode_list_elem *list_item = NULL;
gchar *full_filename = NULL;
full_filename = g_strconcat(MODE_DIR_PATH, "/", filename, NULL);
settingsfile = g_key_file_new();
test = g_key_file_load_from_file(settingsfile, full_filename, G_KEY_FILE_NONE, NULL);
/* free full_filename immediately as we do not use it anymore */
free(full_filename);
test = g_key_file_load_from_file(settingsfile, filename, G_KEY_FILE_NONE, NULL);
if(!test)
{
return(NULL);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment