hid event handling
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@880 c046a42c-6fe2-441c-8c8c-71466251a162
This commit is contained in:
parent
caf9a12e9a
commit
63066f4f13
12
hw/pckbd.c
12
hw/pckbd.c
@ -190,9 +190,9 @@ static void kbd_queue(KBDState *s, int b, int aux)
|
||||
kbd_update_irq(s);
|
||||
}
|
||||
|
||||
void kbd_put_keycode(int keycode)
|
||||
static void pc_kbd_put_keycode(void *opaque, int keycode)
|
||||
{
|
||||
KBDState *s = &kbd_state;
|
||||
KBDState *s = opaque;
|
||||
kbd_queue(s, keycode, 0);
|
||||
}
|
||||
|
||||
@ -434,9 +434,10 @@ static void kbd_mouse_send_packet(KBDState *s)
|
||||
s->mouse_dz -= dz1;
|
||||
}
|
||||
|
||||
void kbd_mouse_event(int dx, int dy, int dz, int buttons_state)
|
||||
static void pc_kbd_mouse_event(void *opaque,
|
||||
int dx, int dy, int dz, int buttons_state)
|
||||
{
|
||||
KBDState *s = &kbd_state;
|
||||
KBDState *s = opaque;
|
||||
|
||||
/* check if deltas are recorded when disabled */
|
||||
if (!(s->mouse_status & MOUSE_STATUS_ENABLED))
|
||||
@ -652,4 +653,7 @@ void kbd_init(void)
|
||||
register_ioport_write(0x60, 1, 1, kbd_write_data, s);
|
||||
register_ioport_read(0x64, 1, 1, kbd_read_status, s);
|
||||
register_ioport_write(0x64, 1, 1, kbd_write_command, s);
|
||||
|
||||
qemu_add_kbd_event_handler(pc_kbd_put_keycode, s);
|
||||
qemu_add_mouse_event_handler(pc_kbd_mouse_event, s);
|
||||
}
|
||||
|
35
vl.c
35
vl.c
@ -384,6 +384,41 @@ void hw_error(const char *fmt, ...)
|
||||
abort();
|
||||
}
|
||||
|
||||
/***********************************************************/
|
||||
/* keyboard/mouse */
|
||||
|
||||
static QEMUPutKBDEvent *qemu_put_kbd_event;
|
||||
static void *qemu_put_kbd_event_opaque;
|
||||
static QEMUPutMouseEvent *qemu_put_mouse_event;
|
||||
static void *qemu_put_mouse_event_opaque;
|
||||
|
||||
void qemu_add_kbd_event_handler(QEMUPutKBDEvent *func, void *opaque)
|
||||
{
|
||||
qemu_put_kbd_event_opaque = opaque;
|
||||
qemu_put_kbd_event = func;
|
||||
}
|
||||
|
||||
void qemu_add_mouse_event_handler(QEMUPutMouseEvent *func, void *opaque)
|
||||
{
|
||||
qemu_put_mouse_event_opaque = opaque;
|
||||
qemu_put_mouse_event = func;
|
||||
}
|
||||
|
||||
void kbd_put_keycode(int keycode)
|
||||
{
|
||||
if (qemu_put_kbd_event) {
|
||||
qemu_put_kbd_event(qemu_put_kbd_event_opaque, keycode);
|
||||
}
|
||||
}
|
||||
|
||||
void kbd_mouse_event(int dx, int dy, int dz, int buttons_state)
|
||||
{
|
||||
if (qemu_put_mouse_event) {
|
||||
qemu_put_mouse_event(qemu_put_mouse_event_opaque,
|
||||
dx, dy, dz, buttons_state);
|
||||
}
|
||||
}
|
||||
|
||||
/***********************************************************/
|
||||
/* timers */
|
||||
|
||||
|
57
vl.h
57
vl.h
@ -179,6 +179,21 @@ extern int rtc_utc;
|
||||
#define BIOS_SIZE 0
|
||||
#endif
|
||||
|
||||
/* keyboard/mouse support */
|
||||
|
||||
#define MOUSE_EVENT_LBUTTON 0x01
|
||||
#define MOUSE_EVENT_RBUTTON 0x02
|
||||
#define MOUSE_EVENT_MBUTTON 0x04
|
||||
|
||||
typedef void QEMUPutKBDEvent(void *opaque, int keycode);
|
||||
typedef void QEMUPutMouseEvent(void *opaque, int dx, int dy, int dz, int buttons_state);
|
||||
|
||||
void qemu_add_kbd_event_handler(QEMUPutKBDEvent *func, void *opaque);
|
||||
void qemu_add_mouse_event_handler(QEMUPutMouseEvent *func, void *opaque);
|
||||
|
||||
void kbd_put_keycode(int keycode);
|
||||
void kbd_mouse_event(int dx, int dy, int dz, int buttons_state);
|
||||
|
||||
/* async I/O support */
|
||||
|
||||
typedef void IOReadHandler(void *opaque, const uint8_t *buf, int size);
|
||||
@ -530,13 +545,6 @@ void pci_ne2000_init(NetDriverState *nd);
|
||||
|
||||
/* pckbd.c */
|
||||
|
||||
void kbd_put_keycode(int keycode);
|
||||
|
||||
#define MOUSE_EVENT_LBUTTON 0x01
|
||||
#define MOUSE_EVENT_RBUTTON 0x02
|
||||
#define MOUSE_EVENT_MBUTTON 0x04
|
||||
void kbd_mouse_event(int dx, int dy, int dz, int buttons_state);
|
||||
|
||||
void kbd_init(void);
|
||||
|
||||
/* mc146818rtc.c */
|
||||
@ -627,6 +635,41 @@ int PPC_NVRAM_set_params (m48t59_t *nvram, uint16_t NVRAM_size,
|
||||
uint32_t initrd_image, uint32_t initrd_size,
|
||||
uint32_t NVRAM_image);
|
||||
|
||||
/* adb.c */
|
||||
|
||||
#define MAX_ADB_DEVICES 16
|
||||
|
||||
typedef struct ADBDevice ADBDevice;
|
||||
|
||||
typedef void ADBDeviceReceivePacket(ADBDevice *d, const uint8_t *buf, int len);
|
||||
|
||||
struct ADBDevice {
|
||||
struct ADBBusState *bus;
|
||||
int devaddr;
|
||||
int handler;
|
||||
ADBDeviceReceivePacket *receive_packet;
|
||||
void *opaque;
|
||||
};
|
||||
|
||||
typedef struct ADBBusState {
|
||||
ADBDevice devices[MAX_ADB_DEVICES];
|
||||
int nb_devices;
|
||||
} ADBBusState;
|
||||
|
||||
void adb_receive_packet(ADBBusState *s, const uint8_t *buf, int len);
|
||||
void adb_send_packet(ADBBusState *s, const uint8_t *buf, int len);
|
||||
|
||||
ADBDevice *adb_register_device(ADBBusState *s, int devaddr,
|
||||
ADBDeviceReceivePacket *receive_packet,
|
||||
void *opaque);
|
||||
void adb_kbd_init(ADBBusState *bus);
|
||||
void adb_mouse_init(ADBBusState *bus);
|
||||
|
||||
/* cuda.c */
|
||||
|
||||
extern ADBBusState adb_bus;
|
||||
int cuda_init(void);
|
||||
|
||||
/* monitor.c */
|
||||
void monitor_init(void);
|
||||
void term_printf(const char *fmt, ...) __attribute__ ((__format__ (__printf__, 1, 2)));
|
||||
|
Loading…
Reference in New Issue
Block a user