Thread (17 messages) 17 messages, 2 authors, 2012-09-20

[PATCH v3 07/10] battery: Add Battery to device

flat view
STALE5137d SUPERSEDED

From: <hidden>
Date: 2012-09-20 08:27:40
Subsystem: the rest · Maintainer: Linus Torvalds

Revision v3 of 4 in this series.

Revisions (4)
  1. v1 [diff vs current]
  2. v2 [diff vs current]
  3. v3 current
  4. v4 [diff vs current]
From: Chen Ganir <redacted>

Add/Remove battery from device
---
 profiles/battery/battery.c |    5 +++++
 1 file changed, 5 insertions(+)
diff --git a/profiles/battery/battery.c b/profiles/battery/battery.c
index a3a1bb0..6a6635b 100644
--- a/profiles/battery/battery.c
+++ b/profiles/battery/battery.c
@@ -49,6 +49,7 @@ struct battery {
 static GSList *servers;
 
 struct characteristic {
+	struct btd_battery	*devbatt;	/* device_battery pointer */
 	struct gatt_char	attr;		/* Characteristic */
 	struct battery		*batt;		/* Parent Battery Service */
 	GSList			*desc;		/* Descriptors */
@@ -79,6 +80,8 @@ static void char_free(gpointer user_data)
 
 	g_slist_free_full(c->desc, g_free);
 
+	btd_device_remove_battery(c->devbatt);
+
 	g_free(c);
 }
 
@@ -216,6 +219,8 @@ static void configure_battery_cb(GSList *characteristics, guint8 status,
 
 			start = c->value_handle + 1;
 
+			ch->devbatt = btd_device_add_battery(ch->batt->dev);
+
 			if (l->next != NULL) {
 				struct gatt_char *c = l->next->data;
 				if (start == c->handle)
-- 
1.7.9.5
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help