Changeset 75732da in mainline for uspace/app
- Timestamp:
- 2010-12-13T07:20:20Z (15 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 309dea52
- Parents:
- 84439d7 (diff), 37f7cfe (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. - Location:
- uspace/app
- Files:
-
- 6 added
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/netecho/print_error.c
r84439d7 r75732da 164 164 case EDESTADDRREQ: 165 165 fprintf(output, "Destination address required (%d) error", error_code); 166 case TRY_AGAIN:166 case EAGAIN: 167 167 fprintf(output, "Try again (%d) error", error_code); 168 168 default: -
uspace/app/tester/Makefile
r84439d7 r75732da 31 31 BINARY = tester 32 32 33 LIBS += $(LIBUSB_PREFIX)/libusb.a 34 EXTRA_CFLAGS += -I$(LIBUSB_PREFIX)/include 35 33 36 SOURCES = \ 34 37 tester.c \ 38 adt/usbaddrkeep.c \ 35 39 thread/thread1.c \ 36 40 print/print1.c \ -
uspace/app/tester/tester.c
r84439d7 r75732da 65 65 #include "mm/malloc1.def" 66 66 #include "hw/serial/serial1.def" 67 #include "adt/usbaddrkeep.def" 67 68 {NULL, NULL, NULL, false} 68 69 }; -
uspace/app/tester/tester.h
r84439d7 r75732da 82 82 extern const char *test_malloc1(void); 83 83 extern const char *test_serial1(void); 84 extern const char *test_usbaddrkeep(void); 84 85 85 86 extern test_t tests[]; -
uspace/app/virtusbkbd/Makefile
r84439d7 r75732da 33 33 34 34 LIBS = $(LIBUSB_PREFIX)/libusb.a $(LIBUSBVIRT_PREFIX)/libusbvirt.a 35 EXTRA_CFLAGS = -I$(LIBUSB_PREFIX)/include -I$(LIBUSBVIRT_PREFIX)/include 35 EXTRA_CFLAGS = -I$(LIBUSB_PREFIX)/include -I$(LIBUSBVIRT_PREFIX)/include -I$(LIBDRV_PREFIX)/include 36 36 37 37 SOURCES = \ -
uspace/app/virtusbkbd/virtusbkbd.c
r84439d7 r75732da 55 55 #include "stdreq.h" 56 56 57 #define LOOPS 5 57 /** Pause between individual key-presses in seconds. */ 58 #define KEY_PRESS_DELAY 2 58 59 #define NAME "virt-usb-kbd" 59 60 … … 83 84 } 84 85 86 /** Compares current and last status of pressed keys. 87 * 88 * @warning Has side-efect - changes status_last field. 89 * 90 * @param status_now Status now. 91 * @param status_last Last status. 92 * @param len Size of status. 93 * @return Whether they are the same. 94 */ 95 static bool keypress_check_with_last_request(uint8_t *status_now, 96 uint8_t *status_last, size_t len) 97 { 98 bool same = true; 99 size_t i; 100 for (i = 0; i < len; i++) { 101 if (status_now[i] != status_last[i]) { 102 status_last[i] = status_now[i]; 103 same = false; 104 } 105 } 106 return same; 107 } 108 85 109 static int on_request_for_data(struct usbvirt_device *dev, 86 110 usb_endpoint_t endpoint, void *buffer, size_t size, size_t *actual_size) 87 111 { 112 static uint8_t last_data[2 + KB_MAX_KEYS_AT_ONCE]; 113 88 114 if (size < 2 + KB_MAX_KEYS_AT_ONCE) { 89 115 return EINVAL; … … 101 127 } 102 128 129 if (keypress_check_with_last_request(data, last_data, 130 2 + KB_MAX_KEYS_AT_ONCE)) { 131 *actual_size = 0; 132 return EOK; 133 } 134 103 135 memcpy(buffer, &data, *actual_size); 104 136 … … 153 185 .ops = &keyboard_ops, 154 186 .descriptors = &descriptors, 187 .lib_debug_level = 3, 188 .lib_debug_enabled_tags = USBVIRT_DEBUGTAG_ALL, 155 189 .name = "keyboard" 156 190 }; … … 178 212 printf("\n"); 179 213 180 fibril_sleep( 1);214 fibril_sleep(KEY_PRESS_DELAY); 181 215 } 182 216 … … 203 237 int main(int argc, char * argv[]) 204 238 { 205 printf("Dump of report descriptor (% u bytes):\n", report_descriptor_size);239 printf("Dump of report descriptor (%zu bytes):\n", report_descriptor_size); 206 240 size_t i; 207 241 for (i = 0; i < report_descriptor_size; i++) { … … 224 258 225 259 printf("%s: Simulating keyboard events...\n", NAME); 226 kb_process_events(&status, keyboard_events, keyboard_events_count, 227 on_keyboard_change); 260 while (1) { 261 kb_process_events(&status, keyboard_events, keyboard_events_count, 262 on_keyboard_change); 263 } 228 264 229 265 printf("%s: Terminating...\n", NAME);
Note:
See TracChangeset
for help on using the changeset viewer.