Skip to content

Commit

Permalink
[gconf] Remove gconf schemas file from packaging as it is not used. C…
Browse files Browse the repository at this point in the history
…ontributes: JB#19322

Signed-off-by: Philippe De Swert <philippe.deswert@jollamobile.com>
  • Loading branch information
philippedeswert committed May 13, 2014
1 parent accac6c commit 49cab81
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 10 deletions.
2 changes: 0 additions & 2 deletions rpm/usb-moded.spec
Expand Up @@ -265,7 +265,6 @@ install -m 644 -D src/usb_moded-appsync-dbus.h %{buildroot}/%{_includedir}/%{nam
install -m 644 -D usb_moded.pc %{buildroot}/%{_libdir}/pkgconfig/usb_moded.pc
install -d %{buildroot}/%{_docdir}/%{name}/html/
install -m 644 docs/html/* %{buildroot}/%{_docdir}/%{name}/html/
install -m 644 -D debian/%{name}.schemas %{buildroot}/%{_sysconfdir}/gconf/schemas/%{name}.schemas
install -m 644 -D debian/manpage.1 %{buildroot}/%{_mandir}/man1/usb-moded.1
install -m 644 -D debian/usb_moded.conf %{buildroot}/%{_sysconfdir}/dbus-1/system.d/usb_moded.conf
install -m 644 -D %{SOURCE2} %{buildroot}/%{_sysconfdir}/modprobe.d/usb_moded.conf
Expand Down Expand Up @@ -296,7 +295,6 @@ systemctl daemon-reload || :
%defattr(-,root,root,-)
%doc debian/copyright
%config(noreplace) %{_sysconfdir}/dbus-1/system.d/usb_moded.conf
%config(noreplace) %{_sysconfdir}/gconf/schemas/%{name}.schemas
%config(noreplace) %{_sysconfdir}/modprobe.d/usb_moded.conf
%ghost %config(noreplace) %{_sysconfdir}/modprobe.d/g_ether.conf
%{_sbindir}/usb_moded
Expand Down
41 changes: 33 additions & 8 deletions src/usb_moded-network.c
Expand Up @@ -354,7 +354,7 @@ static int write_udhcpd_conf(struct ipforward_data *ipforward, struct mode_list_
/**
* Connman message handling
*/
static const char * connman_parse_manager_reply(DBusMessage *reply)
static const char * connman_parse_manager_reply(DBusMessage *reply, const char *req_service)
{
DBusMessageIter iter, subiter, origiter;
int type;
Expand All @@ -378,9 +378,9 @@ static const char * connman_parse_manager_reply(DBusMessage *reply)
{
dbus_message_iter_get_basic(&iter, &service);
log_debug("service = %s\n", service);
if(strstr(service, "cellular"))
if(strstr(service, req_service))
{
log_debug("cellular service found!\n");
log_debug("%s service found!\n", req_service);
return(strdup(service));
}
iter = origiter;
Expand Down Expand Up @@ -501,20 +501,45 @@ static int connman_fill_connection_data(DBusMessage *reply, struct ipforward_dat
/**
* Turn on cellular connection if it is not on
*/
static int connman_set_cellular_online(DBusConnection *dbus_conn_connman, const char *service)
static int connman_set_cellular_online(DBusConnection *dbus_conn_connman, const char *service, int retry)
{
DBusMessage *msg = NULL;
DBusMessage *msg = NULL, *reply;
DBusError error;
int ret = 0;
const char *wifi = NULL;

dbus_error_init(&error);

if(!retry)
{
if ((msg = dbus_message_new_method_call("net.connman", "/", "net.connman.Manager", "GetServices")) != NULL)
{
if ((reply = dbus_connection_send_with_reply_and_block(dbus_conn_connman, msg, -1, NULL)) != NULL)
{
wifi = connman_parse_manager_reply(reply, "wifi");
dbus_message_unref(reply);
}
dbus_message_unref(msg);
}

if(wifi != NULL)
{
/* we must make sure that wifi is disconnected as sometimes cellular will not come up otherwise */
if ((msg = dbus_message_new_method_call("net.connman", wifi, "net.connman.Service", "Disconnect")) != NULL)
{
/* we don't care for the reply, which is empty anyway if all goes well */
ret = !dbus_connection_send(dbus_conn_connman, msg, NULL);
dbus_connection_flush(dbus_conn_connman);
dbus_message_unref(msg);
}
}
}
if ((msg = dbus_message_new_method_call("net.connman", service, "net.connman.Service", "Connect")) != NULL)
{
/* we don't care for the reply, which is empty anyway if all goes well */
ret = !dbus_connection_send(dbus_conn_connman, msg, NULL);
/* sleep for the connection to come up */
sleep(3);
sleep(5);
/* make sure the message is sent before cleaning up and closing the connection */
dbus_connection_flush(dbus_conn_connman);
dbus_message_unref(msg);
Expand Down Expand Up @@ -543,7 +568,7 @@ static int connman_get_connection_data(struct ipforward_data *ipforward)
{
if ((reply = dbus_connection_send_with_reply_and_block(dbus_conn_connman, msg, -1, NULL)) != NULL)
{
service = connman_parse_manager_reply(reply);
service = connman_parse_manager_reply(reply, "cellular");
dbus_message_unref(reply);
}
dbus_message_unref(msg);
Expand All @@ -559,7 +584,7 @@ static int connman_get_connection_data(struct ipforward_data *ipforward)
{
if(connman_fill_connection_data(reply, ipforward))
{
if(!connman_set_cellular_online(dbus_conn_connman, service) && !online)
if(!connman_set_cellular_online(dbus_conn_connman, service, online) && !online)
{
online = 1;
goto try_again;
Expand Down

0 comments on commit 49cab81

Please sign in to comment.