* [PATCH] Add udev rule for Ralink WiFi+BT module w/ bccmd
@ 2012-03-19 4:41 Eric Miao
2012-03-19 17:37 ` Marcel Holtmann
0 siblings, 1 reply; 4+ messages in thread
From: Eric Miao @ 2012-03-19 4:41 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Eric Miao
Some Ralink WiFi + CSR BT module needs bluetooth radio to be
turned on explicitly with bccmd by the following command:
bccmd psset -r 0x028c 0x0001
The HCI will be probed successfully, but due to the default
OFF state of the radio, no scan or connection can be made.
This patch adds the udev rule so that once the HCI is up,
udev will invoke bccmd with warm reset to turn on the radio.
[1] https://bugs.launchpad.net/bugs/781556
[2] https://bugs.meego.com/show_bug.cgi?id=3498
[3] http://ubuntuforums.org/showthread.php?t=1776108
[4] http://ubuntuforums.org/showthread.php?t=1703941
Signed-off-by: Eric Miao <eric.miao@canonical.com>
---
.gitignore | 1 +
Makefile.am | 7 ++++++-
scripts/bluetooth-bccmd.rules | 12 ++++++++++++
3 files changed, 19 insertions(+), 1 deletions(-)
create mode 100644 scripts/bluetooth-bccmd.rules
diff --git a/.gitignore b/.gitignore
index 137d2e5..accff4b 100644
--- a/.gitignore
+++ b/.gitignore
@@ -39,6 +39,7 @@ sap/sap.c
scripts/bluetooth.rules
scripts/97-bluetooth.rules
scripts/97-bluetooth-hid2hci.rules
+scripts/97-bluetooth-bccmd.rules
sbc/sbcdec
sbc/sbcenc
diff --git a/Makefile.am b/Makefile.am
index bd587eb..b0145dc 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -406,6 +406,10 @@ if HID2HCI
udev_files += scripts/bluetooth-hid2hci.rules
endif
+if BCCMD
+udev_files += scripts/bluetooth-bccmd.rules
+endif
+
if PCMCIA
udevdir = @UDEV_DIR@
@@ -420,7 +424,8 @@ endif
CLEANFILES += $(rules_DATA)
EXTRA_DIST += scripts/bluetooth.rules \
- scripts/bluetooth-hid2hci.rules scripts/bluetooth-serial.rules
+ scripts/bluetooth-hid2hci.rules scripts/bluetooth-serial.rules \
+ scripts/bluetooth-bccmd.rules
EXTRA_DIST += doc/manager-api.txt \
doc/adapter-api.txt doc/device-api.txt \
diff --git a/scripts/bluetooth-bccmd.rules b/scripts/bluetooth-bccmd.rules
new file mode 100644
index 0000000..e654abf
--- /dev/null
+++ b/scripts/bluetooth-bccmd.rules
@@ -0,0 +1,12 @@
+# do not edit this file, it will be overwritten on update
+
+ACTION!="add", GOTO="bccmd_end"
+SUBSYSTEM!="bluetooth", GOTO="bccmd_end"
+
+# Some bluetooth modules require special bccmd parameters to be set
+
+# Ralink RT5390 + CSR BS8510 WiFi/BT Combo cards on some HP laptops,
+# they need to explicitly turn on the radio followed by a warm reset
+SUBSYSTEM=="bluetooth", SUBSYSTEMS=="usb", ATTRS{idVendor}=="148f", ATTRS{idProduct}=="2000|1000", RUN+="/usr/sbin/bccmd -d $kernel psset -r 0x028c 0x0001"
+
+LABEL="bccmd_end"
--
1.7.9.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] Add udev rule for Ralink WiFi+BT module w/ bccmd
2012-03-19 4:41 [PATCH] Add udev rule for Ralink WiFi+BT module w/ bccmd Eric Miao
@ 2012-03-19 17:37 ` Marcel Holtmann
2012-03-20 1:55 ` Eric Miao
0 siblings, 1 reply; 4+ messages in thread
From: Marcel Holtmann @ 2012-03-19 17:37 UTC (permalink / raw)
To: Eric Miao; +Cc: linux-bluetooth
Hi Eric,
> Some Ralink WiFi + CSR BT module needs bluetooth radio to be
> turned on explicitly with bccmd by the following command:
>
> bccmd psset -r 0x028c 0x0001
>
> The HCI will be probed successfully, but due to the default
> OFF state of the radio, no scan or connection can be made.
> This patch adds the udev rule so that once the HCI is up,
> udev will invoke bccmd with warm reset to turn on the radio.
>
> [1] https://bugs.launchpad.net/bugs/781556
> [2] https://bugs.meego.com/show_bug.cgi?id=3498
> [3] http://ubuntuforums.org/showthread.php?t=1776108
> [4] http://ubuntuforums.org/showthread.php?t=1703941
why are we doing this in userspace? The btusb.c driver has the option
for pre-execution HCI commands queue. Why not use that one.
Also why -r. Meaning why do we need a warmreset? And where is the magic
0x028c PS key coming from? Does anybody actually know what it is doing?
Regards
Marcel
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] Add udev rule for Ralink WiFi+BT module w/ bccmd
2012-03-19 17:37 ` Marcel Holtmann
@ 2012-03-20 1:55 ` Eric Miao
2012-03-20 14:36 ` Eric Miao
0 siblings, 1 reply; 4+ messages in thread
From: Eric Miao @ 2012-03-20 1:55 UTC (permalink / raw)
To: Marcel Holtmann; +Cc: linux-bluetooth
On Tue, Mar 20, 2012 at 1:37 AM, Marcel Holtmann <marcel@holtmann.org> wrot=
e:
> Hi Eric,
>
>> Some Ralink WiFi + CSR BT module needs bluetooth radio to be
>> turned on explicitly with bccmd by the following command:
>>
>> =C2=A0 bccmd psset -r 0x028c 0x0001
>>
>> The HCI will be probed successfully, but due to the default
>> OFF state of the radio, no scan or connection can be made.
>> This patch adds the udev rule so that once the HCI is up,
>> udev will invoke bccmd with warm reset to turn on the radio.
>>
>> [1] https://bugs.launchpad.net/bugs/781556
>> [2] https://bugs.meego.com/show_bug.cgi?id=3D3498
>> [3] http://ubuntuforums.org/showthread.php?t=3D1776108
>> [4] http://ubuntuforums.org/showthread.php?t=3D1703941
>
> why are we doing this in userspace? The btusb.c driver has the option
> for pre-execution HCI commands queue. Why not use that one.
That sounds like a better one, I'll take a look and see if it's possible
to give a revised version. Thanks Marcel.
>
> Also why -r. Meaning why do we need a warmreset? And where is the magic
> 0x028c PS key coming from? Does anybody actually know what it is doing?
The magic came from Ralink FAE actually and it was verified to work
by various people. It was believed it's the bit to turn the radio ON/OFF.
And a warmreset ensures that radio will be ON instantly, other than a
system boot. I'm afraid there is no public documentation about this,
I didn't even find this bit in the CSR BCCMD firmware notes of CSR8510,
could be a vendor specific bit.
>
> Regards
>
> Marcel
>
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] Add udev rule for Ralink WiFi+BT module w/ bccmd
2012-03-20 1:55 ` Eric Miao
@ 2012-03-20 14:36 ` Eric Miao
0 siblings, 0 replies; 4+ messages in thread
From: Eric Miao @ 2012-03-20 14:36 UTC (permalink / raw)
To: Marcel Holtmann; +Cc: linux-bluetooth
On Tue, Mar 20, 2012 at 9:55 AM, Eric Miao <eric.miao@canonical.com> wrote:
> On Tue, Mar 20, 2012 at 1:37 AM, Marcel Holtmann <marcel@holtmann.org> wr=
ote:
>> Hi Eric,
>>
>>> Some Ralink WiFi + CSR BT module needs bluetooth radio to be
>>> turned on explicitly with bccmd by the following command:
>>>
>>> =C2=A0 bccmd psset -r 0x028c 0x0001
>>>
>>> The HCI will be probed successfully, but due to the default
>>> OFF state of the radio, no scan or connection can be made.
>>> This patch adds the udev rule so that once the HCI is up,
>>> udev will invoke bccmd with warm reset to turn on the radio.
>>>
>>> [1] https://bugs.launchpad.net/bugs/781556
>>> [2] https://bugs.meego.com/show_bug.cgi?id=3D3498
>>> [3] http://ubuntuforums.org/showthread.php?t=3D1776108
>>> [4] http://ubuntuforums.org/showthread.php?t=3D1703941
>>
>> why are we doing this in userspace? The btusb.c driver has the option
>> for pre-execution HCI commands queue. Why not use that one.
>
> That sounds like a better one, I'll take a look and see if it's possible
> to give a revised version. Thanks Marcel.
Hmm... have thought about this twice, and I still prefer the bccmd
command in user space. Converting this very straight-forward setting
w/ bccmd into HCI commands would make it rather awkward.
And so the further question would be the bluetooth-hid2hcd.rules,
will this file gradually disappear and the necessary operations be
made into the kernel code eventually?
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2012-03-20 14:36 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-03-19 4:41 [PATCH] Add udev rule for Ralink WiFi+BT module w/ bccmd Eric Miao
2012-03-19 17:37 ` Marcel Holtmann
2012-03-20 1:55 ` Eric Miao
2012-03-20 14:36 ` Eric Miao
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).