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

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





Hi
This is the normal procedure used in linux device driver programming to get
unique IOconntrol number. U can have a look at <linux/ioctl.h>
IOCONTROL fields have four filed.

1) type
it is a magic number and is used throughout a device driver, In Axis stack
it is 'B'
the definition
#define BT_IOC_MAGIC 'B' /* Use B as a magic number */  does this

2) number
the ordinal sequence number which identifies different iocontrol command for
this driver.

3) direction
there are few direction data transfer macros to indicate the direction in
ioctl.h
they are
	_IOC_NONE	nodata transfer
	_IOC_READ
	_IOC_WRITE
	_IOC_READ| _IOC_WRITE

4)Size

#define HCIWRITESTOREDLINKKEY _IOWR(BT_IOC_MAGIC, 0x34, u8[22])
is will have the iocontrol number , for that the macro _IOWR(type,nr,size)
is used.
this is defined in ioctl.h
the size of data transfer involved
Hope this is what u wanted.
Regards
Kugan




#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?

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.

Regards

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

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