Changeset 12280 in vbox for trunk/src/VBox/Additions/linux/module
- Timestamp:
- Sep 9, 2008 10:07:14 AM (16 years ago)
- Location:
- trunk/src/VBox/Additions/linux/module
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/linux/module/vboxmod.c
r11642 r12280 73 73 #include <iprt/assert.h> 74 74 #include <linux/miscdevice.h> 75 #include <linux/poll.h> 75 76 76 77 #define xstr(s) str(s) … … 206 207 } 207 208 208 209 209 /** 210 210 * File open handler … … 215 215 /* no checks required */ 216 216 return 0; 217 }218 219 /**220 * File close handler. Clean up any HGCM connections associated with the open file221 * which might still be open.222 */223 static int vboxadd_release(struct inode *inode, struct file * filp)224 {225 vboxadd_unregister_all_hgcm_connections(filp);226 return 0;227 217 } 228 218 … … 585 575 } 586 576 587 #ifdef DEBUG 577 /** 578 * Poll function. This returns "ready to read" if the guest is in absolute 579 * mouse pointer mode and the pointer position has changed since the last 580 * poll. 581 */ 582 unsigned int 583 vboxadd_poll (struct file *file, poll_table *wait) 584 { 585 int result = 0; 586 poll_wait(file, &vboxDev->eventq, wait); 587 if (vboxDev->u32Events & VMMDEV_EVENT_MOUSE_POSITION_CHANGED) 588 result = (POLLIN | POLLRDNORM); 589 vboxDev->u32Events &= ~VMMDEV_EVENT_MOUSE_POSITION_CHANGED; 590 return result; 591 } 592 593 /** Asynchronous notification activation method. */ 594 static int 595 vboxadd_fasync(int fd, struct file *file, int mode) 596 { 597 return fasync_helper(fd, file, mode, &vboxDev->async_queue); 598 } 599 600 /** 601 * Dummy read function - we only supply this because we implement poll and 602 * fasync. 603 */ 588 604 static ssize_t 589 605 vboxadd_read (struct file *file, char *buf, size_t count, loff_t *loff) 590 606 { 591 if ( count != 8|| *loff != 0)607 if (0 == count || *loff != 0) 592 608 { 593 609 return -EINVAL; 594 610 } 595 *(uint32_t *) buf = vboxDev->pVMMDevMemory->V.V1_04.fHaveEvents; 596 *(uint32_t *) (buf + 4) = vboxDev->u32Events; 597 *loff += 8; 598 return 8; 599 } 600 #endif 611 buf[0] = 0; 612 return 1; 613 } 614 615 /** 616 * File close handler. Clean up any HGCM connections associated with the open file 617 * which might still be open. 618 */ 619 static int vboxadd_release(struct inode *inode, struct file * filp) 620 { 621 vboxadd_unregister_all_hgcm_connections(filp); 622 /* Deactivate our asynchronous queue. */ 623 vboxadd_fasync(-1, filp, 0); 624 return 0; 625 } 601 626 602 627 /** strategy handlers (file operations) */ … … 605 630 .owner = THIS_MODULE, 606 631 .open = vboxadd_open, 632 .ioctl = vboxadd_ioctl, 633 .poll = vboxadd_poll, 634 .fasync = vboxadd_fasync, 635 .read = vboxadd_read, 607 636 .release = vboxadd_release, 608 .ioctl = vboxadd_ioctl,609 #ifdef DEBUG610 .read = vboxadd_read,611 #endif612 637 .llseek = no_llseek 613 638 }; … … 666 691 { 667 692 vboxDev->u32Events |= vboxDev->irqAckRequest->events; 693 if ( vboxDev->irqAckRequest->events 694 & VMMDEV_EVENT_MOUSE_POSITION_CHANGED) 695 kill_fasync(&vboxDev->async_queue, SIGIO, POLL_IN); 668 696 wake_up (&vboxDev->eventq); 669 697 } … … 824 852 if (vboxDev) 825 853 { 826 /* at first detach from IRQ! */ 854 { 855 /* Unregister notifications when the host absolute pointer 856 * position changes. */ 857 VBoxGuestFilterMaskInfo info; 858 info.u32OrMask = 0; 859 info.u32NotMask = VMMDEV_EVENT_MOUSE_POSITION_CHANGED; 860 vboxadd_control_filter_mask(&info); 861 } 862 /* Detach from IRQ before cleaning up! */ 827 863 if (vboxDev->irq) 828 864 free_irq(vboxDev->irq, vboxDev); … … 1061 1097 1062 1098 init_waitqueue_head (&vboxDev->eventq); 1099 1100 { 1101 /* Register for notification when the host absolute pointer position 1102 * changes. */ 1103 VBoxGuestFilterMaskInfo info; 1104 info.u32OrMask = VMMDEV_EVENT_MOUSE_POSITION_CHANGED; 1105 info.u32NotMask = 0; 1106 rcVBox = vboxadd_control_filter_mask(&info); 1107 if (!RT_SUCCESS(rcVBox)) 1108 { 1109 LogRelFunc(("failed to register for VMMDEV_EVENT_MOUSE_POSITION_CHANGED events\n")); 1110 err = -RTErrConvertToErrno(rcVBox); 1111 goto fail; 1112 } 1113 } 1063 1114 1064 1115 /* some useful information for the user but don't show this on the console */ -
trunk/src/VBox/Additions/linux/module/vboxmod.h
r8155 r12280 59 59 event. */ 60 60 uint32_t u32GuestInterruptions; 61 /** Queue structure */ 62 struct fasync_struct *async_queue; 61 63 }; 62 64
Note:
See TracChangeset
for help on using the changeset viewer.