forked from enlightenment/enlightenment
add rfkill actions to sysactions.conf - necessary for bluez
so bluez itself wont go rfkill block or unblock the bt device. you have to rfkill unblock separately if it's blocked. this is needed to make bluez at a minimum work right. possibly should be added to connman too. but this is the first step.
This commit is contained in:
parent
f20762a82d
commit
4723f7e4a7
|
@ -51,6 +51,8 @@ action: /bin/mount @MOUNT@
|
||||||
action: /bin/umount @UMOUNT@
|
action: /bin/umount @UMOUNT@
|
||||||
action: /usr/bin/eject @EJECT@
|
action: /usr/bin/eject @EJECT@
|
||||||
action: l2ping /usr/bin/l2ping
|
action: l2ping /usr/bin/l2ping
|
||||||
|
action: rfkill-unblock /bin/rfkill unblock
|
||||||
|
action: rfkill-block /bin/rfkill block
|
||||||
|
|
||||||
# root is allowed to do anything - but it needs to be here explicitly anyway
|
# root is allowed to do anything - but it needs to be here explicitly anyway
|
||||||
user: root allow: *
|
user: root allow: *
|
||||||
|
|
|
@ -66,6 +66,7 @@ main(int argc,
|
||||||
Eina_Bool mnt = EINA_FALSE;
|
Eina_Bool mnt = EINA_FALSE;
|
||||||
const char *act = NULL;
|
const char *act = NULL;
|
||||||
#endif
|
#endif
|
||||||
|
Eina_Bool rfkill = EINA_FALSE;
|
||||||
gid_t gid, gl[65536], egid;
|
gid_t gid, gl[65536], egid;
|
||||||
|
|
||||||
for (i = 1; i < argc; i++)
|
for (i = 1; i < argc; i++)
|
||||||
|
@ -88,11 +89,23 @@ main(int argc,
|
||||||
test = 1;
|
test = 1;
|
||||||
action = argv[2];
|
action = argv[2];
|
||||||
}
|
}
|
||||||
else if (!strcmp(argv[1], "l2ping"))
|
else if (!strcmp(argv[1], "l2ping"))
|
||||||
{
|
{
|
||||||
action = argv[1];
|
action = argv[1];
|
||||||
output = argv[2];
|
output = argv[2];
|
||||||
}
|
}
|
||||||
|
else if (!strcmp(argv[1], "rfkill-unblock"))
|
||||||
|
{
|
||||||
|
rfkill = EINA_TRUE;
|
||||||
|
action = argv[1];
|
||||||
|
output = argv[2];
|
||||||
|
}
|
||||||
|
else if (!strcmp(argv[1], "rfkill-block"))
|
||||||
|
{
|
||||||
|
rfkill = EINA_TRUE;
|
||||||
|
action = argv[1];
|
||||||
|
output = argv[2];
|
||||||
|
}
|
||||||
#ifdef HAVE_EEZE_MOUNT
|
#ifdef HAVE_EEZE_MOUNT
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -282,6 +295,59 @@ main(int argc,
|
||||||
putenv("PATH=/bin:/usr/bin:/sbin:/usr/sbin");
|
putenv("PATH=/bin:/usr/bin:/sbin:/usr/sbin");
|
||||||
putenv("IFS= \t\n");
|
putenv("IFS= \t\n");
|
||||||
|
|
||||||
|
if ((!test) && (rfkill))
|
||||||
|
{
|
||||||
|
Eina_Strbuf *buf = NULL;
|
||||||
|
const char *s;
|
||||||
|
|
||||||
|
buf = eina_strbuf_new();
|
||||||
|
if (!buf) exit(30);
|
||||||
|
for (s = output; *s; s++)
|
||||||
|
{
|
||||||
|
if (!(((*s >= 'a') && (*s <= 'z')) ||
|
||||||
|
((*s >= 'A') && (*s <= 'Z')) ||
|
||||||
|
((*s >= '0') && (*s <= '9')) ||
|
||||||
|
(*s == '-') || (*s == '+') || (*s == ',') || (*s == '.') ||
|
||||||
|
(*s == '/') || (*s == ':') || (*s == '=') || (*s == '@') ||
|
||||||
|
(*s == '^')))
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (*s == 0)
|
||||||
|
{
|
||||||
|
char *rfk = strdup(cmd);
|
||||||
|
if (rfk)
|
||||||
|
{
|
||||||
|
char *pc = strchr(rfk, ' ');
|
||||||
|
if (pc)
|
||||||
|
{
|
||||||
|
*pc = 0;
|
||||||
|
FILE *p = popen(rfk, "r");
|
||||||
|
if (p)
|
||||||
|
{
|
||||||
|
char lin[1024];
|
||||||
|
char dev[1024];
|
||||||
|
int id = -1;
|
||||||
|
|
||||||
|
while (fgets(lin, sizeof(lin), p))
|
||||||
|
{
|
||||||
|
lin[sizeof(lin) - 1] = 0;
|
||||||
|
if (sscanf(lin, "%i %*s %s %*s %*s", &id, dev) != 2)
|
||||||
|
id = -1;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (!strcmp(dev, output)) break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
pclose(p);
|
||||||
|
eina_strbuf_append_printf(buf, "%s %i", cmd, id);
|
||||||
|
return system(eina_strbuf_string_get(buf));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
exit(30);
|
||||||
|
}
|
||||||
|
|
||||||
if ((!test)
|
if ((!test)
|
||||||
#ifdef HAVE_EEZE_MOUNT
|
#ifdef HAVE_EEZE_MOUNT
|
||||||
&& (!mnt)
|
&& (!mnt)
|
||||||
|
|
Loading…
Reference in New Issue