Hi Fabian, I would like to reply just in relation to the "Bluetooth path" as I'm not sure what the intended behaviour is for the "write" call is. The Bluetooth path taken depends upon the userspace Bluetooth stack you use. Various Bluetooth stacks use "uhid" though some may take hidp as well or may even support both. I hope this helps you with your quest. I recall at least BlueZ supports uhid and Android uses it as well. Thanks, Roderick On Tue, Jul 9, 2019 at 3:32 AM Fabian Henneke <fabian.henneke@xxxxxxxxx> wrote: > > Hi, > > when testing hidraw's hid-example.c > (https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/samples/hidraw/hid-example.c) > with a Bluetooth HID device, I noticed that the write() call always > returns 0 on success, even though the entire buffer has been written and > received by the device. > Following the chain of calls triggered by the call to write(), I > identified hidp_send_message in /net/bluetooth/hidp/core.c:98 > (https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/net/bluetooth/hidp/core.c#n98) > as the plausible origin of the return value. This function always > returns 0 on success, regardless of the value of its parameter size. > > Could you confirm whether this function is really the one used to handle > writes to Bluetooth HID devices? If so, is it intended behavior to have > write() return the number of bytes written for USB HID devices, but not > for Bluetooth HID devices?