* toshiba_acpi bluetooth patch
@ 2007-08-09 16:13 kernellist
2007-08-10 15:44 ` Robert M. Albrecht
0 siblings, 1 reply; 3+ messages in thread
From: kernellist @ 2007-08-09 16:13 UTC (permalink / raw)
To: linux-acpi
[-- Attachment #1: Type: text/plain, Size: 324 bytes --]
Hi,
Some Toshiba Portege laptops needs bluetooth to be enabled, before it can be used. Since some time there are some patches to do it. (see: http://glozer.net/dynabook/dynabook.html)
I made some cleanings and make it work with recent kernels. See attatchment - any comments are welcome!
regards,
Marek Hobler, 'neutrinus'
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: toshiba_acpi.patch --]
[-- Type: text/x-patch; name="toshiba_acpi.patch", Size: 3098 bytes --]
36c35
< #define TOSHIBA_ACPI_VERSION "0.18"
---
> #define TOSHIBA_ACPI_VERSION "0.18-p4"
92a92,96
> #define HCI_WIRELESS 0x0056
> #define HCI_BT_POWER 0x0080
> #define HCI_BT_ATTACH 0x0040
> #define HCI_BT_ORINOCO 0x0200
>
203a208,218
>
> static acpi_status hci_write2(u32 reg, u32 in1, u32 in2, u32* result)
> {
> u32 in[HCI_WORDS] = { HCI_SET, reg, in1, in2, 0, 0 };
> u32 out[HCI_WORDS];
> acpi_status status = hci_raw(in, out);
> *result = (status == AE_OK) ? out[0] : HCI_FAILURE;
> return status;
> }
>
>
213a229,241
> static acpi_status hci_read2(u32 reg, u32* out1, u32* out2, u32* result)
> {
> u32 in[HCI_WORDS] = { HCI_GET, reg, *out1, *out2, 0, 0 };
> u32 out[HCI_WORDS];
> acpi_status status = hci_raw(in, out);
> *out1 = out[2];
> *out2 = out[3];
> *result = (status == AE_OK) ? out[0] : HCI_FAILURE;
> return status;
> }
>
>
>
484a513,581
> static char* read_wk(char* p)
> {
> u32 hci_result;
> u32 value = 0;
> u32 value2 = 0;
> hci_read2(HCI_WIRELESS, &value, &value2, &hci_result);
> if (hci_result == HCI_SUCCESS) {
> p += sprintf(p,"wireless key: %d\n", value );
> } else {
> p += sprintf(p, "ERROR\n");
> }
>
> return p;
> }
>
> static char* read_bt(char* p)
> {
> u32 hci_result;
> u32 value = 0;
> u32 value2 = 0;
>
> hci_read2(HCI_WIRELESS, &value, &value2, &hci_result);
> if (hci_result == HCI_SUCCESS) {
> p += sprintf(p,"present: %d\n", (value & 0x0f)?1:0);
> } else {
> p += sprintf(p, "ERROR\n");
> }
> value = 0;
> value2 = 0x0001;
> hci_read2(HCI_WIRELESS, &value, &value2, &hci_result);
> if (hci_result == HCI_SUCCESS) {
> p += sprintf(p,"power: %d\n", (value & 128) >> 7);
> p += sprintf(p,"attach: %d\n", (value & 64) >> 6);
> p += sprintf(p,"wireless: %d\n", (value & 512) >> 9);
> } else {
> p += sprintf(p, "ERROR\n");
> }
>
> return p;
> }
>
> static unsigned long write_bt(const char* buffer, unsigned long count)
> {
> int value;
> u32 hci_result;
>
> if (sscanf(buffer, " power : %i", &value) == 1 &&
> value >= 0 && value <= 1) {
> hci_write2(HCI_WIRELESS, value, HCI_BT_POWER, &hci_result);
> if (hci_result != HCI_SUCCESS)
> return -EFAULT;
> } else if (sscanf(buffer, " attach : %i", &value) == 1 &&
> value >= 0 && value <= 1) {
> hci_write2(HCI_WIRELESS, value, HCI_BT_ATTACH, &hci_result);
> if (hci_result != HCI_SUCCESS)
> return -EFAULT;
> } else if (sscanf(buffer, " orinoco : %i", &value) == 1 &&
> value >= 0 && value <= 1) {
> hci_write2(HCI_WIRELESS, value, HCI_BT_ORINOCO, &hci_result);
> if (hci_result != HCI_SUCCESS)
> return -EFAULT;
> } else {
> return -EINVAL;
> }
>
> return count;
> }
>
>
503a601,602
> {"wireless_key", read_wk, NULL },
> {"bluetooth", read_bt, write_bt },
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: toshiba_acpi bluetooth patch
2007-08-09 16:13 toshiba_acpi bluetooth patch kernellist
@ 2007-08-10 15:44 ` Robert M. Albrecht
0 siblings, 0 replies; 3+ messages in thread
From: Robert M. Albrecht @ 2007-08-10 15:44 UTC (permalink / raw)
To: kernellist; +Cc: linux-acpi
Hi,
getting this patch into the kernel would be great.
I use the toshbt tool from
http://0bits.com/?q=node/6
to enable Bluetooth on my Toshiba Tecra S3, but getting it upstream
would make things easier to maintain.
Anything I can help ?
cu romal
kernellist@neutrinus.com schrieb:
> Hi,
> Some Toshiba Portege laptops needs bluetooth to be enabled, before it can be used. Since some time there are some patches to do it. (see: http://glozer.net/dynabook/dynabook.html)
>
> I made some cleanings and make it work with recent kernels. See attatchment - any comments are welcome!
>
> regards,
> Marek Hobler, 'neutrinus'
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: toshiba_acpi bluetooth patch
@ 2007-08-12 18:22 Marek Hobler
0 siblings, 0 replies; 3+ messages in thread
From: Marek Hobler @ 2007-08-12 18:22 UTC (permalink / raw)
To: linux-acpi; +Cc: romal
> getting this patch into the kernel would be great.
yeah, but we need more pople to test this patch.
> Anything I can help ?
test, test and test :)
to enable bluetooth just check that the wireless_kill_switch is _off_ and run:
echo "power:1" > /proc/acpi/toshiba/bluetooth
echo "attach:1" > /proc/acpi/toshiba/bluetooth
regards,
Marek Hobler, 'neutrinus'
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2007-08-12 18:19 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-08-09 16:13 toshiba_acpi bluetooth patch kernellist
2007-08-10 15:44 ` Robert M. Albrecht
-- strict thread matches above, loose matches on Subject: below --
2007-08-12 18:22 Marek Hobler
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).