[maemo-commits] [maemo-commits] r13150 - in projects/connectivity/osso-gwconnect/trunk: . debian src
From: subversion at stage.maemo.org subversion at stage.maemo.orgDate: Mon Aug 13 14:48:44 EEST 2007
- Previous message: [maemo-commits] r13149 - in projects/haf/trunk/libhildonmime: . debian libhildonmime tests
- Next message: [maemo-commits] r13151 - projects/connectivity/osso-gwconnect/tags
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Author: jh Date: 2007-08-13 14:48:40 +0300 (Mon, 13 Aug 2007) New Revision: 13150 Modified: projects/connectivity/osso-gwconnect/trunk/configure.ac projects/connectivity/osso-gwconnect/trunk/debian/changelog projects/connectivity/osso-gwconnect/trunk/debian/rules projects/connectivity/osso-gwconnect/trunk/src/btcond-bt.c projects/connectivity/osso-gwconnect/trunk/src/btcond-dbus.c projects/connectivity/osso-gwconnect/trunk/src/btcond.c projects/connectivity/osso-gwconnect/trunk/src/btsdp-bt.c projects/connectivity/osso-gwconnect/trunk/src/btsdp-bt.h projects/connectivity/osso-gwconnect/trunk/src/btsdp-dbus.c projects/connectivity/osso-gwconnect/trunk/src/btsearch-bt.c projects/connectivity/osso-gwconnect/trunk/src/btsearch-bt.h projects/connectivity/osso-gwconnect/trunk/src/btsearch-dbus.c projects/connectivity/osso-gwconnect/trunk/src/dbus-helper.c projects/connectivity/osso-gwconnect/trunk/src/dbus-helper.h projects/connectivity/osso-gwconnect/trunk/src/state.c projects/connectivity/osso-gwconnect/trunk/src/state.h Log: Get rid of offline mode tracking since the UI will take care of it Modified: projects/connectivity/osso-gwconnect/trunk/configure.ac =================================================================== --- projects/connectivity/osso-gwconnect/trunk/configure.ac 2007-08-13 11:28:41 UTC (rev 13149) +++ projects/connectivity/osso-gwconnect/trunk/configure.ac 2007-08-13 11:48:40 UTC (rev 13150) @@ -1,4 +1,4 @@ -AC_INIT([osso-gwconnect],[1.0.11]) +AC_INIT([osso-gwconnect],[1.0.12]) AM_CONFIG_HEADER(config.h) AM_INIT_AUTOMAKE(AC_PACKAGE_NAME, AC_PACKAGE_VERSION) Modified: projects/connectivity/osso-gwconnect/trunk/debian/changelog =================================================================== --- projects/connectivity/osso-gwconnect/trunk/debian/changelog 2007-08-13 11:28:41 UTC (rev 13149) +++ projects/connectivity/osso-gwconnect/trunk/debian/changelog 2007-08-13 11:48:40 UTC (rev 13150) @@ -1,3 +1,9 @@ +osso-gwconnect (1.0.12) unstable; urgency=low + + * Remove offline mode stuff (as this is taken care of by the UI) + + -- Johan Hedberg <johan.hedberg at nokia.com> Mon, 13 Aug 2007 14:38:16 +0300 + osso-gwconnect (1.0.11) unstable; urgency=low * Delay start of btcond. Fixes: NB#60079 Modified: projects/connectivity/osso-gwconnect/trunk/debian/rules =================================================================== --- projects/connectivity/osso-gwconnect/trunk/debian/rules 2007-08-13 11:28:41 UTC (rev 13149) +++ projects/connectivity/osso-gwconnect/trunk/debian/rules 2007-08-13 11:48:40 UTC (rev 13150) @@ -6,8 +6,7 @@ confflags += --enable-tracing \ --enable-ossolog \ - --enable-nokiahci \ - --enable-mce + --enable-nokiahci ifeq ($(DEB_BUILD_GNU_TYPE), $(DEB_HOST_GNU_TYPE)) confflags += --build $(DEB_HOST_GNU_TYPE) Modified: projects/connectivity/osso-gwconnect/trunk/src/btcond-bt.c =================================================================== --- projects/connectivity/osso-gwconnect/trunk/src/btcond-bt.c 2007-08-13 11:28:41 UTC (rev 13149) +++ projects/connectivity/osso-gwconnect/trunk/src/btcond-bt.c 2007-08-13 11:48:40 UTC (rev 13150) @@ -766,13 +766,6 @@ debug("schedule_capability_update(%s, %s)", bda ? bda : "[def]", svc ? svc : "[all]"); - if (bt_disabled()) { - g_set_error(err, BT_COND_ERROR, - BT_COND_ERROR_BT_DISABLED, - "Bluetooth is disabled"); - return FALSE; - } - dev = get_dev(bda); if (dev == NULL) { @@ -806,13 +799,6 @@ auth ? "auth" : "noauth", encr ? "encrypt" : "noencrypt", role ? role : "any"); - if (bt_disabled()) { - g_set_error(err, BT_COND_ERROR, - BT_COND_ERROR_BT_DISABLED, - "Bluetooth is disabled"); - return FALSE; - } - bd = get_dev(bda); if (bd == NULL) { Modified: projects/connectivity/osso-gwconnect/trunk/src/btcond-dbus.c =================================================================== --- projects/connectivity/osso-gwconnect/trunk/src/btcond-dbus.c 2007-08-13 11:28:41 UTC (rev 13149) +++ projects/connectivity/osso-gwconnect/trunk/src/btcond-dbus.c 2007-08-13 11:48:40 UTC (rev 13150) @@ -1045,9 +1045,6 @@ error("dbus_connection_register_object_path failed"); #ifdef USE_MCE - if (!add_mode_listener(connection, mode_change)) - error("Adding mode listener failed"); - if (ignore_special_hw_events()) return; Modified: projects/connectivity/osso-gwconnect/trunk/src/btcond.c =================================================================== --- projects/connectivity/osso-gwconnect/trunk/src/btcond.c 2007-08-13 11:28:41 UTC (rev 13149) +++ projects/connectivity/osso-gwconnect/trunk/src/btcond.c 2007-08-13 11:48:40 UTC (rev 13150) @@ -210,7 +210,6 @@ int main(int argc, char *argv[]) { GError *err = NULL; - gchar *mode; gint i, old_pid; program_name = argv[0]; @@ -248,17 +247,6 @@ update_cover_state(); #endif - mode = get_device_mode(get_dbus_connection()); - if (mode != NULL) { - mode_change(mode); - g_free(mode); - mode = NULL; - } - else { - error("Unable to determine actual device mode. Assuming normal mode."); - mode_change("normal"); - } - report("Bluetooth Connection Daemon %s started.", VERSION); /* Enter main loop */ Modified: projects/connectivity/osso-gwconnect/trunk/src/btsdp-bt.c =================================================================== --- projects/connectivity/osso-gwconnect/trunk/src/btsdp-bt.c 2007-08-13 11:28:41 UTC (rev 13149) +++ projects/connectivity/osso-gwconnect/trunk/src/btsdp-bt.c 2007-08-13 11:48:40 UTC (rev 13150) @@ -245,24 +245,3 @@ return TRUE; } -gboolean bt_ok(void) -{ - gboolean ret; - gchar *mode; - - mode = get_device_mode(get_dbus_connection()); - if (mode == NULL) { - error("get_device_mode() returned NULL!"); - /* Assume that BT is usable */ - return TRUE; - } - - if (g_str_equal(mode, "normal")) - ret = TRUE; - else - ret = FALSE; - - g_free(mode); - - return ret; -} Modified: projects/connectivity/osso-gwconnect/trunk/src/btsdp-bt.h =================================================================== --- projects/connectivity/osso-gwconnect/trunk/src/btsdp-bt.h 2007-08-13 11:28:41 UTC (rev 13149) +++ projects/connectivity/osso-gwconnect/trunk/src/btsdp-bt.h 2007-08-13 11:48:40 UTC (rev 13150) @@ -45,6 +45,4 @@ gboolean get_services(const char *bda, GSList *l, sdp_cb_data_t *data, GError **err); -gboolean bt_ok(void); - #endif /* _BTSDP_BT_H_ */ Modified: projects/connectivity/osso-gwconnect/trunk/src/btsdp-dbus.c =================================================================== --- projects/connectivity/osso-gwconnect/trunk/src/btsdp-dbus.c 2007-08-13 11:28:41 UTC (rev 13149) +++ projects/connectivity/osso-gwconnect/trunk/src/btsdp-dbus.c 2007-08-13 11:48:40 UTC (rev 13150) @@ -147,14 +147,6 @@ return DBUS_HANDLER_RESULT_HANDLED; } - if (!bt_ok()) { - reply = new_dbus_error(message, BTSDP_ERROR_BT_DISABLED, NULL); - if (!send_and_unref(connection, reply)) - error("Unable to send bt_disabled error reply"); - g_main_loop_quit(event_loop); - return DBUS_HANDLER_RESULT_HANDLED; - } - dbus_message_iter_init(message, &iter); /* We can't use get_dbus_iter_args because after the call the iter points on the * second argument if the message had two arguments, but on the third argument if Modified: projects/connectivity/osso-gwconnect/trunk/src/btsearch-bt.c =================================================================== --- projects/connectivity/osso-gwconnect/trunk/src/btsearch-bt.c 2007-08-13 11:28:41 UTC (rev 13149) +++ projects/connectivity/osso-gwconnect/trunk/src/btsearch-bt.c 2007-08-13 11:48:40 UTC (rev 13150) @@ -30,24 +30,3 @@ #include "dbus-helper.h" #include "btsearch-bt.h" -gboolean bt_ok(void) -{ - gboolean ret; - gchar *mode; - - mode = get_device_mode(get_dbus_connection()); - if (mode == NULL) { - error("get_device_mode() returned NULL!"); - /* Assume that BT is usable */ - return TRUE; - } - - if (g_str_equal(mode, "normal")) - ret = TRUE; - else - ret = FALSE; - - g_free(mode); - - return ret; -} Modified: projects/connectivity/osso-gwconnect/trunk/src/btsearch-bt.h =================================================================== --- projects/connectivity/osso-gwconnect/trunk/src/btsearch-bt.h 2007-08-13 11:28:41 UTC (rev 13149) +++ projects/connectivity/osso-gwconnect/trunk/src/btsearch-bt.h 2007-08-13 11:48:40 UTC (rev 13150) @@ -22,6 +22,4 @@ #ifndef _BTSEARCH_BT_H_ #define _BTSEARCH_BT_H_ -gboolean bt_ok(void); - #endif /* _BTSEARCH_BT_H_ */ Modified: projects/connectivity/osso-gwconnect/trunk/src/btsearch-dbus.c =================================================================== --- projects/connectivity/osso-gwconnect/trunk/src/btsearch-dbus.c 2007-08-13 11:28:41 UTC (rev 13149) +++ projects/connectivity/osso-gwconnect/trunk/src/btsearch-dbus.c 2007-08-13 11:48:40 UTC (rev 13150) @@ -83,14 +83,6 @@ remove_exit_timer(); - if (!bt_ok()) { - reply = new_dbus_error(message, BTSEARCH_ERROR_BT_DISABLED, NULL); - if (!send_and_unref(connection, reply)) - error("Unable to send bt_disabled error reply"); - g_main_loop_quit(event_loop); - return DBUS_HANDLER_RESULT_HANDLED; - } - init_search(sender); if (dbus_message_get_no_reply(message)) Modified: projects/connectivity/osso-gwconnect/trunk/src/dbus-helper.c =================================================================== --- projects/connectivity/osso-gwconnect/trunk/src/dbus-helper.c 2007-08-13 11:28:41 UTC (rev 13149) +++ projects/connectivity/osso-gwconnect/trunk/src/dbus-helper.c 2007-08-13 11:48:40 UTC (rev 13150) @@ -176,31 +176,6 @@ return DBUS_HANDLER_RESULT_NOT_YET_HANDLED; } -#ifdef USE_MCE -static DBusHandlerResult mode_filter(DBusConnection *connection, - DBusMessage *message, - void (*mode_cb)(const gchar *mode)) -{ - char *mode; - - if (!dbus_message_is_signal(message, - MCE_SIGNAL_IF, - MCE_DEVICE_MODE_SIG)) - return DBUS_HANDLER_RESULT_NOT_YET_HANDLED; - - if (!dbus_message_get_args(message, NULL, - DBUS_TYPE_STRING, &mode, - DBUS_TYPE_INVALID)) { - error("Invalid arguments for device_mode_ind signal"); - return DBUS_HANDLER_RESULT_NOT_YET_HANDLED; - } - - mode_cb(mode); - - return DBUS_HANDLER_RESULT_HANDLED; -} -#endif - DBusMessage *new_dbus_signal(const char *path, const char *interface, const char *name, @@ -334,59 +309,6 @@ return ret; } -gchar *get_device_mode(DBusConnection *connection) -{ -#ifdef USE_MCE - DBusError derror; - char *mode, *ret; - DBusMessage *message, *reply; - - message = new_dbus_method_call(MCE_SERVICE, - MCE_REQUEST_PATH, - MCE_REQUEST_IF, - MCE_DEVICE_MODE_GET); - - dbus_error_init(&derror); - reply = dbus_connection_send_with_reply_and_block(connection, message, - -1, &derror); - dbus_message_unref(message); - if (dbus_error_is_set(&derror)) { - error("Getting device mode from MCE failed: %s", derror.message); - dbus_error_free(&derror); - return NULL; - } - - if (!dbus_message_get_args(reply, NULL, - DBUS_TYPE_STRING, &mode, - DBUS_TYPE_INVALID)) { - error("Invalid arguments for MCE req_device_mode reply"); - dbus_message_unref(reply); - return NULL; - } - - ret = g_strdup(mode); - - dbus_message_unref(reply); - - return ret; -#else /* USE_MCE */ - return g_strdup("normal"); -#endif -} - -#ifdef USE_MCE -gboolean add_mode_listener(DBusConnection *connection, - void (*mode_cb)(const gchar *mode)) -{ - - dbus_bus_add_match(connection, "interface=" MCE_SIGNAL_IF, NULL); - return dbus_connection_add_filter(connection, - (DBusHandleMessageFunction)mode_filter, - mode_cb, - NULL); -} -#endif - gboolean add_name_listener(DBusConnection *connection, const char *name, name_cb func, gpointer user_data) { Modified: projects/connectivity/osso-gwconnect/trunk/src/dbus-helper.h =================================================================== --- projects/connectivity/osso-gwconnect/trunk/src/dbus-helper.h 2007-08-13 11:28:41 UTC (rev 13149) +++ projects/connectivity/osso-gwconnect/trunk/src/dbus-helper.h 2007-08-13 11:48:40 UTC (rev 13150) @@ -52,24 +52,6 @@ DBusMessage *new_dbus_error_gerr(DBusMessage *message, GError *err); -/** Get device mode from MCE - * @param connection D-BUS connection to use - * @returns device mode (as reported by MCE, should be "flight" or "normal") - */ -gchar *get_device_mode(DBusConnection *connection); - -/** Add a function to be called when device mode changes (reported by a D-BUS - * signal from MCE) - * @param connection D-BUS connection to listen for MCE signals on - * @param mode_cb function to call when the mode changes - * @returns TRUE on success, FALSE on failure - */ -#ifdef USE_MCE -gboolean add_mode_listener(DBusConnection *connection, - void (*mode_cb)(const gchar *mode)); - -#endif - gboolean add_name_listener(DBusConnection *connection, const char *name, name_cb func, gpointer user_data); Modified: projects/connectivity/osso-gwconnect/trunk/src/state.c =================================================================== --- projects/connectivity/osso-gwconnect/trunk/src/state.c 2007-08-13 11:28:41 UTC (rev 13149) +++ projects/connectivity/osso-gwconnect/trunk/src/state.c 2007-08-13 11:48:40 UTC (rev 13150) @@ -45,10 +45,8 @@ static GSList *connections = NULL; static gboolean _bt_down = FALSE; -static gboolean _flight_mode = FALSE; -static gboolean _down_before_flight = FALSE; -static gboolean _cover_closed = FALSE; #ifdef USE_MCE +static gboolean _cover_closed = FALSE; static gboolean _inactive = FALSE; #endif @@ -72,6 +70,7 @@ connections = NULL; } +#ifdef USE_MCE static void disable_bt(void) { bt_disconnect(NULL, TRUE); @@ -84,6 +83,7 @@ { hci_bt_up(); } +#endif #if 0 static void free_info(struct connection_info *info, gpointer user_data) @@ -193,7 +193,7 @@ ConnStatus connection_status(const gchar *bda) { - if (_flight_mode) + if (_bt_down) return CONN_STATUS_DISABLED; if (get_connection_info(bda)) @@ -213,44 +213,7 @@ return info->bda; } -gboolean bt_disabled(void) -{ - if (_flight_mode == TRUE || _cover_closed == TRUE) - return TRUE; - - if (_bt_down) - enable_bt(); - - return FALSE; -} - -void mode_change(const char *mode) -{ - if (g_str_equal(mode, "flight")) { - /* Ignore flight->flight mode transition */ - if (_flight_mode) - return; - _down_before_flight = _bt_down; - disable_bt(); - _flight_mode = TRUE; - } - else if (g_str_equal(mode, "normal")) { - /* Ignore normal->normal mode transition */ - if (!_flight_mode) - return; - _flight_mode = FALSE; #ifdef USE_MCE - if (_cover_closed) - return; -#endif - if (!_down_before_flight) - enable_bt(); - } - else - error("Invalid mode \"%s\" passed to mode_change()", mode); -} - -#ifdef USE_MCE # define SYSFS_COVER_FILE "/sys/devices/platform/gpio-switch/prot_shell/cover_switch" void update_cover_state() { @@ -266,13 +229,10 @@ if (strncmp(buf, "closed", strlen("closed")) == 0) { debug("Cover state: closed"); - if (!bt_disabled()) - disable_bt(); + disable_bt(); _cover_closed = TRUE; } else { debug("Cover state: open"); - if (!_flight_mode) - enable_bt(); _cover_closed = FALSE; } @@ -285,15 +245,15 @@ { _inactive = inactive; - debug("update_inactive_state: inactive=%d, _bt_down=%d, _cover_closed=%d, _flight_mode=%d", - inactive, _bt_down, _cover_closed, _flight_mode); + debug("update_inactive_state: inactive=%d, _bt_down=%d, _cover_closed=%d", + inactive, _bt_down, _cover_closed); if (inactive) { if (!connections) disable_bt(); } else { - if (_bt_down && !_cover_closed && !_flight_mode) + if (_bt_down && !_cover_closed) enable_bt(); } } Modified: projects/connectivity/osso-gwconnect/trunk/src/state.h =================================================================== --- projects/connectivity/osso-gwconnect/trunk/src/state.h 2007-08-13 11:28:41 UTC (rev 13149) +++ projects/connectivity/osso-gwconnect/trunk/src/state.h 2007-08-13 11:48:40 UTC (rev 13150) @@ -28,7 +28,7 @@ typedef enum { CONN_STATUS_CONNECTED, /**< Active connection to device */ CONN_STATUS_DISCONNECTED, /**< Device is disconnected */ - CONN_STATUS_DISABLED /**< BT disabled (eg. flight mode) */ + CONN_STATUS_DISABLED /**< BT disabled */ } ConnStatus; /** Query device connection status @@ -37,16 +37,6 @@ */ ConnStatus connection_status(const gchar *bda); -/** Query the device mode - * @returns TRUE for flight mode, FALSE for normal mode - */ -gboolean bt_disabled(void); - -/** Change mode - * @param mode Either "flight" or "normal" - */ -void mode_change(const gchar *mode); - #ifdef USE_MCE void update_cover_state(void); void update_inactive_state(gboolean inactive); @@ -60,5 +50,4 @@ gboolean handle_is_connected(uint16_t handle); - #endif /* _STATE_H_ */
- Previous message: [maemo-commits] r13149 - in projects/haf/trunk/libhildonmime: . debian libhildonmime tests
- Next message: [maemo-commits] r13151 - projects/connectivity/osso-gwconnect/tags
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]