Skip to content

Commit

Permalink
Merge pull request #42 from nemomobile/adb_test
Browse files Browse the repository at this point in the history
Bug fixing release 0.85
  • Loading branch information
philippedeswert committed Sep 25, 2015
2 parents 86c30cf + 00fb27e commit 33aea13
Show file tree
Hide file tree
Showing 7 changed files with 46 additions and 19 deletions.
1 change: 1 addition & 0 deletions config/run/adb-startserver.ini
Expand Up @@ -2,3 +2,4 @@
name = adbd.service
mode = adb_mode
systemd = 1
post = 1
4 changes: 2 additions & 2 deletions configure.ac
@@ -1,4 +1,4 @@
AC_INIT([usb_moded], [0.82.5])
AC_INIT([usb_moded], [0.85])
AM_INIT_AUTOMAKE([-Wall -Werror foreign])

AM_CONFIG_HEADER([config.h])
Expand Down Expand Up @@ -26,7 +26,7 @@ CFLAGS="-Os -std=gnu99 -Wall -W -Wextra -pedantic -pipe -Wformat -Wold-style-def

AC_ARG_ENABLE([debug], AS_HELP_STRING([--enable-debug],[Enable debug @<:@default=false@:>@]),
[case "${enableval}" in
yes) debug=true ; CFLAGS="-g -ggdb -O0 -DDEBUG -DOSSOLOG_STDERR $CFLAGS" ;;
yes) debug=true ; CFLAGS="-g -ggdb -DDEBUG $CFLAGS" ;;
no) debug=false ;;
*) AC_MSG_ERROR([bad value ${enableval} for --enable-debug]) ;;
esac],[debug=false])
Expand Down
17 changes: 13 additions & 4 deletions debian/changelog
@@ -1,9 +1,18 @@
usb-moded (0.85) unstable; urgency=low

* [usb-moded] Do not retry network when there is no need.
* [usb-moded] Do not print output for post services that are not started
* [systemd] Put busname in correct section.
* [adb] improve adb starting

-- Philippe De Swert <philippe.deswert@jolla.com> Thu, 24 Sep 2015 15:51:16 +0300

usb-moded (0.82.5) unstable; urgency=low

[network] Unify network configuration handling into one function
[network] Add netmask handling. Fixes: JB#31127
[udhcpd] Limit lease time and allow for some more ip's to avoid connectivity issues.
[pc connection] Remove unused obex configuration. Fixes: JB#30696
* [network] Unify network configuration handling into one function
* [network] Add netmask handling. Fixes: JB#31127
* [udhcpd] Limit lease time and allow for some more ip's to avoid connectivity issues.
* [pc connection] Remove unused obex configuration. Fixes: JB#30696

-- Philippe De Swert <philippe.deswert@jolla.com> Mon, 03 Aug 2015 15:53:39 +0300

Expand Down
13 changes: 7 additions & 6 deletions src/usb_moded-appsync.c
Expand Up @@ -245,14 +245,14 @@ int activate_sync(const char *mode)
/* do not launch items marked as post, will be launched after usb is up */
if(data->post)
{
mark_active(data->name);
mark_active(data->name, data->post);
continue;
}
log_debug("launching app %s\n", data->name);
if(data->systemd)
{
if(!systemd_control_service(data->name, SYSTEMD_START))
mark_active(data->name);
mark_active(data->name, 0);
else
goto error;
}
Expand All @@ -261,11 +261,11 @@ int activate_sync(const char *mode)
/* skipping if dbus session bus is not available,
or not compiled in */
if(no_dbus)
mark_active(data->name);
mark_active(data->name, 0);
#ifdef APP_SYNC_DBUS
else
if(!usb_moded_dbus_app_launch(data->launch))
mark_active(data->name);
mark_active(data->name, 0);
else
goto error;
#endif /* APP_SYNC_DBUS */
Expand Down Expand Up @@ -338,14 +338,15 @@ int activate_sync_post(const char *mode)
return(1);
}

int mark_active(const gchar *name)
int mark_active(const gchar *name, int post)
{
int ret = -1; // assume name not found
int missing = 0;

GList *iter;

log_debug("App %s notified it is ready\n", name);
if(post)
log_debug("App %s notified it is ready\n", name);

for( iter = sync_list; iter; iter = g_list_next(iter) )
{
Expand Down
2 changes: 1 addition & 1 deletion src/usb_moded-appsync.h
Expand Up @@ -47,7 +47,7 @@ typedef struct list_elem
void readlist(int diag);
int activate_sync(const char *mode);
int activate_sync_post(const char *mode);
int mark_active(const gchar *name);
int mark_active(const gchar *name, int post);
int appsync_stop(void);
void free_appsync_list(void);
void usb_moded_appsync_cleanup(void);
26 changes: 21 additions & 5 deletions src/usb_moded-modesetting.c
Expand Up @@ -43,6 +43,7 @@
#include "usb_moded-android.h"

static void report_mass_storage_blocker(const char *mountpoint, int try);
guint delayed_network = 0;

int write_to_file(const char *path, const char *text)
{
Expand Down Expand Up @@ -87,6 +88,12 @@ int write_to_file(const char *path, const char *text)
return err;
}

static gboolean network_retry(gpointer data)
{
usb_network_up(data);
return(FALSE);
}

static int set_mass_storage_mode(struct mode_list_elem *data)
{
gchar *command;
Expand Down Expand Up @@ -168,7 +175,7 @@ umount: command = g_strconcat("mount | grep ", mountpath, NULL);
}

/* activate mounts after sleeping 1s to be sure enumeration happened and autoplay will work in windows*/
usleep(1800);
sleep(1);
for(i=0 ; mounts[i] != NULL; i++)
{

Expand Down Expand Up @@ -384,11 +391,10 @@ int set_dynamic_mode(void)

/* try a second time to bring up the network if it failed the first time,
this can happen with functionfs based gadgets (which is why we sleep for a bit */
if(network != 0)
if(network != 0 && data->network)
{
log_debug("Retry setting up te network\n");
sleep(1);
usb_network_up(data);
log_debug("Retry setting up the network later\n");
delayed_network = g_timeout_add_seconds(3, network_retry, data);
}

/* Needs to be called before application post synching so
Expand All @@ -398,7 +404,11 @@ int set_dynamic_mode(void)

/* no need to execute the post sync if there was an error setting the mode */
if(data->appsync && !ret)
{
/* let's sleep for a bit (350ms) to allow interfaces to settle before running postsync */
usleep(350000);
activate_sync_post(data->mode_name);
}

#ifdef CONNMAN
if(data->connman_tethering)
Expand All @@ -417,6 +427,12 @@ void unset_dynamic_mode(void)

data = get_usb_mode_data();

if(delayed_network)
{
g_source_remove(delayed_network);
delayed_network = 0;
}

/* the modelist could be empty */
if(!data)
return;
Expand Down
2 changes: 1 addition & 1 deletion systemd/usb-moded.service
Expand Up @@ -5,7 +5,6 @@ Wants=systemd-udev-settle.service
Requires=dbus.socket
After=local-fs.target dbus.socket systemd-udev-settle.service
Conflicts=shutdown.target
BusName=com.meego.usb_moded

[Service]
Type=notify
Expand All @@ -15,6 +14,7 @@ EnvironmentFile=-/run/usb-moded/*.conf
ExecStart=/usr/sbin/usb_moded --systemd --force-syslog $USB_MODED_ARGS
Restart=always
ExecReload=/bin/kill -HUP $MAINPID
BusName=com.meego.usb_moded

[Install]
WantedBy=basic.target

0 comments on commit 33aea13

Please sign in to comment.