2004-03-15 11:38:23

by Keith Pemberton

[permalink] [raw]
Subject: [Bluez-devel] Writing a bluetooth mouse driver...

I'm going to write a bluetooth mouse driver for my MS bluetooth mouse
just to see if I can do it. (yes, I do know that there is one out there
already, but I don't like the way that that driver is doing things). My
hang up in understanding is in the communication between the mouse and
the wireless transceiver. I am guessing that the functions providing
communication to the transceiver are defined in hci.c (or hci.h). Does
anyone have a good document that describes how the Bluez stack
communicates with different hardware? Any other documents that you can
suggest would be much appreciated! Thanks in advance.

Keith



-------------------------------------------------------
This SF.Net email is sponsored by: IBM Linux Tutorials
Free Linux tutorial presented by Daniel Robbins, President and CEO of
GenToo technologies. Learn everything from fundamentals to system
administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click
_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel


2004-03-15 15:00:43

by Marcel Holtmann

[permalink] [raw]
Subject: Re: [Bluez-devel] Writing a bluetooth mouse driver...

Hi Vojtech,

> > the problematic part is hid-core.c, because it contains the USB specific
> > transport layer. I ripped it off and included the rest into my HIDP code
> > and it works flawless. The Bluetooth transport code is almost ready. I
> > only need to include some workarounds for the stupid L2CAP disconnect
> > problems with some HID implementations, but this has nothing to do with
> > the HID parser.
> >
> > Actually the HID parser is independent from the input and USB subsystem,
> > because you can use a Bluetooth transport and the hiddev interface for
> > reading and writing reports. What I have in mind is cleaning up the
> > current code and putting it under drivers/hid/ with this API:
> >
> > struct hid_device {
> > ...
> >
> > void *driver_data;
> > int (*send)(struct hid_device *device, unsigned char *data, int size);
> > }
> >
> > struct hid_device *hid_alloc_device(unsigned char *data, int size);
> > void hid_free_device(struct hid_device *device);
> > int hid_register_device(struct hid_device *device);
> > void hid_unregister_device(struct hid_device *device);
> > int hid_recv_report(struct hid_device *hid, int type, unsigned char *data, int size);
>
> This is a very nice idea. I'm all for it.

the problem that I see is that someone has to code it and I am not a
real HID parser expert. I want to add kernel side Bluetooth HID support
into 2.6.5 and at the moment I only see to choices:

1. I include my ripped hid-core.c and hid-input.c code along with my
HIDP code in net/bluetooth/hidp/

2. I build up a basic drivers/hid/ with limited functionality (only
input and no hiddev support) and the proposed API. The name of the
kernel module should be something like hid-ng.ko until we have a full
replacement for hid.ko.

Comments?

Regards

Marcel




-------------------------------------------------------
This SF.Net email is sponsored by: IBM Linux Tutorials
Free Linux tutorial presented by Daniel Robbins, President and CEO of
GenToo technologies. Learn everything from fundamentals to system
administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click
_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel

2004-03-15 14:32:14

by Vojtech Pavlik

[permalink] [raw]
Subject: Re: [Bluez-devel] Writing a bluetooth mouse driver...

On Mon, Mar 15, 2004 at 03:18:06PM +0100, Marcel Holtmann wrote:
> Hi Philip,
>
> > I spoke with Vojtech last year about moving the HID parser from the USB
> > code into the input subsystem, so that it could be shared with
> > Bluetooth. He seemed happy with that in principle, and I don't think it
> > would be very difficult to implement, but I haven't had time to actually
> > write a patch yet.
>
> the problematic part is hid-core.c, because it contains the USB specific
> transport layer. I ripped it off and included the rest into my HIDP code
> and it works flawless. The Bluetooth transport code is almost ready. I
> only need to include some workarounds for the stupid L2CAP disconnect
> problems with some HID implementations, but this has nothing to do with
> the HID parser.
>
> Actually the HID parser is independent from the input and USB subsystem,
> because you can use a Bluetooth transport and the hiddev interface for
> reading and writing reports. What I have in mind is cleaning up the
> current code and putting it under drivers/hid/ with this API:
>
> struct hid_device {
> ...
>
> void *driver_data;
> int (*send)(struct hid_device *device, unsigned char *data, int size);
> }
>
> struct hid_device *hid_alloc_device(unsigned char *data, int size);
> void hid_free_device(struct hid_device *device);
> int hid_register_device(struct hid_device *device);
> void hid_unregister_device(struct hid_device *device);
> int hid_recv_report(struct hid_device *hid, int type, unsigned char *data, int size);

This is a very nice idea. I'm all for it.

--
Vojtech Pavlik
SuSE Labs, SuSE CR

2004-03-15 14:18:06

by Marcel Holtmann

[permalink] [raw]
Subject: Re: [Bluez-devel] Writing a bluetooth mouse driver...

Hi Philip,

> I spoke with Vojtech last year about moving the HID parser from the USB
> code into the input subsystem, so that it could be shared with
> Bluetooth. He seemed happy with that in principle, and I don't think it
> would be very difficult to implement, but I haven't had time to actually
> write a patch yet.

the problematic part is hid-core.c, because it contains the USB specific
transport layer. I ripped it off and included the rest into my HIDP code
and it works flawless. The Bluetooth transport code is almost ready. I
only need to include some workarounds for the stupid L2CAP disconnect
problems with some HID implementations, but this has nothing to do with
the HID parser.

Actually the HID parser is independent from the input and USB subsystem,
because you can use a Bluetooth transport and the hiddev interface for
reading and writing reports. What I have in mind is cleaning up the
current code and putting it under drivers/hid/ with this API:

struct hid_device {
...

void *driver_data;
int (*send)(struct hid_device *device, unsigned char *data, int size);
}

struct hid_device *hid_alloc_device(unsigned char *data, int size);
void hid_free_device(struct hid_device *device);
int hid_register_device(struct hid_device *device);
void hid_unregister_device(struct hid_device *device);
int hid_recv_report(struct hid_device *hid, int type, unsigned char *data, int size);

Regards

Marcel




-------------------------------------------------------
This SF.Net email is sponsored by: IBM Linux Tutorials
Free Linux tutorial presented by Daniel Robbins, President and CEO of
GenToo technologies. Learn everything from fundamentals to system
administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click
_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel

2004-03-15 13:58:47

by Philip Blundell

[permalink] [raw]
Subject: Re: [Bluez-devel] Writing a bluetooth mouse driver...

On Mon, 2004-03-15 at 12:03, Marcel Holtmann wrote:
> messages. The transport protocol is HIDP and than you need of course a
> HID parser, which is the biggest part.

I spoke with Vojtech last year about moving the HID parser from the USB
code into the input subsystem, so that it could be shared with
Bluetooth. He seemed happy with that in principle, and I don't think it
would be very difficult to implement, but I haven't had time to actually
write a patch yet.

p.

2004-03-15 12:03:28

by Marcel Holtmann

[permalink] [raw]
Subject: Re: [Bluez-devel] Writing a bluetooth mouse driver...

Hi Keith,

> I'm going to write a bluetooth mouse driver for my MS bluetooth mouse
> just to see if I can do it. (yes, I do know that there is one out there
> already, but I don't like the way that that driver is doing things). My
> hang up in understanding is in the communication between the mouse and
> the wireless transceiver. I am guessing that the functions providing
> communication to the transceiver are defined in hci.c (or hci.h). Does
> anyone have a good document that describes how the Bluez stack
> communicates with different hardware? Any other documents that you can
> suggest would be much appreciated! Thanks in advance.

actually you must understand how the Bluetooth stack is designed and how
the HID profile makes use of it. You will notice that HID uses two L2CAP
connections, one for control message and the other one for interrupt
messages. The transport protocol is HIDP and than you need of course a
HID parser, which is the biggest part.

Regards

Marcel




-------------------------------------------------------
This SF.Net email is sponsored by: IBM Linux Tutorials
Free Linux tutorial presented by Daniel Robbins, President and CEO of
GenToo technologies. Learn everything from fundamentals to system
administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click
_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel