diff --git a/bochs/iodev/iodev.h b/bochs/iodev/iodev.h index d571a5631..30fcdf3a0 100644 --- a/bochs/iodev/iodev.h +++ b/bochs/iodev/iodev.h @@ -1,5 +1,5 @@ ///////////////////////////////////////////////////////////////////////// -// $Id: iodev.h,v 1.58 2005-01-14 18:28:46 vruppert Exp $ +// $Id: iodev.h,v 1.59 2005-01-21 16:07:19 vruppert Exp $ ///////////////////////////////////////////////////////////////////////// // // Copyright (C) 2002 MandrakeSoft S.A. @@ -330,6 +330,9 @@ class BOCHSAPI bx_usb_stub_c : public bx_devmodel_c { virtual bx_bool usb_keyboard_connected() { return 0; } + virtual bx_bool usb_mouse_connected() { + return 0; + } }; #endif diff --git a/bochs/iodev/keyboard.cc b/bochs/iodev/keyboard.cc index 845adc4a6..51dbadf18 100644 --- a/bochs/iodev/keyboard.cc +++ b/bochs/iodev/keyboard.cc @@ -1,5 +1,5 @@ ///////////////////////////////////////////////////////////////////////// -// $Id: keyboard.cc,v 1.100 2005-01-14 18:28:46 vruppert Exp $ +// $Id: keyboard.cc,v 1.101 2005-01-21 16:07:36 vruppert Exp $ ///////////////////////////////////////////////////////////////////////// // // Copyright (C) 2002 MandrakeSoft S.A. @@ -125,7 +125,7 @@ bx_keyb_c::resetinternals(bx_bool powerup) void bx_keyb_c::init(void) { - BX_DEBUG(("Init $Id: keyboard.cc,v 1.100 2005-01-14 18:28:46 vruppert Exp $")); + BX_DEBUG(("Init $Id: keyboard.cc,v 1.101 2005-01-21 16:07:36 vruppert Exp $")); Bit32u i; DEV_register_irq(1, "8042 Keyboard controller"); @@ -1570,8 +1570,8 @@ bx_keyb_c::mouse_motion(int delta_x, int delta_y, int delta_z, unsigned button_s #endif #if BX_SUPPORT_PCIUSB - // if type == usb, redirect mouse data to the usb device - if (BX_KEY_THIS s.mouse.type == BX_MOUSE_TYPE_USB) { + // if an usb mouse is connected redirect mouse data to the usb device + if (DEV_usb_mouse_connected()) { DEV_usb_mouse_enq(delta_x, delta_y, delta_z, button_state); return; } diff --git a/bochs/iodev/pciusb.cc b/bochs/iodev/pciusb.cc index 6e44248de..b250fe011 100644 --- a/bochs/iodev/pciusb.cc +++ b/bochs/iodev/pciusb.cc @@ -1,5 +1,5 @@ ///////////////////////////////////////////////////////////////////////// -// $Id: pciusb.cc,v 1.19 2005-01-14 18:28:47 vruppert Exp $ +// $Id: pciusb.cc,v 1.20 2005-01-21 16:07:37 vruppert Exp $ ///////////////////////////////////////////////////////////////////////// // // Copyright (C) 2004 MandrakeSoft S.A. @@ -224,6 +224,7 @@ bx_pciusb_c::reset(unsigned type) memset(&BX_USB_THIS hub[i].device[j], 0, sizeof(USB_DEVICE)); BX_USB_THIS keyboard_connected = 0; + BX_USB_THIS mouse_connected = 0; // include the device(s) initialize code #include "pciusb_devs.h" @@ -244,8 +245,11 @@ bx_pciusb_c::init_device(Bit8u port, char *devname) if (!strcmp(devname, "mouse")) { type = USB_DEV_TYPE_MOUSE; connected = bx_options.Omouse_enabled->get(); - if (bx_options.Omouse_type->get() != BX_MOUSE_TYPE_USB) { - BX_ERROR(("USB mouse present, but other mouse type configured")); + if (bx_options.Omouse_type->get() == BX_MOUSE_TYPE_USB) { + BX_USB_THIS mouse_connected = connected; + } else if (connected) { + BX_ERROR(("USB mouse connect ignored, since other mouse type is configured")); + connected = 0; } } else if (!strcmp(devname, "keypad")) { type = USB_DEV_TYPE_KEYPAD; @@ -1620,4 +1624,10 @@ bx_pciusb_c::usb_keyboard_connected() return BX_USB_THIS keyboard_connected; } + bx_bool +bx_pciusb_c::usb_mouse_connected() +{ + return BX_USB_THIS mouse_connected; +} + #endif // BX_SUPPORT_PCI && BX_SUPPORT_PCIUSB diff --git a/bochs/iodev/pciusb.h b/bochs/iodev/pciusb.h index e8c525bc5..afa1de8bf 100644 --- a/bochs/iodev/pciusb.h +++ b/bochs/iodev/pciusb.h @@ -1,5 +1,5 @@ ///////////////////////////////////////////////////////////////////////// -// $Id: pciusb.h,v 1.8 2005-01-14 18:28:47 vruppert Exp $ +// $Id: pciusb.h,v 1.9 2005-01-21 16:07:38 vruppert Exp $ ///////////////////////////////////////////////////////////////////////// // // Copyright (C) 2004 MandrakeSoft S.A. @@ -357,6 +357,7 @@ public: virtual void usb_mouse_enable(bx_bool enable); virtual bx_bool usb_key_enq(Bit8u *scan_code); virtual bx_bool usb_keyboard_connected(); + virtual bx_bool usb_mouse_connected(); private: @@ -385,6 +386,7 @@ private: bx_bool last_connect; bx_bool keyboard_connected; + bx_bool mouse_connected; static void init_device(Bit8u port, char *devname); static void usb_set_connect_status(int type, bx_bool connected); diff --git a/bochs/plugin.h b/bochs/plugin.h index b88aba36c..c4affd119 100644 --- a/bochs/plugin.h +++ b/bochs/plugin.h @@ -1,5 +1,5 @@ ///////////////////////////////////////////////////////////////////////// -// $Id: plugin.h,v 1.38 2005-01-14 18:28:45 vruppert Exp $ +// $Id: plugin.h,v 1.39 2005-01-21 16:07:18 vruppert Exp $ ///////////////////////////////////////////////////////////////////////// // // This file provides macros and types needed for plugins. It is based on @@ -215,6 +215,8 @@ extern "C" { (bx_devices.pluginPciUSBAdapter->usb_key_enq(scan_code)) #define DEV_usb_keyboard_connected() \ (bx_devices.pluginPciUSBAdapter->usb_keyboard_connected()) +#define DEV_usb_mouse_connected() \ + (bx_devices.pluginPciUSBAdapter->usb_mouse_connected()) #endif //////// Memory macros