Changes in uspace/srv/hid/kbd/port/chardev.c [a000878c:a9b5b5f] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/hid/kbd/port/chardev.c
ra000878c ra9b5b5f 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.