- added instructions how to update the online documentation
[bochs-mirror.git] / iodev / usb_hid.h
blobd303c6e382d7b89c761b9e05fbe9f6a82ae4c758
1 /////////////////////////////////////////////////////////////////////////
2 // $Id: usb_hid.h,v 1.5 2007/09/28 19:52:06 sshwarts Exp $
3 /////////////////////////////////////////////////////////////////////////
4 //
5 // Copyright (C) 2007 Volker Ruppert
6 //
7 // This library is free software; you can redistribute it and/or
8 // modify it under the terms of the GNU Lesser General Public
9 // License as published by the Free Software Foundation; either
10 // version 2 of the License, or (at your option) any later version.
12 // This library is distributed in the hope that it will be useful,
13 // but WITHOUT ANY WARRANTY; without even the implied warranty of
14 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 // Lesser General Public License for more details.
17 // You should have received a copy of the GNU Lesser General Public
18 // License along with this library; if not, write to the Free Software
19 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 // USB HID emulation support ported from the Qemu project
23 #ifndef BX_IODEV_USB_HID_H
24 #define BX_IODEV_USB_HID_H
27 class usb_hid_device_t : public usb_device_t {
28 public:
29 usb_hid_device_t(usbdev_type type);
30 virtual ~usb_hid_device_t(void);
32 virtual void handle_reset();
33 virtual int handle_control(int request, int value, int index, int length, Bit8u *data);
34 virtual int handle_data(USBPacket *p);
35 virtual void register_state_specific(bx_list_c *parent);
36 void mouse_enq(int delta_x, int delta_y, int delta_z, unsigned button_state);
37 bx_bool key_enq(Bit8u *scan_code);
38 protected:
39 int mouse_poll(Bit8u *buf, int len);
40 int keypad_poll(Bit8u *buf, int len);
42 private:
43 struct {
44 int mouse_delayed_dx;
45 int mouse_delayed_dy;
46 int mouse_delayed_dz;
47 Bit16s mouse_x;
48 Bit16s mouse_y;
49 Bit8s mouse_z;
50 Bit8u b_state;
51 Bit8u saved_key[8];
52 Bit8u key_pad_packet[8];
53 } s;
56 #endif