Changeset 9f51afc in mainline
- Timestamp:
- 2009-12-30T14:15:18Z (15 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 73f56e4, d557e4f
- Parents:
- 3f29834
- Files:
-
- 16 added
- 1 deleted
- 5 edited
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
boot/arch/amd64/Makefile.inc
r3f29834 r9f51afc 31 31 RD_SRVS += \ 32 32 $(USPACEDIR)/srv/pci/pci \ 33 $(USPACEDIR)/srv/bd/ata_bd/ata_bd 33 $(USPACEDIR)/srv/bd/ata_bd/ata_bd \ 34 $(USPACEDIR)/srv/char/i8042/i8042 \ 35 $(USPACEDIR)/srv/mouse/c_mouse/c_mouse 34 36 35 37 MODULES := $(notdir $(COMPONENTS)) -
uspace/Makefile
r3f29834 r9f51afc 41 41 srv/fb \ 42 42 srv/kbd \ 43 srv/char/i8042 \ 43 44 srv/console \ 44 45 srv/fs/fat \ 45 46 srv/fs/tmpfs \ 46 47 srv/fs/devfs \ 48 srv/mouse/c_mouse \ 47 49 srv/vfs \ 48 50 srv/devmap \ -
uspace/app/init/init.c
r3f29834 r9f51afc 265 265 spawn("/srv/fhc"); 266 266 spawn("/srv/obio"); 267 srv_start("/srv/i8042"); 268 srv_start("/srv/c_mouse"); 267 269 268 270 spawn("/srv/fb"); -
uspace/srv/char/i8042/i8042.h
r3f29834 r9f51afc 36 36 */ 37 37 38 #ifndef KBD_PORT_i8042_H_39 #define KBD_PORT_i8042_H_38 #ifndef i8042_H_ 39 #define i8042_H_ 40 40 41 41 #include <libarch/ddi.h> 42 42 #include <libarch/types.h> 43 43 44 /** i8042 HW I/O interface */ 44 45 struct i8042 { 45 46 ioport8_t data; … … 49 50 typedef struct i8042 i8042_t; 50 51 52 /** Softstate structure, one for each serial port (primary and aux). */ 53 typedef struct { 54 dev_handle_t dev_handle; 55 int client_phone; 56 } i8042_port_t; 57 51 58 #endif 52 59 -
uspace/srv/console/console.c
r3f29834 r9f51afc 37 37 #include <ipc/kbd.h> 38 38 #include <io/keycode.h> 39 #include <ipc/mouse.h> 39 40 #include <ipc/fb.h> 40 41 #include <ipc/services.h> … … 64 65 /** Phone to the keyboard driver. */ 65 66 static int kbd_phone; 67 68 /** Phone to the mouse driver. */ 69 static int mouse_phone; 66 70 67 71 /** Information about framebuffer */ … … 426 430 } 427 431 432 /** Handler for mouse events */ 433 static void mouse_events(ipc_callid_t iid, ipc_call_t *icall) 434 { 435 int button, press; 436 int dx, dy; 437 int newcon; 438 439 /* Ignore parameters, the connection is already opened */ 440 while (true) { 441 442 ipc_call_t call; 443 ipc_callid_t callid = async_get_call(&call); 444 445 int retval; 446 447 switch (IPC_GET_METHOD(call)) { 448 case IPC_M_PHONE_HUNGUP: 449 /* TODO: Handle hangup */ 450 return; 451 case MEVENT_BUTTON: 452 button = IPC_GET_ARG1(call); 453 press = IPC_GET_ARG2(call); 454 if (button == 1) { 455 newcon = gcons_mouse_btn(press); 456 if (newcon != -1) 457 change_console(&consoles[newcon]); 458 } 459 retval = 0; 460 break; 461 case MEVENT_MOVE: 462 dx = IPC_GET_ARG1(call); 463 dy = IPC_GET_ARG2(call); 464 gcons_mouse_move(dx, dy); 465 retval = 0; 466 break; 467 default: 468 retval = ENOENT; 469 } 470 471 ipc_answer_0(callid, retval); 472 } 473 } 474 428 475 static void cons_write(console_t *cons, ipc_callid_t rid, ipc_call_t *request) 429 476 { … … 675 722 return false; 676 723 } 677 724 678 725 kbd_phone = fd_phone(input_fd); 679 726 if (kbd_phone < 0) { … … 681 728 return false; 682 729 } 683 730 684 731 /* NB: The callback connection is slotted for removal */ 685 732 ipcarg_t phonehash; … … 688 735 return false; 689 736 } 690 737 691 738 async_new_connection(phonehash, 0, NULL, keyboard_events); 739 740 /* Connect to mouse device */ 741 mouse_phone = -1; 742 int mouse_fd = open("/dev/hid_in/mouse", O_RDONLY); 743 744 if (mouse_fd < 0) { 745 printf(NAME ": Notice - failed opening %s\n", "/dev/hid_in/mouse"); 746 goto skip_mouse; 747 } 748 749 mouse_phone = fd_phone(mouse_fd); 750 if (mouse_phone < 0) { 751 printf(NAME ": Failed to connect to mouse device\n"); 752 goto skip_mouse; 753 } 754 755 if (ipc_connect_to_me(mouse_phone, SERVICE_CONSOLE, 0, 0, &phonehash) != 0) { 756 printf(NAME ": Failed to create callback from mouse device\n"); 757 mouse_phone = -1; 758 goto skip_mouse; 759 } 760 761 async_new_connection(phonehash, 0, NULL, mouse_events); 762 skip_mouse: 692 763 693 764 /* Connect to framebuffer driver */ … … 697 768 return -1; 698 769 } 699 770 700 771 /* Register driver */ 701 772 int rc = devmap_driver_register(NAME, client_connection); -
uspace/srv/kbd/Makefile.build
r3f29834 r9f51afc 75 75 ifeq ($(UARCH),ia32) 76 76 SOURCES += \ 77 port/ i8042.c \77 port/chardev.c \ 78 78 ctl/pc.c 79 79 endif
Note:
See TracChangeset
for help on using the changeset viewer.