linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] HIDD: add psm offset possibilty
@ 2008-03-26 14:50 Jiri Slaby
  2008-03-26 16:18 ` [Bluez-devel] " Marcel Holtmann
  0 siblings, 1 reply; 5+ messages in thread
From: Jiri Slaby @ 2008-03-26 14:50 UTC (permalink / raw)
  To: Marcel Holtmann; +Cc: Maxim Krasnyansky, bluez-devel, Jiri Slaby

This feature allows using cell phones as remote controllers, because it
usually denies to bind psms lower than 0x1000.

--- bluez-utils-3.29/hidd/main.c.orig	2008-03-26 15:26:15.000000000 +0100
+++ bluez-utils-3.29/hidd/main.c	2008-03-26 15:26:14.000000000 +0100
@@ -694,6 +694,7 @@
 	uint32_t flags = 0;
 	uint8_t subclass = 0x00;
 	char addr[18];
+	unsigned int psm_offset = 0;
 	int log_option = LOG_NDELAY | LOG_PID;
 	int opt, ctl, csk, isk;
 	int mode = SHOW, detach = 1, nosdp = 0, nocheck = 0, bootonly = 0;
@@ -701,7 +702,7 @@
 
 	bacpy(&bdaddr, BDADDR_ANY);
 
-	while ((opt = getopt_long(argc, argv, "+i:nt:b:MEDZBHldsc:k:Ku:h", main_options, NULL)) != -1) {
+	while ((opt = getopt_long(argc, argv, "+i:nt:b:MEDZBHldsc:k:Ku:ho:", main_options, NULL)) != -1) {
 		switch(opt) {
 		case 'i':
 			if (!strncasecmp(optarg, "hci", 3))
@@ -768,6 +769,12 @@
 		case 'h':
 			usage();
 			exit(0);
+		case 'o':
+			if (!strncasecmp(optarg, "0x", 2))
+				psm_offset = strtol(optarg, NULL, 16);
+			else
+				psm_offset = atoi(optarg);
+			break;
 		default:
 			exit(0);
 		}
@@ -783,14 +790,16 @@
 
 	switch (mode) {
 	case SERVER:
-		csk = l2cap_listen(&bdaddr, L2CAP_PSM_HIDP_CTRL, lm, 10);
+		csk = l2cap_listen(&bdaddr, psm_offset + L2CAP_PSM_HIDP_CTRL,
+				lm, 10);
 		if (csk < 0) {
 			perror("Can't listen on HID control channel");
 			close(ctl);
 			exit(1);
 		}
 
-		isk = l2cap_listen(&bdaddr, L2CAP_PSM_HIDP_INTR, lm, 10);
+		isk = l2cap_listen(&bdaddr, psm_offset + L2CAP_PSM_HIDP_INTR,
+				lm, 10);
 		if (isk < 0) {
 			perror("Can't listen on HID interrupt channel");
 			close(ctl);

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2008-03-26 16:37 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-03-26 14:50 [PATCH] HIDD: add psm offset possibilty Jiri Slaby
2008-03-26 16:18 ` [Bluez-devel] " Marcel Holtmann
2008-03-26 16:26   ` Jiri Slaby
2008-03-26 16:33     ` [Bluez-devel] " Marcel Holtmann
2008-03-26 16:37       ` Jiri Slaby

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).