From: giulio fedel <giulio.fedel@andorsystems.com>
To: BlueZ users <bluez-users@lists.sourceforge.net>
Subject: Re: [Bluez-users] hci_inquiry problem
Date: Thu, 30 Aug 2007 12:43:25 +0200 [thread overview]
Message-ID: <46D69F4D.1060903@andorsystems.com> (raw)
In-Reply-To: <46D57FE3.2090508@andorsystems.com>
Thinking a bit more, I found the difference in the structure sizes due
to a mismatch with arm abi/eabi interfaces (gcc mabi apcs-gnu/aapcs
option). Probably only a my compiler version specific issue.
Giulio Fedel
giulio fedel wrote:
> Hi,
> I'm working on an arm embedded system. It turn out that hci_inquiry in
> hci.c (libs) calls
>
> --> buf = malloc(sizeof(*ir) + (sizeof(inquiry_info) * (nrsp)))
> ...
> --> ioctl(dd, HCIINQUIRY, (unsigned long) buf)
> ...
>
> My problem is that sizeof(struct hci_inquiry_req) is not the same in
> kernel space and in user space (nothing strange), so when in the kernel
> driver in hci_core.c we do:
>
> --> hci_inquiry_req * ir;
> ...
> --> ptr += sizeof(ir);
> --> copy_to_user(ptr, buf, sizeof(struct inquiry_info) * ir.num_rsp)
>
> and in the library code (hci_inquiry)
>
> --> hci_inquiry_req * ir;
> ...
> --> memcpy((void *) *ii, buf + sizeof(*ir), size);
>
> the things do not work as aspected.
> I solved my problem with __attribute__ ((packed)) in hci.h
> in the kernel tree (include/net/bluetooth/) and in the library
> (include/hci.h).
>
> Regards.
>
> Giulio Fedel
>
>
-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
Bluez-users mailing list
Bluez-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bluez-users
prev parent reply other threads:[~2007-08-30 10:43 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-08-29 14:17 [Bluez-users] hci_inquiry problem giulio fedel
2007-08-30 10:43 ` giulio fedel [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=46D69F4D.1060903@andorsystems.com \
--to=giulio.fedel@andorsystems.com \
--cc=bluez-users@lists.sourceforge.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.