Changeset 20235a3 in mainline for uspace/srv/hid/kbd/port/chardev.c
- Timestamp:
- 2010-09-02T20:55:28Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 0c39b96
- Parents:
- 0c61955 (diff), 3249673 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/hid/kbd/port/chardev.c
r0c61955 r20235a3 41 41 #include <kbd.h> 42 42 #include <vfs/vfs.h> 43 #include <sys/stat.h> 43 44 #include <fcntl.h> 44 45 #include <errno.h> … … 50 51 #define NAME "kbd" 51 52 53 /** List of devices to try connecting to. */ 54 static const char *in_devs[] = { 55 "/dev/char/ps2a", 56 "/dev/char/s3c24ser" 57 }; 58 59 static const int num_devs = sizeof(in_devs) / sizeof(in_devs[0]); 60 52 61 int kbd_port_init(void) 53 62 { 54 const char *input = "/dev/char/ps2a";55 63 int input_fd; 64 int i; 56 65 57 printf(NAME ": open %s\n", input); 66 input_fd = -1; 67 for (i = 0; i < num_devs; i++) { 68 struct stat s; 58 69 59 input_fd = open(input, O_RDONLY); 70 if (stat(in_devs[i], &s) == EOK) 71 break; 72 } 73 74 if (i >= num_devs) { 75 printf(NAME ": Could not find any suitable input device.\n"); 76 return -1; 77 } 78 79 input_fd = open(in_devs[i], O_RDONLY); 60 80 if (input_fd < 0) { 61 printf(NAME ": Failed opening %s (%d)\n", input, input_fd); 62 return false; 81 printf(NAME ": failed opening device %s (%d).\n", in_devs[i], 82 input_fd); 83 return -1; 63 84 } 64 85 65 86 dev_phone = fd_phone(input_fd); 66 87 if (dev_phone < 0) { 67 printf(NAME ": Failed to connectto device\n");68 return false;88 printf(NAME ": Failed connecting to device\n"); 89 return -1; 69 90 } 70 91 … … 73 94 if (ipc_connect_to_me(dev_phone, 0, 0, 0, &phonehash) != 0) { 74 95 printf(NAME ": Failed to create callback from device\n"); 75 return false;96 return -1; 76 97 } 77 98
Note:
See TracChangeset
for help on using the changeset viewer.