Palacios Public Git Repository

To checkout Palacios execute

  git clone http://v3vee.org/palacios/palacios.web/palacios.git
This will give you the master branch. You probably want the devel branch or one of the release branches. To switch to the devel branch, simply execute
  cd palacios
  git checkout --track -b devel origin/devel
The other branches are similar.


Revised mouse-related host events, graphics console, and userland support; mouse...
[palacios.releases.git] / palacios / src / devices / keyboard.c
index cbdad8c..10f3732 100644 (file)
@@ -246,13 +246,15 @@ static int update_kb_irq(struct keyboard_internal * state) {
        state->status.mouse_buf_full = 1;
     } 
     
-    PrintDebug(VM_NONE, VCORE_NONE, "keyboard: interrupt 0x%d\n", irq_num);
+    PrintDebug(VM_NONE, VCORE_NONE, "keyboard: interrupt 0x%x\n", irq_num);
     
     if (irq_num) {
        // Global output buffer flag (for both Keyboard and mouse)
        state->status.out_buf_full = 1;
        
-       if (state->cmd.irq_en == 1) { 
+       if ((irq_num==KEYBOARD_IRQ && state->cmd.irq_en == 1) || 
+           (irq_num==MOUSE_IRQ && state->cmd.mouse_irq_en == 1)) { 
+
            v3_raise_irq(state->vm, irq_num);
        }
     }
@@ -432,16 +434,35 @@ static int mouse_event_handler(struct v3_vm_info * vm,
 
     switch (kbd->mouse_state) { 
        case STREAM:
-
+           // packet is 3 bytes of form
+           // YO | XO | YS | XS | 1 | MIDDLE | RIGHT | LEFT
+           // DX
+           // YY
            if (kbd->cmd.mouse_disable == 0) {
-               push_to_output_queue(kbd, evt->data[0], DATA, MOUSE);
-               push_to_output_queue(kbd, evt->data[1], DATA, MOUSE);
-               push_to_output_queue(kbd, evt->data[2], DATA, MOUSE);
+               uint8_t h;
+               // YO=0
+               // XO=0
+               // bit 3 set
+               h=0x08; 
+               // YS bit
+               h |= (!!(evt->sy)) << 5;
+               // XS bit
+               h |= (!!(evt->sx)) << 4;
+               // buttons
+               h |= (evt->buttons) & 0x7;
+               // header byte
+               push_to_output_queue(kbd, h, DATA, MOUSE);
+               // dx
+               push_to_output_queue(kbd, evt->dx, DATA, MOUSE);
+               // dy
+               push_to_output_queue(kbd, evt->dy, DATA, MOUSE);
+           } else {
+               PrintDebug(vm,VCORE_NONE, "Ignoring mouse event because mouse is disabled\n");
            }
            break;
        default:
-           PrintError(vm, VCORE_NONE, "Invalid mouse state\n");
-           ret = -1;
+           PrintDebug(vm, VCORE_NONE, "Ignoring mouse event due to mouse not being in stream mode\n");
+           ret = 0;
            break;
     }