- added register/unregister methods for removable keyboard devices and updated
keyboard and usb_hid code to use them - removed keyboard handling from the USB host controller code - removed no longer needed USB stubs from the devices code - converted removable mouse variables to a structure
This commit is contained in:
parent
72e2a2258f
commit
90aa30fde9
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: devices.cc,v 1.142 2009-03-02 21:21:16 vruppert Exp $
|
||||
// $Id: devices.cc,v 1.143 2009-03-03 18:29:51 vruppert Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2002 MandrakeSoft S.A.
|
||||
@ -79,12 +79,6 @@ void bx_devices_c::init_stubs()
|
||||
#if BX_SUPPORT_ACPI
|
||||
pluginACPIController = &stubACPIController;
|
||||
#endif
|
||||
#if BX_SUPPORT_USB_UHCI
|
||||
pluginUSB_UHCI = &stubUsbAdapter;
|
||||
#endif
|
||||
#if BX_SUPPORT_USB_OHCI
|
||||
pluginUSB_OHCI = &stubUsbAdapter;
|
||||
#endif
|
||||
#endif
|
||||
pluginKeyboard = &stubKeyboard;
|
||||
pluginDmaDevice = &stubDma;
|
||||
@ -120,7 +114,7 @@ void bx_devices_c::init(BX_MEM_C *newmem)
|
||||
const char *plugname;
|
||||
#endif
|
||||
|
||||
BX_DEBUG(("Init $Id: devices.cc,v 1.142 2009-03-02 21:21:16 vruppert Exp $"));
|
||||
BX_DEBUG(("Init $Id: devices.cc,v 1.143 2009-03-03 18:29:51 vruppert Exp $"));
|
||||
mem = newmem;
|
||||
|
||||
/* set builtin default handlers, will be overwritten by the real default handler */
|
||||
@ -152,10 +146,13 @@ void bx_devices_c::init(BX_MEM_C *newmem)
|
||||
irq_handler_name[i] = NULL;
|
||||
}
|
||||
|
||||
// removable devices init
|
||||
bx_keyboard.dev = NULL;
|
||||
bx_keyboard.enq_event = NULL;
|
||||
bx_mouse.dev = NULL;
|
||||
bx_mouse.enq_event = NULL;
|
||||
bx_mouse.enabled_changed = NULL;
|
||||
// common mouse settings
|
||||
bx_mouse_dev = NULL;
|
||||
bx_mouse_enq = NULL;
|
||||
bx_mouse_enabled_changed = NULL;
|
||||
mouse_captured = SIM->get_param_bool(BXPN_MOUSE_ENABLED)->get();
|
||||
mouse_type = SIM->get_param_enum(BXPN_MOUSE_TYPE)->get();
|
||||
|
||||
@ -1062,31 +1059,56 @@ bx_bool bx_devices_c::is_usb_uhci_enabled(void)
|
||||
return 0;
|
||||
}
|
||||
|
||||
// common mouse device handlers
|
||||
// removable keyboard/mouse registration
|
||||
void bx_devices_c::register_removable_keyboard(void *dev, bx_keyb_enq_t keyb_enq)
|
||||
{
|
||||
if (bx_keyboard.dev == NULL) {
|
||||
bx_keyboard.dev = dev;
|
||||
bx_keyboard.enq_event = keyb_enq;
|
||||
}
|
||||
}
|
||||
|
||||
void bx_devices_c::unregister_removable_keyboard(void *dev)
|
||||
{
|
||||
if (dev == bx_mouse.dev) {
|
||||
bx_keyboard.dev = NULL;
|
||||
bx_keyboard.enq_event = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
void bx_devices_c::register_removable_mouse(void *dev, bx_mouse_enq_t mouse_enq,
|
||||
bx_mouse_enabled_changed_t mouse_enabled_changed)
|
||||
{
|
||||
if (bx_mouse_dev == NULL) {
|
||||
bx_mouse_dev = dev;
|
||||
bx_mouse_enq = mouse_enq;
|
||||
bx_mouse_enabled_changed = mouse_enabled_changed;
|
||||
if (bx_mouse.dev == NULL) {
|
||||
bx_mouse.dev = dev;
|
||||
bx_mouse.enq_event = mouse_enq;
|
||||
bx_mouse.enabled_changed = mouse_enabled_changed;
|
||||
}
|
||||
}
|
||||
|
||||
void bx_devices_c::unregister_removable_mouse(void *dev)
|
||||
{
|
||||
if (dev == bx_mouse_dev) {
|
||||
bx_mouse_dev = NULL;
|
||||
bx_mouse_enq = NULL;
|
||||
bx_mouse_enabled_changed = NULL;
|
||||
if (dev == bx_mouse.dev) {
|
||||
bx_mouse.dev = NULL;
|
||||
bx_mouse.enq_event = NULL;
|
||||
bx_mouse.enabled_changed = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
bx_bool bx_devices_c::optional_key_enq(Bit8u *scan_code)
|
||||
{
|
||||
if (bx_keyboard.dev != NULL) {
|
||||
return bx_keyboard.enq_event(bx_keyboard.dev, scan_code);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
// common mouse device handlers
|
||||
void bx_devices_c::mouse_enabled_changed(bx_bool enabled)
|
||||
{
|
||||
mouse_captured = enabled;
|
||||
if (bx_mouse_dev != NULL) {
|
||||
bx_mouse_enabled_changed(bx_mouse_dev, enabled);
|
||||
if (bx_mouse.dev != NULL) {
|
||||
bx_mouse.enabled_changed(bx_mouse.dev, enabled);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -1101,8 +1123,8 @@ void bx_devices_c::mouse_motion(int delta_x, int delta_y, int delta_z, unsigned
|
||||
return;
|
||||
|
||||
// if a removable mouse is connected, redirect mouse data to the device
|
||||
if (bx_mouse_dev != NULL) {
|
||||
bx_mouse_enq(bx_mouse_dev, delta_x, delta_y, delta_z, button_state);
|
||||
if (bx_mouse.dev != NULL) {
|
||||
bx_mouse.enq_event(bx_mouse.dev, delta_x, delta_y, delta_z, button_state);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: iodev.h,v 1.112 2009-03-02 21:21:16 vruppert Exp $
|
||||
// $Id: iodev.h,v 1.113 2009-03-03 18:29:51 vruppert Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2002 MandrakeSoft S.A.
|
||||
@ -48,6 +48,7 @@ class bx_g2h_c;
|
||||
typedef Bit32u (*bx_read_handler_t)(void *, Bit32u, unsigned);
|
||||
typedef void (*bx_write_handler_t)(void *, Bit32u, Bit32u, unsigned);
|
||||
|
||||
typedef bx_bool (*bx_keyb_enq_t)(void *, Bit8u *);
|
||||
typedef void (*bx_mouse_enq_t)(void *, int, int, int, unsigned);
|
||||
typedef void (*bx_mouse_enabled_changed_t)(void *, bx_bool);
|
||||
|
||||
@ -332,15 +333,6 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
#if BX_SUPPORT_PCIUSB
|
||||
class BOCHSAPI bx_pci_usb_stub_c : public bx_devmodel_c, public bx_pci_device_stub_c {
|
||||
public:
|
||||
virtual bx_bool usb_key_enq(Bit8u *scan_code) {
|
||||
return 0;
|
||||
}
|
||||
};
|
||||
#endif
|
||||
|
||||
#if BX_SUPPORT_ACPI
|
||||
class BOCHSAPI bx_acpi_ctrl_stub_c : public bx_devmodel_c, public bx_pci_device_stub_c {
|
||||
public:
|
||||
@ -421,8 +413,12 @@ public:
|
||||
bx_bool unregister_irq(unsigned irq, const char *name);
|
||||
Bit32u inp(Bit16u addr, unsigned io_len) BX_CPP_AttrRegparmN(2);
|
||||
void outp(Bit16u addr, Bit32u value, unsigned io_len) BX_CPP_AttrRegparmN(3);
|
||||
|
||||
void register_removable_keyboard(void *dev, bx_keyb_enq_t keyb_enq);
|
||||
void unregister_removable_keyboard(void *dev);
|
||||
void register_removable_mouse(void *dev, bx_mouse_enq_t mouse_enq, bx_mouse_enabled_changed_t mouse_enabled_changed);
|
||||
void unregister_removable_mouse(void *dev);
|
||||
bx_bool optional_key_enq(Bit8u *scan_code);
|
||||
void mouse_enabled_changed(bx_bool enabled);
|
||||
void mouse_motion(int delta_x, int delta_y, int delta_z, unsigned button_state);
|
||||
|
||||
@ -441,12 +437,6 @@ public:
|
||||
bx_floppy_stub_c *pluginFloppyDevice;
|
||||
bx_cmos_stub_c *pluginCmosDevice;
|
||||
bx_serial_stub_c *pluginSerialDevice;
|
||||
#if BX_SUPPORT_USB_UHCI
|
||||
bx_pci_usb_stub_c *pluginUSB_UHCI;
|
||||
#endif
|
||||
#if BX_SUPPORT_USB_OHCI
|
||||
bx_pci_usb_stub_c *pluginUSB_OHCI;
|
||||
#endif
|
||||
bx_vga_stub_c *pluginVgaDevice;
|
||||
bx_pic_stub_c *pluginPicDevice;
|
||||
bx_hard_drive_stub_c *pluginHardDrive;
|
||||
@ -483,9 +473,6 @@ public:
|
||||
bx_ne2k_stub_c stubNE2k;
|
||||
bx_speaker_stub_c stubSpeaker;
|
||||
bx_serial_stub_c stubSerial;
|
||||
#if BX_SUPPORT_PCIUSB
|
||||
bx_pci_usb_stub_c stubUsbAdapter;
|
||||
#endif
|
||||
#if BX_SUPPORT_ACPI
|
||||
bx_acpi_ctrl_stub_c stubACPIController;
|
||||
#endif
|
||||
@ -537,9 +524,15 @@ private:
|
||||
|
||||
bx_bool mouse_captured; // host mouse capture enabled
|
||||
Bit8u mouse_type;
|
||||
void *bx_mouse_dev;
|
||||
bx_mouse_enq_t bx_mouse_enq;
|
||||
bx_mouse_enabled_changed_t bx_mouse_enabled_changed;
|
||||
struct {
|
||||
void *dev;
|
||||
bx_mouse_enq_t enq_event;
|
||||
bx_mouse_enabled_changed_t enabled_changed;
|
||||
} bx_mouse;
|
||||
struct {
|
||||
void *dev;
|
||||
bx_keyb_enq_t enq_event;
|
||||
} bx_keyboard;
|
||||
|
||||
int timer_handle;
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: keyboard.cc,v 1.142 2009-02-23 11:06:53 vruppert Exp $
|
||||
// $Id: keyboard.cc,v 1.143 2009-03-03 18:29:51 vruppert Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2002 MandrakeSoft S.A.
|
||||
@ -126,7 +126,7 @@ void bx_keyb_c::resetinternals(bx_bool powerup)
|
||||
|
||||
void bx_keyb_c::init(void)
|
||||
{
|
||||
BX_DEBUG(("Init $Id: keyboard.cc,v 1.142 2009-02-23 11:06:53 vruppert Exp $"));
|
||||
BX_DEBUG(("Init $Id: keyboard.cc,v 1.143 2009-03-03 18:29:51 vruppert Exp $"));
|
||||
Bit32u i;
|
||||
|
||||
DEV_register_irq(1, "8042 Keyboard controller");
|
||||
@ -861,17 +861,10 @@ void bx_keyb_c::gen_scancode(Bit32u key)
|
||||
else
|
||||
scancode=(unsigned char *)scancodes[(key&0xFF)][BX_KEY_THIS s.kbd_controller.current_scancodes_set].make;
|
||||
|
||||
// if we have a keyboard/keypad installed, we need to call its handler first
|
||||
#if BX_SUPPORT_USB_UHCI
|
||||
if (DEV_usb_uhci_key_enq(scancode)) {
|
||||
// if we have a removable keyboard installed, we need to call its handler first
|
||||
if (DEV_optional_key_enq(scancode)) {
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
#if BX_SUPPORT_USB_OHCI
|
||||
if (DEV_usb_ohci_key_enq(scancode)) {
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (BX_KEY_THIS s.kbd_controller.scancodes_translate) {
|
||||
// Translate before send
|
||||
|
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: usb_hid.cc,v 1.15 2009-03-02 21:21:16 vruppert Exp $
|
||||
// $Id: usb_hid.cc,v 1.16 2009-03-03 18:29:51 vruppert Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2009 Volker Ruppert
|
||||
@ -366,6 +366,7 @@ usb_hid_device_c::usb_hid_device_c(usbdev_type type)
|
||||
DEV_register_removable_mouse((void*)this, mouse_enq_static, mouse_enabled_changed);
|
||||
} else if (d.type == USB_DEV_TYPE_KEYPAD) {
|
||||
strcpy(d.devname, "USB/PS2 Keypad");
|
||||
DEV_register_removable_keyboard((void*)this, key_enq_static);
|
||||
}
|
||||
d.connected = 1;
|
||||
memset((void*)&s, 0, sizeof(s));
|
||||
@ -378,6 +379,8 @@ usb_hid_device_c::~usb_hid_device_c(void)
|
||||
if ((d.type == USB_DEV_TYPE_MOUSE) ||
|
||||
(d.type == USB_DEV_TYPE_TABLET)) {
|
||||
DEV_unregister_removable_mouse((void*)this);
|
||||
} else if (d.type == USB_DEV_TYPE_KEYPAD) {
|
||||
DEV_unregister_removable_keyboard((void*)this);
|
||||
}
|
||||
}
|
||||
|
||||
@ -739,6 +742,11 @@ int usb_hid_device_c::keypad_poll(Bit8u *buf, int len)
|
||||
return l;
|
||||
}
|
||||
|
||||
bx_bool usb_hid_device_c::key_enq_static(void *dev, Bit8u *scan_code)
|
||||
{
|
||||
return ((usb_hid_device_c*)dev)->key_enq(scan_code);
|
||||
}
|
||||
|
||||
bx_bool usb_hid_device_c::key_enq(Bit8u *scan_code)
|
||||
{
|
||||
bx_bool is_break_code = 0;
|
||||
|
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: usb_hid.h,v 1.10 2009-03-02 21:21:16 vruppert Exp $
|
||||
// $Id: usb_hid.h,v 1.11 2009-03-03 18:29:51 vruppert Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2009 Volker Ruppert
|
||||
@ -34,7 +34,6 @@ public:
|
||||
virtual int handle_control(int request, int value, int index, int length, Bit8u *data);
|
||||
virtual int handle_data(USBPacket *p);
|
||||
virtual void register_state_specific(bx_list_c *parent);
|
||||
bx_bool key_enq(Bit8u *scan_code);
|
||||
|
||||
private:
|
||||
struct {
|
||||
@ -49,6 +48,8 @@ private:
|
||||
Bit8u key_pad_packet[8];
|
||||
} s;
|
||||
|
||||
static bx_bool key_enq_static(void *dev, Bit8u *scan_code);
|
||||
bx_bool key_enq(Bit8u *scan_code);
|
||||
static void mouse_enabled_changed(void *dev, bx_bool enabled);
|
||||
static void mouse_enq_static(void *dev, int delta_x, int delta_y, int delta_z, unsigned button_state);
|
||||
void mouse_enq(int delta_x, int delta_y, int delta_z, unsigned button_state);
|
||||
|
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: usb_ohci.cc,v 1.13 2009-03-02 21:21:16 vruppert Exp $
|
||||
// $Id: usb_ohci.cc,v 1.14 2009-03-03 18:29:51 vruppert Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2009 Benjamin D Lunt (fys at frontiernet net)
|
||||
@ -81,7 +81,6 @@ const char *usb_ohci_port_name[] = {
|
||||
int libusb_ohci_LTX_plugin_init(plugin_t *plugin, plugintype_t type, int argc, char *argv[])
|
||||
{
|
||||
theUSB_OHCI = new bx_usb_ohci_c();
|
||||
bx_devices.pluginUSB_OHCI = theUSB_OHCI;
|
||||
BX_REGISTER_DEVICE_DEVMODEL(plugin, type, theUSB_OHCI, BX_PLUGIN_USB_OHCI);
|
||||
return 0; // Success
|
||||
}
|
||||
@ -152,7 +151,6 @@ void bx_usb_ohci_c::init(void)
|
||||
for (i=0; i<USB_NUM_PORTS; i++) {
|
||||
BX_OHCI_THIS hub.usb_port[i].device = NULL;
|
||||
}
|
||||
BX_OHCI_THIS keybdev = NULL;
|
||||
|
||||
//HACK: Turn on debug messages from the start
|
||||
//BX_OHCI_THIS setonoff(LOGLEV_DEBUG, ACT_REPORT);
|
||||
@ -470,9 +468,6 @@ void bx_usb_ohci_c::init_device(Bit8u port, const char *devname)
|
||||
} else if (!strcmp(devname, "keypad")) {
|
||||
type = USB_DEV_TYPE_KEYPAD;
|
||||
BX_OHCI_THIS hub.usb_port[port].device = new usb_hid_device_c(type);
|
||||
if (BX_OHCI_THIS keybdev == NULL) {
|
||||
BX_OHCI_THIS keybdev = (usb_hid_device_c*)BX_OHCI_THIS hub.usb_port[port].device;
|
||||
}
|
||||
} else if (!strncmp(devname, "disk", 4)) {
|
||||
if ((strlen(devname) > 5) && (devname[4] == ':')) {
|
||||
type = USB_DEV_TYPE_DISK;
|
||||
@ -494,15 +489,8 @@ void bx_usb_ohci_c::init_device(Bit8u port, const char *devname)
|
||||
void bx_usb_ohci_c::remove_device(Bit8u port)
|
||||
{
|
||||
char pname[BX_PATHNAME_LEN];
|
||||
int type;
|
||||
|
||||
if (BX_OHCI_THIS hub.usb_port[port].device != NULL) {
|
||||
type = BX_OHCI_THIS hub.usb_port[port].device->get_type();
|
||||
if (type == USB_DEV_TYPE_KEYPAD) {
|
||||
if (BX_OHCI_THIS hub.usb_port[port].device == BX_OHCI_THIS keybdev) {
|
||||
BX_OHCI_THIS keybdev = NULL;
|
||||
}
|
||||
}
|
||||
delete BX_OHCI_THIS hub.usb_port[port].device;
|
||||
BX_OHCI_THIS hub.usb_port[port].device = NULL;
|
||||
sprintf(pname, "usb_ohci.hub.port%d.device", port+1);
|
||||
@ -1501,14 +1489,6 @@ void bx_usb_ohci_c::usb_set_connect_status(Bit8u port, int type, bx_bool connect
|
||||
}
|
||||
}
|
||||
|
||||
bx_bool bx_usb_ohci_c::usb_key_enq(Bit8u *scan_code)
|
||||
{
|
||||
if (BX_OHCI_THIS keybdev != NULL) {
|
||||
return keybdev->key_enq(scan_code);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
// USB runtime parameter handler
|
||||
const char *bx_usb_ohci_c::usb_param_handler(bx_param_string_c *param, int set,
|
||||
const char *oldval, const char *val, int maxlen)
|
||||
|
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: usb_ohci.h,v 1.9 2009-03-02 21:21:16 vruppert Exp $
|
||||
// $Id: usb_ohci.h,v 1.10 2009-03-03 18:29:51 vruppert Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2009 Benjamin D Lunt (fys at frontiernet net)
|
||||
@ -247,13 +247,12 @@ typedef struct {
|
||||
|
||||
|
||||
|
||||
class bx_usb_ohci_c : public bx_pci_usb_stub_c {
|
||||
class bx_usb_ohci_c : public bx_devmodel_c, public bx_pci_device_stub_c {
|
||||
public:
|
||||
bx_usb_ohci_c();
|
||||
virtual ~bx_usb_ohci_c();
|
||||
virtual void init(void);
|
||||
virtual void reset(unsigned);
|
||||
virtual bx_bool usb_key_enq(Bit8u *scan_code);
|
||||
virtual void register_state(void);
|
||||
virtual void after_restore_state(void);
|
||||
virtual Bit32u pci_read_handler(Bit8u address, unsigned io_len);
|
||||
@ -267,8 +266,6 @@ private:
|
||||
bx_usb_ohci_t hub;
|
||||
Bit8u *device_buffer;
|
||||
|
||||
usb_hid_device_c *keybdev;
|
||||
|
||||
USBPacket usb_packet;
|
||||
|
||||
static void reset_hc();
|
||||
|
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: usb_uhci.cc,v 1.11 2009-03-02 21:21:16 vruppert Exp $
|
||||
// $Id: usb_uhci.cc,v 1.12 2009-03-03 18:29:51 vruppert Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2009 Benjamin D Lunt (fys at frontiernet net)
|
||||
@ -48,7 +48,6 @@ const Bit8u uhci_iomask[32] = {2, 1, 2, 1, 2, 1, 2, 0, 4, 0, 0, 0, 1, 0, 0, 0,
|
||||
int libusb_uhci_LTX_plugin_init(plugin_t *plugin, plugintype_t type, int argc, char *argv[])
|
||||
{
|
||||
theUSB_UHCI = new bx_usb_uhci_c();
|
||||
bx_devices.pluginUSB_UHCI = theUSB_UHCI;
|
||||
BX_REGISTER_DEVICE_DEVMODEL(plugin, type, theUSB_UHCI, BX_PLUGIN_USB_UHCI);
|
||||
return 0; // Success
|
||||
}
|
||||
@ -116,7 +115,6 @@ void bx_usb_uhci_c::init(void)
|
||||
for (i=0; i<USB_NUM_PORTS; i++) {
|
||||
BX_UHCI_THIS hub.usb_port[i].device = NULL;
|
||||
}
|
||||
BX_UHCI_THIS keybdev = NULL;
|
||||
|
||||
//HACK: Turn on debug messages from the start
|
||||
//BX_UHCI_THIS setonoff(LOGLEV_DEBUG, ACT_REPORT);
|
||||
@ -300,9 +298,6 @@ void bx_usb_uhci_c::init_device(Bit8u port, const char *devname)
|
||||
} else if (!strcmp(devname, "keypad")) {
|
||||
type = USB_DEV_TYPE_KEYPAD;
|
||||
BX_UHCI_THIS hub.usb_port[port].device = new usb_hid_device_c(type);
|
||||
if (BX_UHCI_THIS keybdev == NULL) {
|
||||
BX_UHCI_THIS keybdev = (usb_hid_device_c*)BX_UHCI_THIS hub.usb_port[port].device;
|
||||
}
|
||||
} else if (!strncmp(devname, "disk", 4)) {
|
||||
if ((strlen(devname) > 5) && (devname[4] == ':')) {
|
||||
type = USB_DEV_TYPE_DISK;
|
||||
@ -324,15 +319,8 @@ void bx_usb_uhci_c::init_device(Bit8u port, const char *devname)
|
||||
void bx_usb_uhci_c::remove_device(Bit8u port)
|
||||
{
|
||||
char pname[BX_PATHNAME_LEN];
|
||||
int type;
|
||||
|
||||
if (BX_UHCI_THIS hub.usb_port[port].device != NULL) {
|
||||
type = BX_UHCI_THIS hub.usb_port[port].device->get_type();
|
||||
if (type == USB_DEV_TYPE_KEYPAD) {
|
||||
if (BX_UHCI_THIS hub.usb_port[port].device == BX_UHCI_THIS keybdev) {
|
||||
BX_UHCI_THIS keybdev = NULL;
|
||||
}
|
||||
}
|
||||
delete BX_UHCI_THIS hub.usb_port[port].device;
|
||||
BX_UHCI_THIS hub.usb_port[port].device = NULL;
|
||||
sprintf(pname, "usb_uhci.hub.port%d.device", port+1);
|
||||
@ -1120,14 +1108,6 @@ void bx_usb_uhci_c::usb_set_connect_status(Bit8u port, int type, bx_bool connect
|
||||
}
|
||||
}
|
||||
|
||||
bx_bool bx_usb_uhci_c::usb_key_enq(Bit8u *scan_code)
|
||||
{
|
||||
if (BX_UHCI_THIS keybdev != NULL) {
|
||||
return keybdev->key_enq(scan_code);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
// USB runtime parameter handler
|
||||
const char *bx_usb_uhci_c::usb_param_handler(bx_param_string_c *param, int set,
|
||||
const char *oldval, const char *val, int maxlen)
|
||||
|
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: usb_uhci.h,v 1.7 2009-03-02 21:21:16 vruppert Exp $
|
||||
// $Id: usb_uhci.h,v 1.8 2009-03-03 18:29:51 vruppert Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2009 Benjamin D Lunt (fys at frontiernet net)
|
||||
@ -181,13 +181,12 @@ struct HCSTACK {
|
||||
bx_bool t;
|
||||
};
|
||||
|
||||
class bx_usb_uhci_c : public bx_pci_usb_stub_c {
|
||||
class bx_usb_uhci_c : public bx_devmodel_c, public bx_pci_device_stub_c {
|
||||
public:
|
||||
bx_usb_uhci_c();
|
||||
virtual ~bx_usb_uhci_c();
|
||||
virtual void init(void);
|
||||
virtual void reset(unsigned);
|
||||
virtual bx_bool usb_key_enq(Bit8u *scan_code);
|
||||
virtual void register_state(void);
|
||||
virtual void after_restore_state(void);
|
||||
virtual Bit32u pci_read_handler(Bit8u address, unsigned io_len);
|
||||
@ -202,8 +201,6 @@ private:
|
||||
bx_bool busy;
|
||||
Bit8u *device_buffer;
|
||||
|
||||
usb_hid_device_c *keybdev;
|
||||
|
||||
USBPacket usb_packet;
|
||||
|
||||
static void set_irq_level(bx_bool level);
|
||||
|
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: plugin.h,v 1.76 2009-03-02 21:21:16 vruppert Exp $
|
||||
// $Id: plugin.h,v 1.77 2009-03-03 18:29:51 vruppert Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2009 The Bochs Project
|
||||
@ -124,6 +124,11 @@ extern "C" {
|
||||
#define DEV_mouse_enabled_changed(en) (bx_devices.mouse_enabled_changed(en))
|
||||
#define DEV_mouse_motion(dx, dy, state) (bx_devices.mouse_motion(dx, dy, 0, state))
|
||||
#define DEV_mouse_motion_ext(dx, dy, dz, state) (bx_devices.mouse_motion(dx, dy, dz, state))
|
||||
|
||||
///////// Removable devices macros
|
||||
#define DEV_optional_key_enq(a) (bx_devices.optional_key_enq(a))
|
||||
#define DEV_register_removable_keyboard(a,b) (bx_devices.register_removable_keyboard(a,b))
|
||||
#define DEV_unregister_removable_keyboard(a) (bx_devices.unregister_removable_keyboard(a))
|
||||
#define DEV_register_removable_mouse(a,b,c) (bx_devices.register_removable_mouse(a,b,c))
|
||||
#define DEV_unregister_removable_mouse(a) (bx_devices.unregister_removable_mouse(a))
|
||||
|
||||
@ -229,16 +234,6 @@ extern "C" {
|
||||
#define DEV_speaker_beep_on(frequency) bx_devices.pluginSpeaker->beep_on(frequency)
|
||||
#define DEV_speaker_beep_off() bx_devices.pluginSpeaker->beep_off()
|
||||
|
||||
///////// USB device macros
|
||||
#if BX_SUPPORT_USB_UHCI
|
||||
#define DEV_usb_uhci_key_enq(scan_code) \
|
||||
(bx_devices.pluginUSB_UHCI->usb_key_enq(scan_code))
|
||||
#endif
|
||||
#if BX_SUPPORT_USB_OHCI
|
||||
#define DEV_usb_ohci_key_enq(scan_code) \
|
||||
(bx_devices.pluginUSB_OHCI->usb_key_enq(scan_code))
|
||||
#endif
|
||||
|
||||
//////// Memory macros
|
||||
#define DEV_register_memory_handlers(param,rh,wh,b,e) \
|
||||
bx_devices.mem->registerMemoryHandlers(param,rh,wh,b,e)
|
||||
|
Loading…
x
Reference in New Issue
Block a user