Skip to contentSkip to conversation

Add some device types

PATCH In review Bastien Nocera 2 participants 2 messages Mar 5, 2008 – Mar 6, 2008 Bluetooth drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Add some device types

Heya,

A patch to add tablets and joypads/joysticks to client.c.

I'm currently reworking the device filter to suck a bit less.

Cheers

Index: client.c
===================================================================
RCS file: /cvsroot/bluez/gnome/common/client.c,v
retrieving revision 1.41

client.c +18 -1
diff -u -p -u -p -r1.41 client.c
@@ -137,6 +137,10 @@ const gchar *bluetooth_type_to_string(gu
 		return N_("Camera");
 	case BLUETOOTH_TYPE_PRINTER:
 		return N_("Printer");
+	case BLUETOOTH_TYPE_JOYPAD:
+		return N_("Joypad");
+	case BLUETOOTH_TYPE_TABLET:
+		return N_("Tablet");
 	default:
 		return N_("Unknown");
 	}
@@ -163,15 +167,28 @@ static guint class_to_type(guint32 class
 	case 0x04:
 		switch ((class & 0xfc) >> 2) {
 		case 0x01:
+		case 0x02:
 			return BLUETOOTH_TYPE_HEADSET;
 		}
 		break;
 	case 0x05:
 		switch ((class & 0xc0) >> 6) {
+		case 0x00:
+			switch ((class & 0x1e) >> 2) {
+			case 0x01:
+			case 0x02:
+				return BLUETOOTH_TYPE_JOYPAD;
+			}
+			break;
 		case 0x01:
 			return BLUETOOTH_TYPE_KEYBOARD;
 		case 0x02:
-			return BLUETOOTH_TYPE_MOUSE;
+			switch ((class & 0x1e) >> 2) {
+			case 0x05:
+				return BLUETOOTH_TYPE_TABLET;
+			default:
+				return BLUETOOTH_TYPE_MOUSE;
+			}
 		}
 		break;
 	case 0x06:

Index: client.h
===================================================================
RCS file: /cvsroot/bluez/gnome/common/client.h,v
retrieving revision 1.23

client.h +4 -2
diff -u -p -u -p -r1.23 client.h
@@ -86,10 +86,12 @@ enum {
 	BLUETOOTH_TYPE_KEYBOARD   = 1 << 6,
 	BLUETOOTH_TYPE_MOUSE      = 1 << 7,
 	BLUETOOTH_TYPE_CAMERA     = 1 << 8,
-	BLUETOOTH_TYPE_PRINTER    = 1 << 9 
+	BLUETOOTH_TYPE_PRINTER    = 1 << 9,
+	BLUETOOTH_TYPE_JOYPAD     = 1 << 10,
+	BLUETOOTH_TYPE_TABLET     = 1 << 11,
 };
 
-#define BLUETOOTH_TYPE_NUM_TYPES 10
+#define BLUETOOTH_TYPE_NUM_TYPES 12
 #define BLUETOOTH_TYPE_INPUT (BLUETOOTH_TYPE_KEYBOARD | BLUETOOTH_TYPE_MOUSE)
 
 const gchar *bluetooth_type_to_string(guint type);

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/

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

maintainer
#1 lore raw

Hi Bastien,

Quoted 1 line

A patch to add tablets and joypads/joysticks to client.c.

patch has been applied. Thanks.

Quoted 1 line

I'm currently reworking the device filter to suck a bit less.

Great.

Regards

Marcel

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Bluez-devel mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel