summaryrefslogtreecommitdiff
path: root/src/rfkill.c
diff options
context:
space:
mode:
authorMarcel Holtmann <marcel@holtmann.org>2010-01-26 08:16:47 +0100
committerMarcel Holtmann <marcel@holtmann.org>2010-01-26 08:16:47 +0100
commit03cd2c324472088e5dbd2d7e7998cefabe15335a (patch)
tree1b1276858fa0c8d29be828c4eb9f164147851a62 /src/rfkill.c
parentf87a0929056d12adfd1e29e77e52b24eb8c5bb26 (diff)
downloadconnman-03cd2c324472088e5dbd2d7e7998cefabe15335a.tar.gz
connman-03cd2c324472088e5dbd2d7e7998cefabe15335a.tar.bz2
connman-03cd2c324472088e5dbd2d7e7998cefabe15335a.zip
Add available RFKILL switches to list of technologies
Diffstat (limited to 'src/rfkill.c')
-rw-r--r--src/rfkill.c42
1 files changed, 39 insertions, 3 deletions
diff --git a/src/rfkill.c b/src/rfkill.c
index f68ee0eb..37923054 100644
--- a/src/rfkill.c
+++ b/src/rfkill.c
@@ -39,6 +39,8 @@ enum rfkill_type {
RFKILL_TYPE_UWB,
RFKILL_TYPE_WIMAX,
RFKILL_TYPE_WWAN,
+ RFKILL_TYPE_GPS,
+ RFKILL_TYPE_FM,
};
enum rfkill_operation {
@@ -56,12 +58,29 @@ struct rfkill_event {
uint8_t hard;
};
+static enum connman_service_type convert_type(uint8_t type)
+{
+ switch (type) {
+ case RFKILL_TYPE_WLAN:
+ return CONNMAN_SERVICE_TYPE_WIFI;
+ case RFKILL_TYPE_BLUETOOTH:
+ return CONNMAN_SERVICE_TYPE_BLUETOOTH;
+ case RFKILL_TYPE_WIMAX:
+ return CONNMAN_SERVICE_TYPE_WIMAX;
+ case RFKILL_TYPE_WWAN:
+ return CONNMAN_SERVICE_TYPE_CELLULAR;
+ }
+
+ return CONNMAN_SERVICE_TYPE_UNKNOWN;
+}
+
static GIOStatus rfkill_process(GIOChannel *chan)
{
GIOStatus status = G_IO_STATUS_NORMAL;
unsigned char buf[32];
struct rfkill_event *event = (void *) buf;
char sysname[32];
+ enum connman_service_type type;
connman_bool_t blocked;
gsize len;
@@ -78,9 +97,26 @@ static GIOStatus rfkill_process(GIOChannel *chan)
if (len != sizeof(struct rfkill_event))
return status;
- DBG("idx %u type %u op %u soft %u hard %u",
- event->idx, event->type, event->op,
- event->soft, event->hard);
+ DBG("idx %u type %u op %u soft %u hard %u", event->idx,
+ event->type, event->op,
+ event->soft, event->hard);
+
+ switch (event->op) {
+ case RFKILL_OP_ADD:
+ type = convert_type(event->type);
+ __connman_technology_add_rfkill(event->idx, type,
+ event->soft, event->hard);
+ break;
+ case RFKILL_OP_DEL:
+ __connman_technology_remove_rfkill(event->idx);
+ break;
+ case RFKILL_OP_CHANGE:
+ __connman_technology_update_rfkill(event->idx, event->soft,
+ event->hard);
+ break;
+ default:
+ break;
+ }
snprintf(sysname, sizeof(sysname) - 1, "rfkill%d", event->idx);