aboutsummaryrefslogtreecommitdiff
path: root/hw
diff options
context:
space:
mode:
authorbellard <bellard@c046a42c-6fe2-441c-8c8c-71466251a162>2005-02-15 22:58:51 +0000
committerbellard <bellard@c046a42c-6fe2-441c-8c8c-71466251a162>2005-02-15 22:58:51 +0000
commit3988e8977b8267a468377a03cc9afb643615a8fa (patch)
treeb866b894ce63a28acba443c559beabfb33ac9a20 /hw
parent7483750d7d5513911bf68e5810aaf6cebc0cf7b5 (diff)
ADB reset support (Joceylin Mayer)
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@1295 c046a42c-6fe2-441c-8c8c-71466251a162
Diffstat (limited to 'hw')
-rw-r--r--hw/adb.c32
1 files changed, 28 insertions, 4 deletions
diff --git a/hw/adb.c b/hw/adb.c
index 36c4aecd25..2acfe65bf4 100644
--- a/hw/adb.c
+++ b/hw/adb.c
@@ -248,13 +248,25 @@ static int adb_kbd_request(ADBDevice *d, uint8_t *obuf,
return olen;
}
+static int adb_kbd_reset(ADBDevice *d)
+{
+ KBDState *s = d->opaque;
+
+ d->handler = 1;
+ d->devaddr = ADB_KEYBOARD;
+ memset(s, 0, sizeof(KBDState));
+
+ return 0;
+}
+
void adb_kbd_init(ADBBusState *bus)
{
ADBDevice *d;
KBDState *s;
s = qemu_mallocz(sizeof(KBDState));
- d = adb_register_device(bus, ADB_KEYBOARD, adb_kbd_request, NULL, s);
- d->handler = 1;
+ d = adb_register_device(bus, ADB_KEYBOARD, adb_kbd_request,
+ adb_kbd_reset, s);
+ adb_kbd_reset(d);
qemu_add_kbd_event_handler(adb_kbd_put_keycode, d);
}
@@ -374,13 +386,25 @@ static int adb_mouse_request(ADBDevice *d, uint8_t *obuf,
return olen;
}
+static int adb_mouse_reset(ADBDevice *d)
+{
+ MouseState *s = d->opaque;
+
+ d->handler = 2;
+ d->devaddr = ADB_MOUSE;
+ memset(s, 0, sizeof(MouseState));
+
+ return 0;
+}
+
void adb_mouse_init(ADBBusState *bus)
{
ADBDevice *d;
MouseState *s;
s = qemu_mallocz(sizeof(MouseState));
- d = adb_register_device(bus, ADB_MOUSE, adb_mouse_request, NULL, s);
- d->handler = 2;
+ d = adb_register_device(bus, ADB_MOUSE, adb_mouse_request,
+ adb_mouse_reset, s);
+ adb_mouse_reset(d);
qemu_add_mouse_event_handler(adb_mouse_event, d);
}