forked from enlightenment/enlightenment
bluez5 - add support to unblock rfkill if bt adatper power is on
so users will be mucho displeased and bewildered when the bt adatper is powered on but nothing happens... it ends up that with some bt adatpers it will be rfkill blocked by default. this is highly unfriendly. at least if you have bluez5 module loaded and configured the adatper to be powered on... i see no reason why it shouldn't be unblocked if the adatper is powered on. i have considerted making it an option but for now can't think of good reasons to really do that.
This commit is contained in:
parent
4723f7e4a7
commit
401becb78e
|
@ -1,4 +1,5 @@
|
||||||
#include "bz.h"
|
#include "bz.h"
|
||||||
|
#include "e_mod_main.h"
|
||||||
|
|
||||||
static Eldbus_Proxy *objman_proxy = NULL;
|
static Eldbus_Proxy *objman_proxy = NULL;
|
||||||
static Eldbus_Signal_Handler *sig_ifadd = NULL;
|
static Eldbus_Signal_Handler *sig_ifadd = NULL;
|
||||||
|
@ -262,6 +263,12 @@ cb_obj_prop(void *data, const Eldbus_Message *msg, Eldbus_Pending *pending EINA_
|
||||||
if (eldbus_message_arguments_get(msg, "a{sv}", &array))
|
if (eldbus_message_arguments_get(msg, "a{sv}", &array))
|
||||||
eldbus_message_iter_dict_iterate(array, "sv", cb_obj_prop_entry, o);
|
eldbus_message_iter_dict_iterate(array, "sv", cb_obj_prop_entry, o);
|
||||||
bz_obj_ref(o);
|
bz_obj_ref(o);
|
||||||
|
if ((o->powered) && (o->path))
|
||||||
|
{
|
||||||
|
const char *s = strrchr(o->path, '/');
|
||||||
|
|
||||||
|
if (s) ebluez5_rfkill_unblock(s + 1);
|
||||||
|
}
|
||||||
if (!o->add_called)
|
if (!o->add_called)
|
||||||
{
|
{
|
||||||
o->add_called = EINA_TRUE;
|
o->add_called = EINA_TRUE;
|
||||||
|
|
|
@ -251,6 +251,23 @@ ebluez5_popups_show(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
ebluez5_rfkill_unblock(const char *name)
|
||||||
|
{
|
||||||
|
Eina_Strbuf *buf;
|
||||||
|
|
||||||
|
// XXX: need config tp enable or disable this behavior
|
||||||
|
buf = eina_strbuf_new();
|
||||||
|
if (buf)
|
||||||
|
{
|
||||||
|
eina_strbuf_append_printf
|
||||||
|
(buf, "%s/enlightenment/utils/enlightenment_sys rfkill-unblock %s",
|
||||||
|
e_prefix_lib_get(), name);
|
||||||
|
ecore_exe_run(eina_strbuf_string_get(buf), NULL);
|
||||||
|
eina_strbuf_free(buf);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
/* Module Functions */
|
/* Module Functions */
|
||||||
|
|
|
@ -35,6 +35,7 @@ E_API int e_modapi_shutdown(E_Module *m);
|
||||||
E_API int e_modapi_save(E_Module *m);
|
E_API int e_modapi_save(E_Module *m);
|
||||||
|
|
||||||
void ebluez5_popups_show(void);
|
void ebluez5_popups_show(void);
|
||||||
|
void ebluez5_rfkill_unblock(const char *name);
|
||||||
|
|
||||||
void ebluez5_popup_hide(Instance *inst);
|
void ebluez5_popup_hide(Instance *inst);
|
||||||
|
|
||||||
|
|
|
@ -52,7 +52,16 @@ static void
|
||||||
_cb_power(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
|
_cb_power(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
|
||||||
{
|
{
|
||||||
Obj *o = data;
|
Obj *o = data;
|
||||||
if (elm_check_state_get(obj)) bz_obj_power_on(o);
|
if (elm_check_state_get(obj))
|
||||||
|
{
|
||||||
|
if (o->path)
|
||||||
|
{
|
||||||
|
const char *s = strrchr(o->path, '/');
|
||||||
|
|
||||||
|
if (s) ebluez5_rfkill_unblock(s + 1);
|
||||||
|
}
|
||||||
|
bz_obj_power_on(o);
|
||||||
|
}
|
||||||
else bz_obj_power_off(o);
|
else bz_obj_power_off(o);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -467,7 +476,10 @@ static void
|
||||||
_cb_settings(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
|
_cb_settings(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
|
||||||
{
|
{
|
||||||
Instance *inst = data;
|
Instance *inst = data;
|
||||||
|
|
||||||
ebluez5_popup_hide(inst);
|
ebluez5_popup_hide(inst);
|
||||||
|
if (e_configure_registry_exists("extensions/bluez5"))
|
||||||
|
e_configure_registry_call("extensions/bluez5", NULL, NULL);
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -537,7 +549,7 @@ ebluez5_popup_content_add(Evas_Object *base, Instance *inst)
|
||||||
evas_object_smart_callback_add(o, "clicked", _cb_settings, inst);
|
evas_object_smart_callback_add(o, "clicked", _cb_settings, inst);
|
||||||
elm_box_pack_end(box, o);
|
elm_box_pack_end(box, o);
|
||||||
evas_object_show(o);
|
evas_object_show(o);
|
||||||
*/
|
*/
|
||||||
return box;
|
return box;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -704,9 +716,19 @@ ebluez5_popup_device_change(Obj *o)
|
||||||
{
|
{
|
||||||
if (o == elm_object_item_data_get(it))
|
if (o == elm_object_item_data_get(it))
|
||||||
{
|
{
|
||||||
elm_genlist_item_update(it);
|
// if this is a change for the obj for an "initial"
|
||||||
|
// request to the user for ok/pin etc. then change it
|
||||||
|
// and do the updates
|
||||||
if (alert)
|
if (alert)
|
||||||
|
{
|
||||||
|
elm_genlist_item_update(it);
|
||||||
elm_genlist_item_show(it, ELM_GENLIST_ITEM_SCROLLTO_MIDDLE);
|
elm_genlist_item_show(it, ELM_GENLIST_ITEM_SCROLLTO_MIDDLE);
|
||||||
|
}
|
||||||
|
// otherwise only do changes to items with no agent
|
||||||
|
// requests pending so we dont delete focused widgets
|
||||||
|
// or entry widgets etc.
|
||||||
|
else if (!o->agent_request)
|
||||||
|
elm_genlist_item_update(it);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue