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

* Re: [Bluez-devel] [PATCH] HIDD: add psm offset possibilty
  2008-03-26 14:50 [PATCH] HIDD: add psm offset possibilty Jiri Slaby
@ 2008-03-26 16:18 ` Marcel Holtmann
  2008-03-26 16:26   ` Jiri Slaby
  0 siblings, 1 reply; 5+ messages in thread
From: Marcel Holtmann @ 2008-03-26 16:18 UTC (permalink / raw)
  To: Jiri Slaby; +Cc: bluez-devel, Maxim Krasnyansky

Hi Jiri,

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

you have to explain why this is needed and useful since even creating  
the HID device needs root capabilities.

And why for example using the input service with its D-Bus API is not  
working for you.

Regards

Marcel


-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
_______________________________________________
Bluez-devel mailing list
Bluez-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bluez-devel

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

* Re: [PATCH] HIDD: add psm offset possibilty
  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
  0 siblings, 1 reply; 5+ messages in thread
From: Jiri Slaby @ 2008-03-26 16:26 UTC (permalink / raw)
  To: Marcel Holtmann; +Cc: Maxim Krasnyansky, bluez-devel

On 03/26/2008 05:18 PM, Marcel Holtmann wrote:
> Hi Jiri,
> 
>> This feature allows using cell phones as remote controllers, because it
>> usually denies to bind psms lower than 0x1000.
> 
> you have to explain why this is needed and useful since even creating 
> the HID device needs root capabilities.
> 
> And why for example using the input service with its D-Bus API is not 
> working for you.

Sorry, I wasn't clear enough.

The daemon runs on standard PC, and on mobile phone there is an java application 
(on whatever platform) which can bind only psms >= 0x1000 (on most phones). So 
to allow taking control of hid by a cell phone, hidd must listen on odd psms >= 
0x1000 (i use hidd --server on pc, java-client in my current application [1]).

[1] http://decibel.fi.muni.cz/cgi-bin/gitweb.cgi?p=l2cap.git;a=summary

regards,
--js

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

* Re: [Bluez-devel] [PATCH] HIDD: add psm offset possibilty
  2008-03-26 16:26   ` Jiri Slaby
@ 2008-03-26 16:33     ` Marcel Holtmann
  2008-03-26 16:37       ` Jiri Slaby
  0 siblings, 1 reply; 5+ messages in thread
From: Marcel Holtmann @ 2008-03-26 16:33 UTC (permalink / raw)
  To: Jiri Slaby; +Cc: bluez-devel, Maxim Krasnyansky

Hi Jiri,

>>> This feature allows using cell phones as remote controllers,  
>>> because it
>>> usually denies to bind psms lower than 0x1000.
>> you have to explain why this is needed and useful since even  
>> creating the HID device needs root capabilities.
>> And why for example using the input service with its D-Bus API is  
>> not working for you.
>
> Sorry, I wasn't clear enough.
>
> The daemon runs on standard PC, and on mobile phone there is an java  
> application (on whatever platform) which can bind only psms >=  
> 0x1000 (on most phones). So to allow taking control of hid by a cell  
> phone, hidd must listen on odd psms >= 0x1000 (i use hidd --server  
> on pc, java-client in my current application [1]).

okay, but the offset is too hackish. Simply provide two options to  
overwrite the PSM value for control and interrupt channels.

Regards

Marcel


-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
_______________________________________________
Bluez-devel mailing list
Bluez-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bluez-devel

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

* Re: [PATCH] HIDD: add psm offset possibilty
  2008-03-26 16:33     ` [Bluez-devel] " Marcel Holtmann
@ 2008-03-26 16:37       ` Jiri Slaby
  0 siblings, 0 replies; 5+ messages in thread
From: Jiri Slaby @ 2008-03-26 16:37 UTC (permalink / raw)
  To: Marcel Holtmann; +Cc: Maxim Krasnyansky, bluez-devel

On 03/26/2008 05:33 PM, Marcel Holtmann wrote:
>>>> This feature allows using cell phones as remote controllers, because it
>>>> usually denies to bind psms lower than 0x1000.
>>> you have to explain why this is needed and useful since even creating 
>>> the HID device needs root capabilities.
>>> And why for example using the input service with its D-Bus API is not 
>>> working for you.
>>
>> Sorry, I wasn't clear enough.
>>
>> The daemon runs on standard PC, and on mobile phone there is an java 
>> application (on whatever platform) which can bind only psms >= 0x1000 
>> (on most phones). So to allow taking control of hid by a cell phone, 
>> hidd must listen on odd psms >= 0x1000 (i use hidd --server on pc, 
>> java-client in my current application [1]).
> 
> okay, but the offset is too hackish. Simply provide two options to 
> overwrite the PSM value for control and interrupt channels.

:) okay, thanks.

^ 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).