Skip to contentSkip to conversation

Input Service - Support for hidd configuration

PATCH In review Daniel Gollub 3 participants 4 messages Jun 8, 2007 – Jun 22, 2007 Bluetooth drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Input Service - Support for hidd configuration

Hi,

attachted an input service patch which implements support for the hidd configuration. This is needed to have a smooth transition from hidd daemon to the new shiny input service ...

( ... and especially this is needed to be able to return from vacation back to the office - without getting blamed by Seife for not working bluetooth input devices ;P )

The patch reads the entries of hidd and stores it with store_device_info() function. The hidd doesn't get modified - this means the transition happens on every start of the input service. store_device_info() avoids duplicate entries. So there is still the possibility to have a working bluetooth input device when falling back to hidd.

best regards,
Daniel

manager.c +25 -2
@@ -959,6 +959,23 @@ static void stored_input(char *key, char
 	device_paths = g_slist_append(device_paths, g_strdup(path));
 }
 
+/* hidd to input transition function */
+static void stored_hidd(char *key, char *value, void *data)
+{
+	const char *path;
+	struct hidp_connadd_req hidp; 
+	bdaddr_t dst, *src = data;
+
+	str2ba(key, &dst);
+
+	memset(&hidp, 0, sizeof(struct hidp_connadd_req));
+
+	if (parse_stored_device_info(value, &hidp) < 0)
+		return;
+
+	store_device_info(src, &dst, &hidp);
+}
+
 static void register_stored_inputs(void)
 {
 	char dirname[PATH_MAX + 1];
@@ -977,10 +994,16 @@ static void register_stored_inputs(void)
 		if (!isdigit(de->d_name[0]))
 			continue;
 
+		str2ba(de->d_name, &src);
+
+		/* move the hidd entries to the input storage */
 		create_name(filename, PATH_MAX, STORAGEDIR,
-						de->d_name, "input");
+						de->d_name, "hidd");
+		textfile_foreach(filename, stored_hidd, &src);
 
-		str2ba(de->d_name, &src);
+		/* load the input stored devices */
+		create_name(filename, PATH_MAX, STORAGEDIR,
+						de->d_name, "input");
 
 		textfile_foreach(filename, stored_input, &src);
 	}

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/

_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel

#1 lore raw

Hi Daniel,
This is Mo from Canada, I was looking for a developer to develop a bluetooth application over this board (http://acmesystems.it/?id=4)
The target from this project is to build a bluetooth marketing solution along with interactivity with cell phone users and I was wondering if you are interested in such project or not, and if you have any contact who might be interested
Regards,
Mo.

Quoted 25 lines · Daniel Gollub

Hi,

attachted an input service patch which implements support for the hidd configuration. This is needed to have a smooth transition from hidd daemon to
the new shiny input service ...

( ... and especially this is needed to be able to return from vacation back to
the office - without getting blamed by Seife for not working bluetooth input
devices ;P )

The patch reads the entries of hidd and stores it with store_device_info() function. The hidd doesn't get modified - this means the transition happens
on every start of the input service. store_device_info() avoids duplicate entries. So there is still the possibility to have a working bluetooth input
device when falling back to hidd.

best regards,
Daniel

Quoted 12 lines

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Bluez-devel mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/

_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel

maintainer
#2 lore raw
In reply to Daniel Gollub

Hi Daniel,

Quoted 8 lines

attachted an input service patch which implements support for the hidd configuration. This is needed to have a smooth transition from hidd daemon to the new shiny input service ...

( ... and especially this is needed to be able to return from vacation back to the office - without getting blamed by Seife for not working bluetooth input devices ;P )

Quoted 5 lines

The patch reads the entries of hidd and stores it with store_device_info() function. The hidd doesn't get modified - this means the transition happens on every start of the input service. store_device_info() avoids duplicate entries. So there is still the possibility to have a working bluetooth input device when falling back to hidd.

if I read this correctly, then a hidd entry would overwrite a input entry. We can't let that happen.

Also the format of hidd and input is different, but you are using the same function to parse it.

Regards

Marcel

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Bluez-devel mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel

#3 lore raw
In reply to Daniel Gollub
Quoted 10 lines · Daniel Gollub

Hi,

attachted an input service patch which implements support for the hidd configuration. This is needed to have a smooth transition from hidd daemon to the new shiny input service ...

( ... and especially this is needed to be able to return from vacation back to the office - without getting blamed by Seife for not working bluetooth input devices ;P )

Quoted 5 lines

The patch reads the entries of hidd and stores it with store_device_info() function. The hidd doesn't get modified - this means the transition happens on every start of the input service. store_device_info() avoids duplicate entries. So there is still the possibility to have a working bluetooth input device when falling back to hidd.

Fixed some discussed issues of the hidd config patch:

- Only transfer entry from hidd config to input if there isn't already a entry of the device in input config
- Added parsing function for hidd config format (input format changed)

Patch attachted.

best regards,
Daniel

Index: input/manager.c
===================================================================
RCS file: /cvsroot/bluez/utils/input/manager.c,v
retrieving revision 1.26

manager.c +27 -2
diff -u -p -r1.26 manager.c
@@ -962,6 +962,25 @@ cleanup:
 		g_free(hidp.rd_data);
 }
 
+/* hidd to input transition function */
+static void stored_hidd(char *key, char *value, void *data)
+{
+	struct hidp_connadd_req hidp; 
+	bdaddr_t dst, *src = data;
+
+	str2ba(key, &dst);
+
+	if (input_device_stored(src, &dst) > 0)
+		return;
+
+	memset(&hidp, 0, sizeof(struct hidp_connadd_req));
+
+	if (parse_stored_hidd(value, &hidp) < 0)
+		return;
+
+	store_device_info(src, &dst, &hidp);
+}
+
 static void register_stored_inputs(void)
 {
 	char dirname[PATH_MAX + 1];
@@ -980,10 +999,16 @@ static void register_stored_inputs(void)
 		if (!isdigit(de->d_name[0]))
 			continue;
 
+		str2ba(de->d_name, &src);
+
+		/* move the hidd entries to the input storage */
 		create_name(filename, PATH_MAX, STORAGEDIR,
-						de->d_name, "input");
+						de->d_name, "hidd");
+		textfile_foreach(filename, stored_hidd, &src);
 
-		str2ba(de->d_name, &src);
+		/* load the input stored devices */
+		create_name(filename, PATH_MAX, STORAGEDIR,
+						de->d_name, "input");
 
 		textfile_foreach(filename, stored_input, &src);
 	}

Index: input/storage.c
===================================================================
RCS file: /cvsroot/bluez/utils/input/storage.c,v
retrieving revision 1.10

storage.c +64 -0

70 lines not on this page · raw message

Index: input/storage.h
===================================================================
RCS file: /cvsroot/bluez/utils/input/storage.h,v
retrieving revision 1.6

storage.h +3 -0
diff -u -p -r1.6 storage.h
@@ -21,6 +21,8 @@
  *
  */
 
+int input_device_stored(bdaddr_t *src, bdaddr_t *dst);
+
 int get_stored_device_info(bdaddr_t *src, bdaddr_t *dst,
 				struct hidp_connadd_req *req);
 
@@ -29,6 +31,7 @@ int del_stored_device_info(bdaddr_t *src
 int store_device_info(bdaddr_t *src, bdaddr_t *dst,
 				struct hidp_connadd_req *req);
 
+int parse_stored_hidd(const char *str, struct hidp_connadd_req *req);
 int parse_stored_device_info(const char *str,
 				struct hidp_connadd_req *req);
 

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/

_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel