2010-05-06 22:04:42

by Pavan Savoy

[permalink] [raw]
Subject: multiple HCI_UART protocols over hci_ldisc

Hi Marcel,=0A=0AI am working on a line discipline which in many respects is=
similar to the hci_ldisc, but only extended to do plenty of other function=
ality.=0A=0AOne road block which i have hit is to support multiple devices/=
or as Alan Cox puts it "avoid single device limits"=0A=0ASo, in somewhat re=
lation to this, I wanted to ask, If in a system I have 2 UARTs both connect=
ed to BT chips but only from different vendors say TI/HCI-Ll and broadcomm =
with BCSP .. =0A=0ACan I have those 2 protocols on top of HCI-ldisc on diff=
erent UARTs at the same time?=0AIs something like that feasible?=0A=0A


2010-05-07 04:46:32

by Suraj Sumangala

[permalink] [raw]
Subject: Re: multiple HCI_UART protocols over hci_ldisc

Hi pavan,

Pavan Savoy wrote:
> Max,
>
> --- On Fri, 7/5/10, Max Krasnyansky <[email protected]> wrote:
>
>> From: Max Krasnyansky <[email protected]>
>> Subject: Re: multiple HCI_UART protocols over hci_ldisc
>> To: "Pavan Savoy" <[email protected]>
>> Cc: "[email protected]" <[email protected]>, "Marcel Holtmann" <[email protected]>
>> Date: Friday, 7 May, 2010, 4:00 AM
>> On 05/06/2010 03:04 PM, Pavan Savoy
>> wrote:
>>> Hi Marcel,
>>>
>>> I am working on a line discipline which in many
>> respects is similar to the hci_ldisc, but only extended to
>> do plenty of other functionality.
>>> One road block which i have hit is to support multiple
>> devices/or as Alan Cox puts it "avoid single device limits"
>>> So, in somewhat relation to this, I wanted to ask, If
>> in a system I have 2 UARTs both connected to BT chips but
>> only from different vendors say TI/HCI-Ll and broadcomm with
>> BCSP ..
>>> Can I have those 2 protocols on top of HCI-ldisc on
>> different UARTs at the same time?
>>> Is something like that feasible?
>> Sure. You'll get two separate HCI devices in that case.
>
> But there seems to be only 1,
> static struct hci_uart_proto *hup[HCI_UART_MAX_PROTO];
> int hci_uart_register_proto(struct hci_uart_proto *p)
> {
> if (p->id >= HCI_UART_MAX_PROTO)
> return -EINVAL;
>
> if (hup[p->id])
> return -EEXIST;
>
> hup[p->id] = p;
>
> return 0;
> }
>
> So, If suppose I have 2 UARTs both on which HCI-Ldisc exists, and I try say HCI-LL on both, Now won't I get a -EEXIST for the 2nd HCI-LL ?
>
> I am a bit confused, can you explain in brief ?
> Is there a possibility of copies of *hup[HCI_UART_MAX_PROTO] for each UART?
>
>> Max
>>
>
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in
> the body of a message to [email protected]
> More majordomo info at http://vger.kernel.org/majordomo-info.html

The call "hci_uart_register_proto()" is used to register each protocol,
not each device.

Each protocol calls this API to register themselves during module load,
and will be called only once for each protocol during the module's lifetime.

Checkout the functions under #ifdef inside "hci_uart_init()". each of
them will be calling "hci_uart_register_proto()" to register themselves.

Whenever you attach a UART BT device, "hci_uart_set_proto()" will be
called and this will be responsible for creating an hci device, Not
"hci_uart_register_proto()"

Regards
Suraj

2010-05-06 22:38:08

by Pavan Savoy

[permalink] [raw]
Subject: Re: multiple HCI_UART protocols over hci_ldisc

Max,=0A=0A--- On Fri, 7/5/10, Max Krasnyansky <[email protected]> wrote:=0A=
=0A> From: Max Krasnyansky <[email protected]>=0A> Subject: Re: multiple HC=
I_UART protocols over hci_ldisc=0A> To: "Pavan Savoy" <[email protected]=
.in>=0A> Cc: "[email protected]" <[email protected]=
.org>, "Marcel Holtmann" <[email protected]>=0A> Date: Friday, 7 May, 201=
0, 4:00 AM=0A> On 05/06/2010 03:04 PM, Pavan Savoy=0A> wrote:=0A> > Hi Marc=
el,=0A> >=0A> > I am working on a line discipline which in many=0A> respect=
s is similar to the hci_ldisc, but only extended to=0A> do plenty of other =
functionality.=0A> >=0A> > One road block which i have hit is to support mu=
ltiple=0A> devices/or as Alan Cox puts it "avoid single device limits"=0A> =
>=0A> > So, in somewhat relation to this, I wanted to ask, If=0A> in a syst=
em I have 2 UARTs both connected to BT chips but=0A> only from different ve=
ndors say TI/HCI-Ll and broadcomm with=0A> BCSP ..=0A> >=0A> > Can I have t=
hose 2 protocols on top of HCI-ldisc on=0A> different UARTs at the same tim=
e?=0A> > Is something like that feasible?=0A> Sure. You'll get two separate=
HCI devices in that case.=0A=0ABut there seems to be only 1,=0Astatic stru=
ct hci_uart_proto *hup[HCI_UART_MAX_PROTO];=0Aint hci_uart_register_proto(s=
truct hci_uart_proto *p)=0A{=0A if (p->id >=3D HCI_UART_MAX_PROTO)=
=0A return -EINVAL;=0A=0A if (hup[p->id])=0A =
return -EEXIST;=0A=0A hup[p->id] =3D p;=0A=0A return 0=
;=0A}=0A=0ASo, If suppose I have 2 UARTs both on which HCI-Ldisc exists, an=
d I try say HCI-LL on both, Now won't I get a -EEXIST for the 2nd HCI-LL ?=
=0A=0AI am a bit confused, can you explain in brief ?=0AIs there a possibil=
ity of copies of *hup[HCI_UART_MAX_PROTO] for each UART?=0A=0A> Max=0A> =0A=
=0A

2010-05-06 22:30:13

by Max Krasnyansky

[permalink] [raw]
Subject: Re: multiple HCI_UART protocols over hci_ldisc

On 05/06/2010 03:04 PM, Pavan Savoy wrote:
> Hi Marcel,
>
> I am working on a line discipline which in many respects is similar to the hci_ldisc, but only extended to do plenty of other functionality.
>
> One road block which i have hit is to support multiple devices/or as Alan Cox puts it "avoid single device limits"
>
> So, in somewhat relation to this, I wanted to ask, If in a system I have 2 UARTs both connected to BT chips but only from different vendors say TI/HCI-Ll and broadcomm with BCSP ..
>
> Can I have those 2 protocols on top of HCI-ldisc on different UARTs at the same time?
> Is something like that feasible?
Sure. You'll get two separate HCI devices in that case.

Max