HIDD: add psm offset possibilty
PATCH 1/1 HIDD: add psm offset possibilty
This feature allows using cell phones as remote controllers, because it usually denies to bind psms lower than 0x1000.
hidd/main.c renamed from hidd/main.c.orig +12 -3
@@ -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);
Marcel Holtmann
maintainerHi Jiri,
Quoted 3 lines
This feature allows using cell phones as remote controllers, because it
usually denies to bind psms lower than0x1000.
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel
Quoted 8 lines · Marcel Holtmann
Hi Jiri,
Quoted 2 lines
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
Marcel Holtmann
maintainerHi Jiri,
Quoted 8 lines
Quoted 7 lines
Quoted 3 lines
This feature allows using cell phones as remote controllers, because it
usually denies to bind psms lower than0x1000.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.
Quoted 7 lines
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel
Quoted 10 lines · Marcel Holtmann
Quoted 8 lines
Quoted 4 lines
Quoted 2 lines
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.