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

RE: [bluetooth-dev] function calls in kernel- and usermode

> -----Original Message-----
> From: Patrick Clauberg [mailto:pat@xxxxxxx.de]
> Sent: 04 April 2001 15:55
> To: bluetooth-dev@xxxxxxx.com
> Subject: [bluetooth-dev] function calls in kernel- and usermode
> Hi,
> as far as I checked the btd.c function call in kernel  mode always are
> something like
> ioctl(...., HCIFUNCTIONNAME, ....)
> while in usermode the functions in the hci.c are called
> which always lead to the send_cmd_block
> on the other hand, on the send cmd_block there is 
> distinguished between __kernel__ and the rest
> so, if the kernel stuff goes to the ioctl anyway, why having 
> kernel stuff in the hci.c .
> Or didn't I get that right?
> I want to write an application that needs an l2cap connection 
> and the hci commands like link inquiry, read_db_addr and so on.
> I would like to run it in kernel mode, since I have some 
> problems using the btduser.
> can I use the normal hci.c function calls to do this?
> I would really appreciate, If someone could bring some light into my
> darkness :-))
> Bye
> Patrick

When you build the stack for user mode, everything is linked
into the same binary. I.e., it contains e.g. both btd.o and
hci.o. When you compile for the kernel hci.o is part of the
kernel, and btd is a stand alone binary. The ioctl() call
works as the bridge between user and kernel mode. The ioctl()
call will result in the correct function being called inside
the kernel. Whereas in the user mode program the functions
are called directly instead.

You can see what happens when an ioctl() is called in bt_ioctl()
in bluetooth.c.

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