* how to set PSCAN mode in .conf? @ 2014-10-20 12:56 Jeff Chua 2014-10-20 13:27 ` Marcel Holtmann 0 siblings, 1 reply; 13+ messages in thread From: Jeff Chua @ 2014-10-20 12:56 UTC (permalink / raw) To: linux-bluetooth latest bluez doesn't read hcid.conf, so how can I enable "pscan" in the conf file? I know "hciconfig hci0 pscan" works, but I would still like to set that via the .conf file. Thanks, Jeff ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: how to set PSCAN mode in .conf? 2014-10-20 12:56 how to set PSCAN mode in .conf? Jeff Chua @ 2014-10-20 13:27 ` Marcel Holtmann 2014-10-20 15:23 ` Jeff Chua 0 siblings, 1 reply; 13+ messages in thread From: Marcel Holtmann @ 2014-10-20 13:27 UTC (permalink / raw) To: Jeff Chua; +Cc: linux-bluetooth Hi Jeff, > latest bluez doesn't read hcid.conf, so how can I enable "pscan" in > the conf file? > > I know "hciconfig hci0 pscan" works, but I would still like to set > that via the .conf file. the mgmt interface has a connectable option and with BlueZ 5 that will be enabled by default for < 3.17 kernel. With >= 3.17 kernels the kernel automatically enables it based on our BR/EDR device list. Regards Marcel ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: how to set PSCAN mode in .conf? 2014-10-20 13:27 ` Marcel Holtmann @ 2014-10-20 15:23 ` Jeff Chua 2014-10-20 15:59 ` Marcel Holtmann 0 siblings, 1 reply; 13+ messages in thread From: Jeff Chua @ 2014-10-20 15:23 UTC (permalink / raw) To: Marcel Holtmann; +Cc: linux-bluetooth On Mon, Oct 20, 2014 at 9:27 PM, Marcel Holtmann <marcel@holtmann.org> wrote: > Hi Jeff, > >> latest bluez doesn't read hcid.conf, so how can I enable "pscan" in >> the conf file? >> >> I know "hciconfig hci0 pscan" works, but I would still like to set >> that via the .conf file. > > the mgmt interface has a connectable option and with BlueZ 5 that will be enabled by default for < 3.17 kernel. With >= 3.17 kernels the kernel automatically enables it based on our BR/EDR device list. Marcel, I'm on Linux 3.18-rc1, bluez git (a848ceb0721d9e405f9326441b1958e289c6e81f) and it's not enabling PSCAN by default. I have to manually enable it via "hciconfig hci0 pscan" or "bluetoothctl" (discoverable on). Something broken? Or something I didn't configure properly? I've tried two devices ... T: Bus=03 Lev=02 Prnt=02 Port=03 Cnt=03 Dev#= 23 Spd=12 MxCh= 0 D: Ver= 2.00 Cls=ff(vend.) Sub=01 Prot=01 MxPS=64 #Cfgs= 1 P: Vendor=0a5c ProdID=21e6 Rev= 1.12 S: Manufacturer=Broadcom Corp S: Product=BCM20702A0 S: SerialNumber=F4B7E2E95468 T: Bus=01 Lev=01 Prnt=01 Port=01 Cnt=01 Dev#= 2 Spd=12 MxCh= 0 D: Ver= 2.00 Cls=e0(wlcon) Sub=01 Prot=01 MxPS=64 #Cfgs= 1 P: Vendor=0a12 ProdID=0001 Rev=31.64 C:* #Ifs= 2 Cfg#= 1 Atr=c0 MxPwr= 0mA But on older bluez-5.21, the PSCAN and ISCAN are enabled automatically. Thanks, Jeff ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: how to set PSCAN mode in .conf? 2014-10-20 15:23 ` Jeff Chua @ 2014-10-20 15:59 ` Marcel Holtmann 2014-10-20 17:40 ` Jeff Chua 0 siblings, 1 reply; 13+ messages in thread From: Marcel Holtmann @ 2014-10-20 15:59 UTC (permalink / raw) To: Jeff Chua; +Cc: linux-bluetooth Hi Jeff, >>> latest bluez doesn't read hcid.conf, so how can I enable "pscan" in >>> the conf file? >>> >>> I know "hciconfig hci0 pscan" works, but I would still like to set >>> that via the .conf file. >> >> the mgmt interface has a connectable option and with BlueZ 5 that will be enabled by default for < 3.17 kernel. With >= 3.17 kernels the kernel automatically enables it based on our BR/EDR device list. > > Marcel, > > I'm on Linux 3.18-rc1, bluez git > (a848ceb0721d9e405f9326441b1958e289c6e81f) and it's not enabling PSCAN > by default. I have to manually enable it via "hciconfig hci0 pscan" or > "bluetoothctl" (discoverable on). > > Something broken? Or something I didn't configure properly? > > I've tried two devices ... > > T: Bus=03 Lev=02 Prnt=02 Port=03 Cnt=03 Dev#= 23 Spd=12 MxCh= 0 > D: Ver= 2.00 Cls=ff(vend.) Sub=01 Prot=01 MxPS=64 #Cfgs= 1 > P: Vendor=0a5c ProdID=21e6 Rev= 1.12 > S: Manufacturer=Broadcom Corp > S: Product=BCM20702A0 > S: SerialNumber=F4B7E2E95468 > > T: Bus=01 Lev=01 Prnt=01 Port=01 Cnt=01 Dev#= 2 Spd=12 MxCh= 0 > D: Ver= 2.00 Cls=e0(wlcon) Sub=01 Prot=01 MxPS=64 #Cfgs= 1 > P: Vendor=0a12 ProdID=0001 Rev=31.64 > C:* #Ifs= 2 Cfg#= 1 Atr=c0 MxPwr= 0mA > > > But on older bluez-5.21, the PSCAN and ISCAN are enabled automatically. this is intentionally. Starting with BlueZ 5.23 and Linux 3.17, the Page Scan state is controlled by the kernel. If you have no devices paired / configured, then it will just disable Page Scan. If you do not know about devices, then there is also no point in allowing anybody to connect. You can use the management command Add Device to add BR/EDR devices. If you add at least one device, then Page Scan will be enabled automatically by the kernel. If you want to be always connectable, then you can set the device manually connectable. Using bluetoothctl does exactly the right thing. For being discoverable, you need to be connectable and discoverable. So Page Scan and Inquiry Scan enabled. However if you do not have any paired devices and turn discoverable back off, then both will be disabled. Just try it. Pair with a device and see that Page Scan gets turn on magically. Regards Marcel ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: how to set PSCAN mode in .conf? 2014-10-20 15:59 ` Marcel Holtmann @ 2014-10-20 17:40 ` Jeff Chua 2014-10-20 18:03 ` Marcel Holtmann 2014-10-20 18:49 ` Szymon Janc 0 siblings, 2 replies; 13+ messages in thread From: Jeff Chua @ 2014-10-20 17:40 UTC (permalink / raw) To: Marcel Holtmann; +Cc: linux-bluetooth On Mon, Oct 20, 2014 at 11:59 PM, Marcel Holtmann <marcel@holtmann.org> wro= te: >> But on older bluez-5.21, the PSCAN and ISCAN are enabled automatically. > > this is intentionally. Starting with BlueZ 5.23 and Linux 3.17, the Page = Scan state is controlled by the kernel. If you have no devices paired / con= figured, then it will just disable Page Scan. If you do not know about devi= ces, then there is also no point in allowing anybody to connect. > You can use the management command Add Device to add BR/EDR devices. If y= ou add at least one device, then Page Scan will be enabled automatically by= the kernel. If you want to be always connectable, then you can set the dev= ice manually connectable. > > Using bluetoothctl does exactly the right thing. For being discoverable, = you need to be connectable and discoverable. So Page Scan and Inquiry Scan = enabled. However if you do not have any paired devices and turn discoverabl= e back off, then both will be disabled. > > Just try it. Pair with a device and see that Page Scan gets turn on magic= ally. Marcel, Excellent info that would have taken me a long time to find out! Thanks for sharing! I tried ... # btmgmt add-device -t BR/EDR -a 1 F4:B7:E2:E9:54:68 hci0: Type: BR/EDR Bus: USB BD Address: F4:B7:E2:E9:54:68 ACL MTU: 1021:8 SCO MTU: 64:1 UP RUNNING PSCAN I don't know what the actions are supposed to do, but "-a 1" works. Next I tried "connectable" but "info" still didn't show the connectable and hciconfig didn't show ISCAN. # btmgmt connectable F4:B7:E2:E9:54:68 hci0 Set Connectable complete, settings: powered bondable ssp br/edr le # btmgmt info hci0: addr F4:B7:E2:E9:54:68 version 6 manufacturer 15 class 0x000000 supported settings: powered connectable fast-connectable discoverable bondable link-security ssp br/edr hs le advertising debug-keys privacy configuration current settings: powered bondable ssp br/edr le But if I use bluetoothctl "discoverable on", ISCAN showed up on hciconfig. And one last thing ... if I put btmgmt in a script and run it right up hciconfig hci0 up, the command would not work. A minimum of "sleep 1" is required. So, what's the best way to set the device to be always discoverable? And I need this because the "server" needs to be discoverable by the Intermec scanners. The scanner would scan a "server barcode" to connect to the server. And this was the default behavior on bluez-5.21. Thanks, Jeff. ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: how to set PSCAN mode in .conf? 2014-10-20 17:40 ` Jeff Chua @ 2014-10-20 18:03 ` Marcel Holtmann 2014-10-21 5:46 ` Jeff Chua 2014-10-20 18:49 ` Szymon Janc 1 sibling, 1 reply; 13+ messages in thread From: Marcel Holtmann @ 2014-10-20 18:03 UTC (permalink / raw) To: Jeff Chua; +Cc: linux-bluetooth Hi Jeff, >>> But on older bluez-5.21, the PSCAN and ISCAN are enabled automatically. >> >> this is intentionally. Starting with BlueZ 5.23 and Linux 3.17, the Page Scan state is controlled by the kernel. If you have no devices paired / configured, then it will just disable Page Scan. If you do not know about devices, then there is also no point in allowing anybody to connect. > >> You can use the management command Add Device to add BR/EDR devices. If you add at least one device, then Page Scan will be enabled automatically by the kernel. If you want to be always connectable, then you can set the device manually connectable. >> >> Using bluetoothctl does exactly the right thing. For being discoverable, you need to be connectable and discoverable. So Page Scan and Inquiry Scan enabled. However if you do not have any paired devices and turn discoverable back off, then both will be disabled. >> >> Just try it. Pair with a device and see that Page Scan gets turn on magically. > > Marcel, > > Excellent info that would have taken me a long time to find out! > Thanks for sharing! > > I tried ... > > # btmgmt add-device -t BR/EDR -a 1 F4:B7:E2:E9:54:68 > hci0: Type: BR/EDR Bus: USB > BD Address: F4:B7:E2:E9:54:68 ACL MTU: 1021:8 SCO MTU: 64:1 > UP RUNNING PSCAN > > I don't know what the actions are supposed to do, but "-a 1" works. actually type should be 0 for BR/EDR public address. See doc/mgmt-api.txt for the details since btmgmt maps the management interface. In short action 1 means to allow incoming connections. > Next I tried "connectable" but "info" still didn't show the > connectable and hciconfig didn't show ISCAN. > > # btmgmt connectable F4:B7:E2:E9:54:68 > hci0 Set Connectable complete, settings: powered bondable ssp br/edr le > # btmgmt info > hci0: addr F4:B7:E2:E9:54:68 version 6 manufacturer 15 class 0x000000 > supported settings: powered connectable fast-connectable > discoverable bondable link-security ssp br/edr hs le advertising > debug-keys privacy configuration > current settings: powered bondable ssp br/edr le The syntax is connectable on/off. And it should reflect it. If not, then this might be a bug. Something for Johan to look into once he gets back from vacation. Or you fix it by yourself. But I am pretty sure it actually works if you use "on" as parameter. > But if I use bluetoothctl "discoverable on", ISCAN showed up on hciconfig. Yes, that is how it is suppose to work. The D-Bus version for discoverable (which bluetoothctl uses) will internally make sure to set connectable and discoverable. So PSCAN and ISCAN should be set. > And one last thing ... if I put btmgmt in a script and run it right up > hciconfig hci0 up, the command would not work. A minimum of "sleep 1" > is required. > > So, what's the best way to set the device to be always discoverable? > And I need this because the "server" needs to be discoverable by the > Intermec scanners. The scanner would scan a "server barcode" to > connect to the server. And this was the default behavior on > bluez-5.21. Mixing btmgmt and hciconfig is not a good idea. hciconfig is for all style APIs and btmgmt is for new mgmt interfaces. For example bluetoothd only uses the mgmt interface. So my advice is to just run bluetoothd and then use the D-Bus command to make it discoverable. That will always work correctly and still is as you have seen by running bluetoothctl. It is like this kernel -> mgmt -> bluetoothd -> D-Bus -> bluetoothctl. And you can replace bluetoothctl with a Python script or your own code. Regards Marcel ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: how to set PSCAN mode in .conf? 2014-10-20 18:03 ` Marcel Holtmann @ 2014-10-21 5:46 ` Jeff Chua 2014-10-21 11:06 ` Marcel Holtmann 0 siblings, 1 reply; 13+ messages in thread From: Jeff Chua @ 2014-10-21 5:46 UTC (permalink / raw) To: Marcel Holtmann; +Cc: linux-bluetooth On Tue, Oct 21, 2014 at 2:03 AM, Marcel Holtmann <marcel@holtmann.org> wrote: > See doc/mgmt-api.txt for the details since btmgmt maps the management interface. In short action 1 means to allow incoming connections. Marcel, Got it. I tried "-a 0" and it returned Invalid Parameters. But anyway, "1" is the one I needed. > Mixing btmgmt and hciconfig is not a good idea. hciconfig is for all style APIs and btmgmt is for new mgmt interfaces. For example bluetoothd only uses the mgmt interface. So my advice is to just run bluetoothd and then use the D-Bus command to make it discoverable. That will always work correctly and still is as you have seen by running bluetoothctl. > > It is like this kernel -> mgmt -> bluetoothd -> D-Bus -> bluetoothctl. And you can replace bluetoothctl with a Python script or your own code. Great advice. Thank you for sharing. Jeff. ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: how to set PSCAN mode in .conf? 2014-10-21 5:46 ` Jeff Chua @ 2014-10-21 11:06 ` Marcel Holtmann 2014-10-21 16:19 ` Jeff Chua 0 siblings, 1 reply; 13+ messages in thread From: Marcel Holtmann @ 2014-10-21 11:06 UTC (permalink / raw) To: Jeff Chua; +Cc: linux-bluetooth Hi Jeff, >> See doc/mgmt-api.txt for the details since btmgmt maps the management interface. In short action 1 means to allow incoming connections. > > Got it. I tried "-a 0" and it returned Invalid Parameters. But anyway, > "1" is the one I needed. the documentation clearly says that action 0x00 and 0x02 are only valid for LE addresses. Action 0x01 is valid for BR/EDR and LE addresses. If anyone wants to implement action 0x00 semantics on BR/EDR, then it requires using Periodic Inquiry. It is possible, but it is not a common use case these days. Regards Marcel ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: how to set PSCAN mode in .conf? 2014-10-21 11:06 ` Marcel Holtmann @ 2014-10-21 16:19 ` Jeff Chua 2014-10-21 16:44 ` Marcel Holtmann 0 siblings, 1 reply; 13+ messages in thread From: Jeff Chua @ 2014-10-21 16:19 UTC (permalink / raw) To: Marcel Holtmann; +Cc: linux-bluetooth On Tue, Oct 21, 2014 at 7:06 PM, Marcel Holtmann <marcel@holtmann.org> wrote: > If anyone wants to implement action 0x00 semantics on BR/EDR, then it requires using Periodic Inquiry. It is possible, but it is not a common use case these days. Marcel, If that's not common, perhaps not necessary. But, I still want explore setting the "discoverable" and "connectable" in main.conf ... will you consider a patch if I work on that? I'm working on the raspberry Pi and every seconds count on the slow CPU and if these config can be set without hciconfig, it'll save another command. Currently, I'm doing this ... # { sleep 3 && hciconfig hci0 piscan 2>/dev/null; } & Thanks, Jeff. ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: how to set PSCAN mode in .conf? 2014-10-21 16:19 ` Jeff Chua @ 2014-10-21 16:44 ` Marcel Holtmann 2014-10-21 17:02 ` Jeff Chua 0 siblings, 1 reply; 13+ messages in thread From: Marcel Holtmann @ 2014-10-21 16:44 UTC (permalink / raw) To: Jeff Chua; +Cc: linux-bluetooth Hi Jeff, >> If anyone wants to implement action 0x00 semantics on BR/EDR, then it requires using Periodic Inquiry. It is possible, but it is not a common use case these days. > > Marcel, > > If that's not common, perhaps not necessary. > > But, I still want explore setting the "discoverable" and "connectable" > in main.conf ... will you consider a patch if I work on that? I'm > working on the raspberry Pi and every seconds count on the slow CPU > and if these config can be set without hciconfig, it'll save another > command. > > Currently, I'm doing this ... > # { sleep 3 && hciconfig hci0 piscan 2>/dev/null; } & I am confused why you not just use bluetoothctl (or you own tool/script) and set it. bluetoothd will enforce that setting correct for you. Regards Marcel ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: how to set PSCAN mode in .conf? 2014-10-21 16:44 ` Marcel Holtmann @ 2014-10-21 17:02 ` Jeff Chua 0 siblings, 0 replies; 13+ messages in thread From: Jeff Chua @ 2014-10-21 17:02 UTC (permalink / raw) To: Marcel Holtmann; +Cc: linux-bluetooth On Wed, Oct 22, 2014 at 12:44 AM, Marcel Holtmann <marcel@holtmann.org> wrote: >> Currently, I'm doing this ... >> # { sleep 3 && hciconfig hci0 piscan 2>/dev/null; } & > > I am confused why you not just use bluetoothctl (or you own tool/script) and set it. bluetoothd will enforce that setting correct for you. Marcel, I guess I didn't try hard enough. I just tried bluetoothctl in my script and it's working. No "sleep" needed. Thank again, Jeff. ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: how to set PSCAN mode in .conf? 2014-10-20 17:40 ` Jeff Chua 2014-10-20 18:03 ` Marcel Holtmann @ 2014-10-20 18:49 ` Szymon Janc 2014-10-21 5:53 ` Jeff Chua 1 sibling, 1 reply; 13+ messages in thread From: Szymon Janc @ 2014-10-20 18:49 UTC (permalink / raw) To: Jeff Chua; +Cc: Marcel Holtmann, linux-bluetooth Hi Jeff, On Tuesday 21 October 2014 01:40:46 Jeff Chua wrote: > On Mon, Oct 20, 2014 at 11:59 PM, Marcel Holtmann <marcel@holtmann.org> wrote: > >> But on older bluez-5.21, the PSCAN and ISCAN are enabled automatically. > > > > this is intentionally. Starting with BlueZ 5.23 and Linux 3.17, the Page > > Scan state is controlled by the kernel. If you have no devices paired / > > configured, then it will just disable Page Scan. If you do not know about > > devices, then there is also no point in allowing anybody to connect. > > > > You can use the management command Add Device to add BR/EDR devices. If > > you add at least one device, then Page Scan will be enabled automatically > > by the kernel. If you want to be always connectable, then you can set the > > device manually connectable. > > > > Using bluetoothctl does exactly the right thing. For being discoverable, > > you need to be connectable and discoverable. So Page Scan and Inquiry > > Scan enabled. However if you do not have any paired devices and turn > > discoverable back off, then both will be disabled. > > > > Just try it. Pair with a device and see that Page Scan gets turn on > > magically. > Marcel, > > Excellent info that would have taken me a long time to find out! > Thanks for sharing! > > I tried ... > > # btmgmt add-device -t BR/EDR -a 1 F4:B7:E2:E9:54:68 > hci0: Type: BR/EDR Bus: USB > BD Address: F4:B7:E2:E9:54:68 ACL MTU: 1021:8 SCO MTU: 64:1 > UP RUNNING PSCAN > > I don't know what the actions are supposed to do, but "-a 1" works. > > Next I tried "connectable" but "info" still didn't show the > connectable and hciconfig didn't show ISCAN. > > # btmgmt connectable F4:B7:E2:E9:54:68 > hci0 Set Connectable complete, settings: powered bondable ssp br/edr le Proper syntax for this would be: btmgmt -i hci0 connectable on > # btmgmt info > hci0: addr F4:B7:E2:E9:54:68 version 6 manufacturer 15 class 0x000000 > supported settings: powered connectable fast-connectable > discoverable bondable link-security ssp br/edr hs le advertising > debug-keys privacy configuration > current settings: powered bondable ssp br/edr le > > But if I use bluetoothctl "discoverable on", ISCAN showed up on hciconfig. > > And one last thing ... if I put btmgmt in a script and run it right up > hciconfig hci0 up, the command would not work. A minimum of "sleep 1" > is required. > > So, what's the best way to set the device to be always discoverable? > And I need this because the "server" needs to be discoverable by the > Intermec scanners. The scanner would scan a "server barcode" to > connect to the server. And this was the default behavior on > bluez-5.21. > > > Thanks, > Jeff. > -- > To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" > in the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html -- Szymon K. Janc szymon.janc@gmail.com ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: how to set PSCAN mode in .conf? 2014-10-20 18:49 ` Szymon Janc @ 2014-10-21 5:53 ` Jeff Chua 0 siblings, 0 replies; 13+ messages in thread From: Jeff Chua @ 2014-10-21 5:53 UTC (permalink / raw) To: Szymon Janc; +Cc: Marcel Holtmann, linux-bluetooth On Tue, Oct 21, 2014 at 2:49 AM, Szymon Janc <szymon.janc@gmail.com> wrote: > Proper syntax for this would be: > btmgmt -i hci0 connectable on Szymon, Thank you. That works! Jeff ^ permalink raw reply [flat|nested] 13+ messages in thread
end of thread, other threads:[~2014-10-21 17:02 UTC | newest] Thread overview: 13+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2014-10-20 12:56 how to set PSCAN mode in .conf? Jeff Chua 2014-10-20 13:27 ` Marcel Holtmann 2014-10-20 15:23 ` Jeff Chua 2014-10-20 15:59 ` Marcel Holtmann 2014-10-20 17:40 ` Jeff Chua 2014-10-20 18:03 ` Marcel Holtmann 2014-10-21 5:46 ` Jeff Chua 2014-10-21 11:06 ` Marcel Holtmann 2014-10-21 16:19 ` Jeff Chua 2014-10-21 16:44 ` Marcel Holtmann 2014-10-21 17:02 ` Jeff Chua 2014-10-20 18:49 ` Szymon Janc 2014-10-21 5:53 ` Jeff Chua
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).