[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [bluetooth-dev] what is the MAGIC number 'B'?



Patrick Clauberg wrote:

> Hi everybody,
>
> I just encountered
>
> #define BT_IOC_MAGIC 'B' /* Use B as a magic number */
>
> in the btcommon.h
>
> Could anybody pls tell me, what the purpose of this definition is?

It uniquely distinguishes the bluetooth driver's ioctls from any other driver's
ioctls.

>
> Moreover there is for example
>
> #define HCIWRITESTOREDLINKKEY _IOWR(BT_IOC_MAGIC, 0x34, u8[22])
>
> Where does the 0x34 come from? The core spec on p.616 tells me that the OCF is
> 0x0011.
>

It uniquely identifies this particular "write" ioctl from it's buddies. Note that
the previous one is 0x33, the next one is 0x35...

It has nothing to do with the bluetooth spec. It's a Linux device driver thing.

If you want to see the part that implements the spec check out the implementation
of the ioctl in bluetooth.c:bt_ioctl.

--gmcnutt

-
To unsubscribe from this list: send the line "unsubscribe bluetooth-dev" in
the body of a message to majordomo@xxxxxxx.com