* [PATCH] Bluetooth: Use only 2 bits for controller type information
@ 2013-09-29 4:09 Marcel Holtmann
2013-09-29 12:59 ` Anderson Lizardo
0 siblings, 1 reply; 5+ messages in thread
From: Marcel Holtmann @ 2013-09-29 4:09 UTC (permalink / raw)
To: linux-bluetooth
The controller type is limited to BR/EDR/LE and AMP controllers. This
can be easily encoded with just 2 bits and still leave enough room
for future controller types.
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
---
net/bluetooth/hci_core.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c
index 4549b5c..ebba5a6 100644
--- a/net/bluetooth/hci_core.c
+++ b/net/bluetooth/hci_core.c
@@ -1610,7 +1610,7 @@ int hci_get_dev_info(void __user *arg)
strcpy(di.name, hdev->name);
di.bdaddr = hdev->bdaddr;
- di.type = (hdev->bus & 0x0f) | (hdev->dev_type << 4);
+ di.type = (hdev->bus & 0x0f) | ((hdev->dev_type & 0x30) << 4);
di.flags = hdev->flags;
di.pkt_type = hdev->pkt_type;
if (lmp_bredr_capable(hdev)) {
--
1.8.3.1
^ permalink raw reply related [flat|nested] 5+ messages in thread* Re: [PATCH] Bluetooth: Use only 2 bits for controller type information
2013-09-29 4:09 [PATCH] Bluetooth: Use only 2 bits for controller type information Marcel Holtmann
@ 2013-09-29 12:59 ` Anderson Lizardo
2013-09-30 4:01 ` Marcel Holtmann
0 siblings, 1 reply; 5+ messages in thread
From: Anderson Lizardo @ 2013-09-29 12:59 UTC (permalink / raw)
To: Marcel Holtmann; +Cc: BlueZ development
Hi Marcel,
On Sun, Sep 29, 2013 at 12:09 AM, Marcel Holtmann <marcel@holtmann.org> wrote:
> The controller type is limited to BR/EDR/LE and AMP controllers. This
> can be easily encoded with just 2 bits and still leave enough room
> for future controller types.
>
> Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
> ---
> net/bluetooth/hci_core.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c
> index 4549b5c..ebba5a6 100644
> --- a/net/bluetooth/hci_core.c
> +++ b/net/bluetooth/hci_core.c
> @@ -1610,7 +1610,7 @@ int hci_get_dev_info(void __user *arg)
>
> strcpy(di.name, hdev->name);
> di.bdaddr = hdev->bdaddr;
> - di.type = (hdev->bus & 0x0f) | (hdev->dev_type << 4);
> + di.type = (hdev->bus & 0x0f) | ((hdev->dev_type & 0x30) << 4);
Shouldn't it be (hdev->dev_type & 0x03) here?
Best Regards,
--
Anderson Lizardo
Instituto Nokia de Tecnologia - INdT
Manaus - Brazil
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] Bluetooth: Use only 2 bits for controller type information
2013-09-29 12:59 ` Anderson Lizardo
@ 2013-09-30 4:01 ` Marcel Holtmann
2013-09-30 11:31 ` Anderson Lizardo
0 siblings, 1 reply; 5+ messages in thread
From: Marcel Holtmann @ 2013-09-30 4:01 UTC (permalink / raw)
To: Anderson Lizardo; +Cc: BlueZ development
Hi Anderson,
>> The controller type is limited to BR/EDR/LE and AMP controllers. This
>> can be easily encoded with just 2 bits and still leave enough room
>> for future controller types.
>>
>> Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
>> ---
>> net/bluetooth/hci_core.c | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c
>> index 4549b5c..ebba5a6 100644
>> --- a/net/bluetooth/hci_core.c
>> +++ b/net/bluetooth/hci_core.c
>> @@ -1610,7 +1610,7 @@ int hci_get_dev_info(void __user *arg)
>>
>> strcpy(di.name, hdev->name);
>> di.bdaddr = hdev->bdaddr;
>> - di.type = (hdev->bus & 0x0f) | (hdev->dev_type << 4);
>> + di.type = (hdev->bus & 0x0f) | ((hdev->dev_type & 0x30) << 4);
>
> Shouldn't it be (hdev->dev_type & 0x03) here?
yes, this it should be 0x03 here. My mistake.
Regards
Marcel
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] Bluetooth: Use only 2 bits for controller type information
2013-09-30 4:01 ` Marcel Holtmann
@ 2013-09-30 11:31 ` Anderson Lizardo
2013-10-02 12:41 ` Anderson Lizardo
0 siblings, 1 reply; 5+ messages in thread
From: Anderson Lizardo @ 2013-09-30 11:31 UTC (permalink / raw)
To: Marcel Holtmann; +Cc: BlueZ development
Hi Marcel,
On Mon, Sep 30, 2013 at 12:01 AM, Marcel Holtmann <marcel@holtmann.org> wrote:
>>> - di.type = (hdev->bus & 0x0f) | (hdev->dev_type << 4);
>>> + di.type = (hdev->bus & 0x0f) | ((hdev->dev_type & 0x30) << 4);
>>
>> Shouldn't it be (hdev->dev_type & 0x03) here?
>
> yes, this it should be 0x03 here. My mistake.
Just a reminder that userspace needs fixing as well.
Best Regards,
--
Anderson Lizardo
Instituto Nokia de Tecnologia - INdT
Manaus - Brazil
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] Bluetooth: Use only 2 bits for controller type information
2013-09-30 11:31 ` Anderson Lizardo
@ 2013-10-02 12:41 ` Anderson Lizardo
0 siblings, 0 replies; 5+ messages in thread
From: Anderson Lizardo @ 2013-10-02 12:41 UTC (permalink / raw)
To: Marcel Holtmann; +Cc: BlueZ development
Hi Marcel,
On Mon, Sep 30, 2013 at 7:31 AM, Anderson Lizardo
<anderson.lizardo@openbossa.org> wrote:
> Hi Marcel,
>
> On Mon, Sep 30, 2013 at 12:01 AM, Marcel Holtmann <marcel@holtmann.org> wrote:
>>>> - di.type = (hdev->bus & 0x0f) | (hdev->dev_type << 4);
>>>> + di.type = (hdev->bus & 0x0f) | ((hdev->dev_type & 0x30) << 4);
>>>
>>> Shouldn't it be (hdev->dev_type & 0x03) here?
>>
>> yes, this it should be 0x03 here. My mistake.
>
> Just a reminder that userspace needs fixing as well.
My mistake, userspace is fine. :)
Best Regards,
--
Anderson Lizardo
Instituto Nokia de Tecnologia - INdT
Manaus - Brazil
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2013-10-02 12:41 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-09-29 4:09 [PATCH] Bluetooth: Use only 2 bits for controller type information Marcel Holtmann
2013-09-29 12:59 ` Anderson Lizardo
2013-09-30 4:01 ` Marcel Holtmann
2013-09-30 11:31 ` Anderson Lizardo
2013-10-02 12:41 ` Anderson Lizardo
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox