Changes in / [44b1674:618f9ed] in mainline
- Location:
- uspace
- Files:
-
- 7 deleted
- 50 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/usbinfo/dev.c
r44b1674 r618f9ed 77 77 } 78 78 79 usb_pipe_start_long_transfer(&dev->ctrl_pipe); 79 rc = usb_pipe_start_long_transfer(&dev->ctrl_pipe); 80 if (rc != EOK) { 81 fprintf(stderr, 82 NAME ": failed to start transfer on control pipe: %s.\n", 83 str_error(rc)); 84 goto leave; 85 } 80 86 transfer_started = true; 81 87 -
uspace/drv/ehci-hcd/main.c
r44b1674 r618f9ed 82 82 pci_get_my_registers(device, &mem_reg_base, &mem_reg_size, &irq); 83 83 CHECK_RET_RETURN(ret, 84 "Failed to get memory addresses for %" PRIun ": %s.\n", 85 device->handle, str_error(ret)); 86 usb_log_info("Memory mapped regs at 0x%" PRIxn " (size %zu), IRQ %d.\n", 84 "Failed(%d) to get memory addresses:.\n", ret, device->handle); 85 usb_log_info("Memory mapped regs at 0x%X (size %zu), IRQ %d.\n", 87 86 mem_reg_base, mem_reg_size, irq); 88 87 … … 103 102 str_error(ret)); 104 103 105 usb_log_info("Controlling new EHCI device `%s' (handle % " PRIun ").\n",104 usb_log_info("Controlling new EHCI device `%s' (handle %llu).\n", 106 105 device->name, device->handle); 107 106 -
uspace/drv/ehci-hcd/pci.c
r44b1674 r618f9ed 117 117 mem_address = res->res.mem_range.address; 118 118 mem_size = res->res.mem_range.size; 119 usb_log_debug2("Found mem: % " PRIxn"%zu.\n",119 usb_log_debug2("Found mem: %llx %zu.\n", 120 120 mem_address, mem_size); 121 121 mem_found = true; … … 186 186 CHECK_RET_HANGUP_RETURN(ret, "Failed(%d) to read PCI config space.\n", 187 187 ret); 188 usb_log_info("Register space BAR at %p:% " PRIxn ".\n", (void *)address, value);188 usb_log_info("Register space BAR at %p:%x.\n", address, value); 189 189 190 190 /* clear lower byte, it's not part of the BASE address */ 191 191 uintptr_t registers = (value & 0xffffff00); 192 usb_log_info("Memory registers BASE address:%p.\n", (void *)registers);192 usb_log_info("Memory registers BASE address:%p.\n", registers); 193 193 194 194 /* if nothing setup the hc, we don't need to turn it off */ … … 201 201 AS_AREA_READ | AS_AREA_WRITE); 202 202 CHECK_RET_HANGUP_RETURN(ret, "Failed(%d) to map registers %p:%p.\n", 203 ret, regs, (void *)registers);203 ret, regs, registers); 204 204 205 205 /* calculate value of BASE */ … … 221 221 IPC_M_CONFIG_SPACE_READ_32, eecp + USBLEGCTLSTS_OFFSET, &value); 222 222 CHECK_RET_HANGUP_RETURN(ret, "Failed(%d) to read USBLEGCTLSTS.\n", ret); 223 usb_log_debug("USBLEGCTLSTS: % " PRIxn ".\n", value);223 usb_log_debug("USBLEGCTLSTS: %x.\n", value); 224 224 225 225 /* Read the first EEC. i.e. Legacy Support register */ … … 228 228 IPC_M_CONFIG_SPACE_READ_32, eecp + USBLEGSUP_OFFSET, &value); 229 229 CHECK_RET_HANGUP_RETURN(ret, "Failed(%d) to read USBLEGSUP.\n", ret); 230 usb_log_debug2("USBLEGSUP: % " PRIxn ".\n", value);230 usb_log_debug2("USBLEGSUP: %x.\n", value); 231 231 232 232 /* Request control from firmware/BIOS, by writing 1 to highest byte. … … 248 248 249 249 if ((value & USBLEGSUP_BIOS_CONTROL) == 0) { 250 usb_log_info("BIOS released control after % zuusec.\n", wait);250 usb_log_info("BIOS released control after %d usec.\n", wait); 251 251 } else { 252 252 /* BIOS failed to hand over control, this should not happen. */ 253 253 usb_log_warning( "BIOS failed to release control after " 254 "% zuusecs, force it.\n", wait);254 "%d usecs, force it.\n", wait); 255 255 ret = async_req_3_0(parent_phone, DEV_IFACE_ID(PCI_DEV_IFACE), 256 256 IPC_M_CONFIG_SPACE_WRITE_32, eecp + USBLEGSUP_OFFSET, … … 271 271 IPC_M_CONFIG_SPACE_READ_32, eecp + USBLEGCTLSTS_OFFSET, &value); 272 272 CHECK_RET_HANGUP_RETURN(ret, "Failed(%d) to read USBLEGCTLSTS.\n", ret); 273 usb_log_debug2("USBLEGCTLSTS: % " PRIxn ".\n", value);273 usb_log_debug2("USBLEGCTLSTS: %x.\n", value); 274 274 275 275 /* Read again Legacy Support register */ … … 277 277 IPC_M_CONFIG_SPACE_READ_32, eecp + USBLEGSUP_OFFSET, &value); 278 278 CHECK_RET_HANGUP_RETURN(ret, "Failed(%d) to read USBLEGSUP.\n", ret); 279 usb_log_debug2("USBLEGSUP: % " PRIxn ".\n", value);279 usb_log_debug2("USBLEGSUP: %x.\n", value); 280 280 281 281 /* -
uspace/drv/ohci/batch.c
r44b1674 r618f9ed 141 141 assert(data); 142 142 size_t tds = data->td_count; 143 usb_log_debug("Batch(%p) checking % zutd(s) for completion.\n",143 usb_log_debug("Batch(%p) checking %d td(s) for completion.\n", 144 144 instance, tds); 145 145 usb_log_debug("ED: %x:%x:%x:%x.\n", … … 147 147 data->ed->next); 148 148 size_t i = 0; 149 instance->transfered_size = instance->buffer_size;150 149 for (; i < tds; ++i) { 151 150 assert(data->tds[i] != NULL); 152 usb_log_debug("TD % zu: %x:%x:%x:%x.\n", i,151 usb_log_debug("TD %d: %x:%x:%x:%x.\n", i, 153 152 data->tds[i]->status, data->tds[i]->cbp, data->tds[i]->next, 154 153 data->tds[i]->be); … … 157 156 } 158 157 instance->error = td_error(data->tds[i]); 158 /* FIXME: calculate real transfered size */ 159 instance->transfered_size = instance->buffer_size; 159 160 if (instance->error != EOK) { 160 usb_log_debug("Batch(%p) found error TD(% zu):%x.\n",161 usb_log_debug("Batch(%p) found error TD(%d):%x.\n", 161 162 instance, i, data->tds[i]->status); 162 163 /* Make sure TD queue is empty (one TD), … … 173 174 assert(hcd_ep); 174 175 hcd_ep->td = data->tds[i]; 175 if (i > 0)176 instance->transfered_size -= td_remain_size(data->tds[i - 1]);177 178 176 /* Clear possible ED HALT */ 179 177 data->ed->td_head &= ~ED_TDHEAD_HALTED_FLAG; … … 240 238 { 241 239 assert(instance); 242 /* We are data out, we are supposed to provide data */ 243 memcpy(instance->data_buffer, instance->buffer, instance->buffer_size); 244 instance->next_step = usb_transfer_batch_call_out_and_dispose; 240 instance->next_step = usb_transfer_batch_call_in_and_dispose; 245 241 batch_data(instance); 246 usb_log_debug("Batch(%p) BULK OUTinitialized.\n", instance);242 usb_log_debug("Batch(%p) BULK IN initialized.\n", instance); 247 243 } 248 244 /*----------------------------------------------------------------------------*/ -
uspace/drv/ohci/endpoint_list.c
r44b1674 r618f9ed 55 55 } 56 56 instance->list_head_pa = addr_to_phys(instance->list_head); 57 usb_log_debug2("Transfer list %s setup with ED: %p( 0x%0" PRIx32 ")).\n",57 usb_log_debug2("Transfer list %s setup with ED: %p(%p).\n", 58 58 name, instance->list_head, instance->list_head_pa); 59 59 … … 121 121 hcd_ep, instance->name, first, first->ed); 122 122 if (last_ed == instance->list_head) { 123 usb_log_debug2("%s head ED(%p- 0x%0" PRIx32 "): %x:%x:%x:%x.\n",123 usb_log_debug2("%s head ED(%p-%p): %x:%x:%x:%x.\n", 124 124 instance->name, last_ed, instance->list_head_pa, 125 125 last_ed->status, last_ed->td_tail, last_ed->td_head, -
uspace/drv/ohci/hc.c
r44b1674 r618f9ed 113 113 BANDWIDTH_AVAILABLE_USB11); 114 114 CHECK_RET_RETURN(ret, "Failed to initialize endpoint manager: %s.\n", 115 str_error(ret));115 ret, str_error(ret)); 116 116 117 117 hc_gain_control(instance); 118 118 ret = hc_init_memory(instance); 119 CHECK_RET_RETURN(ret, "Failed to create OHCI memory structures: 120 str_error(ret));119 CHECK_RET_RETURN(ret, "Failed to create OHCI memory structures:%s.\n", 120 ret, str_error(ret)); 121 121 hc_init_hw(instance); 122 122 fibril_mutex_initialize(&instance->guard); … … 294 294 if (status & IS_WDH) { 295 295 fibril_mutex_lock(&instance->guard); 296 usb_log_debug2("HCCA: %p-%#" PRIx32 " (%p).\n", instance->hcca, 297 instance->registers->hcca, 298 (void *) addr_to_phys(instance->hcca)); 299 usb_log_debug2("Periodic current: %#" PRIx32 ".\n", 296 usb_log_debug2("HCCA: %p-%p(%p).\n", instance->hcca, 297 instance->registers->hcca, addr_to_phys(instance->hcca)); 298 usb_log_debug2("Periodic current: %p.\n", 300 299 instance->registers->periodic_current); 301 300 … … 406 405 instance->registers->bulk_head = 407 406 instance->lists[USB_TRANSFER_BULK].list_head_pa; 408 usb_log_debug2("Bulk HEAD set to: %p (%#" PRIx32 ").\n",407 usb_log_debug2("Bulk HEAD set to: %p(%p).\n", 409 408 instance->lists[USB_TRANSFER_BULK].list_head, 410 409 instance->lists[USB_TRANSFER_BULK].list_head_pa); … … 412 411 instance->registers->control_head = 413 412 instance->lists[USB_TRANSFER_CONTROL].list_head_pa; 414 usb_log_debug2("Control HEAD set to: %p (%#" PRIx32 ").\n",413 usb_log_debug2("Control HEAD set to: %p(%p).\n", 415 414 instance->lists[USB_TRANSFER_CONTROL].list_head, 416 415 instance->lists[USB_TRANSFER_CONTROL].list_head_pa); … … 488 487 instance->lists[USB_TRANSFER_INTERRUPT].list_head_pa; 489 488 } 490 usb_log_debug2("Interrupt HEADs set to: %p (%#" PRIx32 ").\n",489 usb_log_debug2("Interrupt HEADs set to: %p(%p).\n", 491 490 instance->lists[USB_TRANSFER_INTERRUPT].list_head, 492 491 instance->lists[USB_TRANSFER_INTERRUPT].list_head_pa); -
uspace/drv/ohci/hw_struct/transfer_descriptor.c
r44b1674 r618f9ed 52 52 instance->status |= togg[toggle] << TD_STATUS_T_SHIFT; 53 53 } 54 if (dir == USB_DIRECTION_IN) {55 instance->status |= TD_STATUS_ROUND_FLAG;56 }57 54 if (buffer != NULL) { 58 55 assert(size != 0); -
uspace/drv/ohci/hw_struct/transfer_descriptor.h
r44b1674 r618f9ed 59 59 #define TD_STATUS_T_0 (0x2) 60 60 #define TD_STATUS_T_1 (0x3) 61 #define TD_STATUS_T_ED (0)62 61 #define TD_STATUS_EC_MASK (0x3) /* error count */ 63 62 #define TD_STATUS_EC_SHIFT (26) … … 103 102 return cc_to_rc(cc); 104 103 } 105 106 static inline size_t td_remain_size(td_t *instance)107 {108 assert(instance);109 if (instance->cbp == 0)110 return 0;111 return instance->be - instance->cbp + 1;112 }113 104 #endif 114 105 /** -
uspace/drv/ohci/iface.c
r44b1674 r618f9ed 118 118 hc_t *hc = fun_to_hc(fun); 119 119 assert(hc); 120 usb_log_debug("Address bind %d-% " PRIun ".\n", address, handle);120 usb_log_debug("Address bind %d-%d.\n", address, handle); 121 121 usb_device_keeper_bind(&hc->manager, address, handle); 122 122 return EOK; -
uspace/drv/ohci/ohci.c
r44b1674 r618f9ed 148 148 pci_get_my_registers(device, &mem_reg_base, &mem_reg_size, &irq); 149 149 CHECK_RET_DEST_FUN_RETURN(ret, 150 "Failed to get memory addresses for %" PRIun ": %s.\n", 151 device->handle, str_error(ret)); 152 usb_log_debug("Memory mapped regs at %p (size %zu), IRQ %d.\n", 153 (void *) mem_reg_base, mem_reg_size, irq); 150 "Failed(%d) to get memory addresses:.\n", ret, device->handle); 151 usb_log_debug("Memory mapped regs at 0x%X (size %zu), IRQ %d.\n", 152 mem_reg_base, mem_reg_size, irq); 154 153 155 154 ret = pci_disable_legacy(device); -
uspace/drv/ohci/pci.c
r44b1674 r618f9ed 117 117 mem_address = res->res.mem_range.address; 118 118 mem_size = res->res.mem_range.size; 119 usb_log_debug2("Found mem: % p%zu.\n",120 (void *)mem_address, mem_size);119 usb_log_debug2("Found mem: %llx %zu.\n", 120 mem_address, mem_size); 121 121 mem_found = true; 122 122 } -
uspace/drv/uhci-hcd/batch.c
r44b1674 r618f9ed 162 162 assert(data); 163 163 164 usb_log_debug2("Batch(%p) checking % zutransfer(s) for completion.\n",164 usb_log_debug2("Batch(%p) checking %d transfer(s) for completion.\n", 165 165 instance, data->td_count); 166 166 instance->transfered_size = 0; … … 173 173 instance->error = td_status(&data->tds[i]); 174 174 if (instance->error != EOK) { 175 usb_log_debug("Batch(%p) found error TD(% zu):%" PRIx32 ".\n",175 usb_log_debug("Batch(%p) found error TD(%d):%x.\n", 176 176 instance, i, data->tds[i].status); 177 177 td_print_status(&data->tds[i]); -
uspace/drv/uhci-hcd/hc.c
r44b1674 r618f9ed 101 101 ret, io, str_error(ret)); 102 102 instance->registers = io; 103 usb_log_debug("Device registers at %p (%zuB) accessible.\n",103 usb_log_debug("Device registers at %p(%u) accessible.\n", 104 104 io, reg_size); 105 105 … … 423 423 if (frame_list != addr_to_phys(instance->frame_list)) { 424 424 usb_log_debug("Framelist address: %p vs. %p.\n", 425 (void *) frame_list, 426 (void *) addr_to_phys(instance->frame_list)); 425 frame_list, addr_to_phys(instance->frame_list)); 427 426 } 428 427 … … 433 432 uintptr_t real_pa = addr_to_phys(QH(interrupt)); 434 433 if (expected_pa != real_pa) { 435 usb_log_debug("Interrupt QH: %p (frame%d) vs. %p.\n",436 (void *) expected_pa, frnum, (void *)real_pa);434 usb_log_debug("Interrupt QH: %p(frame: %d) vs. %p.\n", 435 expected_pa, frnum, real_pa); 437 436 } 438 437 … … 441 440 if (expected_pa != real_pa) { 442 441 usb_log_debug("Control Slow QH: %p vs. %p.\n", 443 (void *) expected_pa, (void *)real_pa);442 expected_pa, real_pa); 444 443 } 445 444 … … 448 447 if (expected_pa != real_pa) { 449 448 usb_log_debug("Control Full QH: %p vs. %p.\n", 450 (void *) expected_pa, (void *)real_pa);449 expected_pa, real_pa); 451 450 } 452 451 … … 455 454 if (expected_pa != real_pa ) { 456 455 usb_log_debug("Bulk QH: %p vs. %p.\n", 457 (void *) expected_pa, (void *)real_pa);456 expected_pa, real_pa); 458 457 } 459 458 async_usleep(UHCI_DEBUGER_TIMEOUT); -
uspace/drv/uhci-hcd/hw_struct/transfer_descriptor.c
r44b1674 r618f9ed 154 154 assert(instance); 155 155 const uint32_t s = instance->status; 156 usb_log_debug2("TD(%p) status(%# " PRIx32 "):%s %d,%s%s%s%s%s%s%s%s%s%s%s %zu.\n",156 usb_log_debug2("TD(%p) status(%#x):%s %d,%s%s%s%s%s%s%s%s%s%s%s %d.\n", 157 157 instance, instance->status, 158 158 (s & TD_STATUS_SPD_FLAG) ? " SPD," : "", -
uspace/drv/uhci-hcd/iface.c
r44b1674 r618f9ed 118 118 hc_t *hc = fun_to_hc(fun); 119 119 assert(hc); 120 usb_log_debug("Address bind %d-% " PRIun ".\n", address, handle);120 usb_log_debug("Address bind %d-%d.\n", address, handle); 121 121 usb_device_keeper_bind(&hc->manager, address, handle); 122 122 return EOK; -
uspace/drv/uhci-hcd/main.c
r44b1674 r618f9ed 72 72 int ret = uhci_init(uhci, device); 73 73 if (ret != EOK) { 74 usb_log_error("Failed to initialize UHCI driver: %s.\n",75 str_error(ret));74 usb_log_error("Failed(%d) to initialize UHCI driver: %s.\n", 75 ret, str_error(ret)); 76 76 return ret; 77 77 } -
uspace/drv/uhci-hcd/pci.c
r44b1674 r618f9ed 90 90 io_address = res->res.io_range.address; 91 91 io_size = res->res.io_range.size; 92 usb_log_debug2("Found io: % " PRIx64"%zu.\n",92 usb_log_debug2("Found io: %llx %zu.\n", 93 93 res->res.io_range.address, res->res.io_range.size); 94 94 io_found = true; -
uspace/drv/uhci-hcd/transfer_list.c
r44b1674 r618f9ed 58 58 } 59 59 uint32_t queue_head_pa = addr_to_phys(instance->queue_head); 60 usb_log_debug2("Transfer list %s setup with QH: %p (%#" PRIx32").\n",60 usb_log_debug2("Transfer list %s setup with QH: %p(%p).\n", 61 61 name, instance->queue_head, queue_head_pa); 62 62 -
uspace/drv/uhci-hcd/uhci.c
r44b1674 r618f9ed 168 168 pci_get_my_registers(device, &io_reg_base, &io_reg_size, &irq); 169 169 CHECK_RET_DEST_FUN_RETURN(ret, 170 "Failed to get I/O addresses for %" PRIun ": %s.\n", 171 device->handle, str_error(ret)); 172 usb_log_debug("I/O regs at 0x%p (size %zu), IRQ %d.\n", 173 (void *) io_reg_base, io_reg_size, irq); 170 "Failed(%d) to get I/O addresses:.\n", ret, device->handle); 171 usb_log_debug("I/O regs at 0x%X (size %zu), IRQ %d.\n", 172 io_reg_base, io_reg_size, irq); 174 173 175 174 ret = pci_disable_legacy(device); -
uspace/drv/uhci-rhd/main.c
r44b1674 r618f9ed 1 1 /* 2 * Copyright (c) 2011 Jan Vesely2 * Copyright (c) 2011 Vojtech Horky, Jan Vesely 3 3 * All rights reserved. 4 4 * … … 84 84 return EINVAL; 85 85 86 usb_log_debug2("uhci_rh_add_device(handle=%" PRIun ")\n", 87 device->handle); 86 usb_log_debug2("%s called device %d\n", __FUNCTION__, device->handle); 88 87 89 88 uintptr_t io_regs = 0; … … 102 101 ret = hc_get_my_registers(device, &io_regs, &io_size); 103 102 CHECK_RET_FREE_RH_RETURN(ret, 104 "Failed to get registers from HC: %s.\n", str_error(ret)); 105 usb_log_debug("I/O regs at %p (size %zuB).\n", 106 (void *) io_regs, io_size); 103 "Failed(%d) to get registers from HC: %s.\n", ret, str_error(ret)); 104 usb_log_debug("I/O regs at %#x (size %zu).\n", io_regs, io_size); 107 105 108 106 rh = malloc(sizeof(uhci_root_hub_t)); … … 117 115 118 116 device->driver_data = rh; 119 usb_log_info("Controlling root hub '%s' (% " PRIun ").\n",117 usb_log_info("Controlling root hub '%s' (%llu).\n", 120 118 device->name, device->handle); 121 119 return EOK; -
uspace/drv/uhci-rhd/port.c
r44b1674 r618f9ed 89 89 { 90 90 assert(port); 91 asprintf(&port->id_string, "Port (%p - % u)", port, number);91 asprintf(&port->id_string, "Port (%p - %d)", port, number); 92 92 if (port->id_string == NULL) { 93 93 return ENOMEM; … … 115 115 116 116 fibril_add_ready(port->checker); 117 usb_log_debug("%s: Started polling fibril (%" PRIun ").\n",117 usb_log_debug("%s: Started polling fibril(%x).\n", 118 118 port->id_string, port->checker); 119 119 return EOK; … … 267 267 } 268 268 269 usb_log_info("New device at port %u, address %d (handle % " PRIun ").\n",269 usb_log_info("New device at port %u, address %d (handle %llu).\n", 270 270 port->number, dev_addr, port->attached_device); 271 271 return EOK; … … 283 283 int uhci_port_remove_device(uhci_port_t *port) 284 284 { 285 usb_log_error("%s: Don't know how to remove device % " PRIun ".\n",285 usb_log_error("%s: Don't know how to remove device %llu.\n", 286 286 port->id_string, port->attached_device); 287 287 return ENOTSUP; -
uspace/drv/usbflbk/main.c
r44b1674 r618f9ed 65 65 66 66 usb_log_info("Pretending to control %s `%s'" \ 67 " (node `%s', handle % " PRIun ").\n",67 " (node `%s', handle %llu).\n", 68 68 dev->interface_no < 0 ? "device" : "interface", 69 69 dev->ddf_dev->name, fun_name, dev->ddf_dev->handle); -
uspace/drv/usbhid/Makefile
r44b1674 r618f9ed 46 46 generic/hiddev.c \ 47 47 mouse/mousedev.c \ 48 lgtch-ultrax/lgtch-ultrax.c \49 48 $(STOLEN_LAYOUT_SOURCES) 50 49 -
uspace/drv/usbhid/kbd/kbddev.c
r44b1674 r618f9ed 176 176 177 177 /*----------------------------------------------------------------------------*/ 178 179 static void usb_kbd_process_keycodes(const uint8_t *key_codes, size_t count,180 uint8_t report_id, void *arg);181 182 static const usb_hid_report_in_callbacks_t usb_kbd_parser_callbacks = {183 .keyboard = usb_kbd_process_keycodes184 };185 186 /*----------------------------------------------------------------------------*/187 178 /* Keyboard layouts */ 188 179 /*----------------------------------------------------------------------------*/ … … 607 598 608 599 if (count != kbd_dev->key_count) { 609 usb_log_warning("Number of received keycodes (% zu) differs from"610 " expected (%zu).\n", count, kbd_dev->key_count);600 usb_log_warning("Number of received keycodes (%d) differs from" 601 " expected number (%d).\n", count, kbd_dev->key_count); 611 602 return; 612 603 } … … 639 630 { 640 631 assert(hid_dev->parser != NULL); 632 633 usb_hid_report_in_callbacks_t *callbacks = 634 (usb_hid_report_in_callbacks_t *)malloc( 635 sizeof(usb_hid_report_in_callbacks_t)); 636 637 callbacks->keyboard = usb_kbd_process_keycodes; 641 638 642 639 usb_log_debug("Calling usb_hid_parse_report() with " … … 647 644 usb_hid_report_path_t *path = usb_hid_report_path(); 648 645 usb_hid_report_path_append_item(path, USB_HIDUT_PAGE_KEYBOARD, 0); 649 //usb_hid_report_path_set_report_id(path, 0);646 usb_hid_report_path_set_report_id(path, 0); 650 647 651 648 int rc = usb_hid_parse_report(hid_dev->parser, buffer, 652 649 actual_size, path, 653 650 USB_HID_PATH_COMPARE_END | USB_HID_PATH_COMPARE_USAGE_PAGE_ONLY, 654 &usb_kbd_parser_callbacks, hid_dev);651 callbacks, hid_dev); 655 652 656 653 usb_hid_report_path_free(path); -
uspace/drv/usbhid/main.c
r44b1674 r618f9ed 75 75 static int usb_hid_try_add_device(usb_device_t *dev) 76 76 { 77 assert(dev != NULL);78 79 77 /* 80 78 * Initialize device (get and process descriptors, get address, etc.) … … 180 178 usb_log_debug("usb_hid_add_device()\n"); 181 179 182 if (dev == NULL) {183 usb_log_warning("Wrong parameter given for add_device().\n");184 return EINVAL;185 }186 187 180 if (dev->interface_no < 0) { 188 181 usb_log_warning("Device is not a supported HID device.\n"); -
uspace/drv/usbhid/mouse/mousedev.c
r44b1674 r618f9ed 157 157 static void usb_mouse_free(usb_mouse_t **mouse_dev) 158 158 { 159 assert(mouse_dev != NULL && *mouse_dev != NULL); 159 if (mouse_dev == NULL || *mouse_dev == NULL) { 160 return; 161 } 160 162 161 163 // hangup phone to the console 162 if ((*mouse_dev)->console_phone >= 0) { 163 async_hangup((*mouse_dev)->console_phone); 164 } 164 async_hangup((*mouse_dev)->console_phone); 165 165 166 166 free(*mouse_dev); -
uspace/drv/usbhid/subdrivers.c
r44b1674 r618f9ed 37 37 #include "usb/classes/hidut.h" 38 38 39 #include "lgtch-ultrax/lgtch-ultrax.h" 40 41 static usb_hid_subdriver_usage_t path_kbd[] = { 42 {USB_HIDUT_PAGE_KEYBOARD, 0}, 43 {0, 0} 44 }; 45 46 static usb_hid_subdriver_usage_t lgtch_path[] = { 47 {0xc, 0}, 48 {0, 0} 49 }; 39 static usb_hid_subdriver_usage_t path_kbd[] = {{USB_HIDUT_PAGE_KEYBOARD, 0}}; 50 40 51 41 const usb_hid_subdriver_mapping_t usb_hid_subdrivers[] = { 52 42 { 53 43 path_kbd, 54 -1,44 1, 55 45 USB_HID_PATH_COMPARE_END 56 46 | USB_HID_PATH_COMPARE_USAGE_PAGE_ONLY, 57 0,58 0,47 NULL, 48 NULL, 59 49 { 60 .init =usb_kbd_init,61 .deinit =usb_kbd_deinit,62 .poll =usb_kbd_polling_callback,63 .poll_end =NULL50 usb_kbd_init, 51 usb_kbd_deinit, 52 usb_kbd_polling_callback, 53 NULL 64 54 }, 65 55 66 56 }, 67 { 68 lgtch_path, 69 1, 70 USB_HID_PATH_COMPARE_END 71 | USB_HID_PATH_COMPARE_USAGE_PAGE_ONLY, 72 0x046d, 73 0xc30e, 74 { 75 .init = NULL, 76 .deinit = NULL, 77 .poll = usb_lgtch_polling_callback, 78 .poll_end = NULL 79 } 80 }, 81 {NULL, -1, 0, 0, 0, {NULL, NULL, NULL, NULL}} 57 {NULL, 0, 0, NULL, NULL, {NULL, NULL, NULL, NULL}} 82 58 }; 83 59 -
uspace/drv/usbhid/subdrivers.h
r44b1674 r618f9ed 54 54 typedef struct usb_hid_subdriver_mapping { 55 55 const usb_hid_subdriver_usage_t *usage_path; 56 int report_id;56 int path_size; 57 57 int compare; 58 uint16_tvendor_id;59 uint16_tproduct_id;58 const char *vendor_id; 59 const char *product_id; 60 60 usb_hid_subdriver_t subdriver; 61 61 } usb_hid_subdriver_mapping_t; -
uspace/drv/usbhid/usbhid.c
r44b1674 r618f9ed 67 67 static int usb_hid_set_boot_kbd_subdriver(usb_hid_dev_t *hid_dev) 68 68 { 69 assert(hid_dev != NULL && hid_dev->subdriver_count == 0);69 assert(hid_dev->subdriver_count == 0); 70 70 71 71 hid_dev->subdrivers = (usb_hid_subdriver_t *)malloc( … … 97 97 static int usb_hid_set_boot_mouse_subdriver(usb_hid_dev_t *hid_dev) 98 98 { 99 assert(hid_dev != NULL && hid_dev->subdriver_count == 0);99 assert(hid_dev->subdriver_count == 0); 100 100 101 101 hid_dev->subdrivers = (usb_hid_subdriver_t *)malloc( … … 127 127 static int usb_hid_set_generic_hid_subdriver(usb_hid_dev_t *hid_dev) 128 128 { 129 assert(hid_dev != NULL && hid_dev->subdriver_count == 0);129 assert(hid_dev->subdriver_count == 0); 130 130 131 131 hid_dev->subdrivers = (usb_hid_subdriver_t *)malloc( … … 164 164 165 165 static bool usb_hid_path_matches(usb_hid_dev_t *hid_dev, 166 const usb_hid_subdriver_ mapping_t *mapping)166 const usb_hid_subdriver_usage_t *path, int path_size, int compare) 167 167 { 168 168 assert(hid_dev != NULL); 169 assert( mapping!= NULL);169 assert(path != NULL); 170 170 171 171 usb_hid_report_path_t *usage_path = usb_hid_report_path(); … … 174 174 return false; 175 175 } 176 int i = 0; 177 while (mapping->usage_path[i].usage != 0 178 || mapping->usage_path[i].usage_page != 0) { 176 int i; 177 for (i = 0; i < path_size; ++i) { 179 178 if (usb_hid_report_path_append_item(usage_path, 180 mapping->usage_path[i].usage_page, 181 mapping->usage_path[i].usage) != EOK) { 179 path[i].usage_page, path[i].usage) != EOK) { 182 180 usb_log_debug("Failed to append to usage path.\n"); 183 181 usb_hid_report_path_free(usage_path); 184 182 return false; 185 183 } 186 ++i;187 }188 189 if (mapping->report_id >= 0) {190 usb_hid_report_path_set_report_id(usage_path,191 mapping->report_id);192 184 } 193 185 194 186 assert(hid_dev->parser != NULL); 195 187 196 usb_log_debug("Compare flags: %d\n", mapping->compare);188 usb_log_debug("Compare flags: %d\n", compare); 197 189 size_t size = usb_hid_report_input_length(hid_dev->parser, usage_path, 198 mapping->compare);199 usb_log_debug("Size of the input report: % zuB\n", size);190 compare); 191 usb_log_debug("Size of the input report: %d\n", size); 200 192 201 193 usb_hid_report_path_free(usage_path); … … 239 231 static int usb_hid_find_subdrivers(usb_hid_dev_t *hid_dev) 240 232 { 241 assert(hid_dev != NULL);242 243 233 const usb_hid_subdriver_t *subdrivers[USB_HID_MAX_SUBDRIVERS]; 244 234 245 235 int i = 0, count = 0; 246 236 const usb_hid_subdriver_mapping_t *mapping = &usb_hid_subdrivers[i]; 247 248 bool ids_matched;249 bool matched;250 237 251 238 while (count < USB_HID_MAX_SUBDRIVERS && 252 239 (mapping->usage_path != NULL 253 || mapping->vendor_id != 0 || mapping->product_id != 0)) { 240 || mapping->vendor_id != NULL 241 || mapping->product_id != NULL)) { 254 242 // check the vendor & product ID 255 if (mapping->vendor_id != 0 && mapping->product_id == 0) {256 usb_log_warning("Missing Product ID for Vendor ID % u\n",243 if (mapping->vendor_id != NULL && mapping->product_id == NULL) { 244 usb_log_warning("Missing Product ID for Vendor ID %s\n", 257 245 mapping->vendor_id); 258 246 return EINVAL; 259 247 } 260 if (mapping->product_id != 0 && mapping->vendor_id == 0) {261 usb_log_warning("Missing Vendor ID for Product ID % u\n",248 if (mapping->product_id != NULL && mapping->vendor_id == NULL) { 249 usb_log_warning("Missing Vendor ID for Product ID %s\n", 262 250 mapping->product_id); 263 251 return EINVAL; 264 252 } 265 253 266 ids_matched = false; 267 matched = false; 268 269 if (mapping->vendor_id != 0) { 270 assert(mapping->product_id != 0); 271 usb_log_debug("Comparing device against vendor ID %u" 272 " and product ID %u.\n", mapping->vendor_id, 254 if (mapping->vendor_id != NULL) { 255 assert(mapping->product_id != NULL); 256 usb_log_debug("Comparing device against vendor ID %s" 257 " and product ID %s.\n", mapping->vendor_id, 273 258 mapping->product_id); 274 259 if (usb_hid_ids_match(hid_dev, mapping)) { 275 usb_log_debug("IDs matched.\n"); 276 ids_matched = true; 260 usb_log_debug("Matched.\n"); 261 subdrivers[count++] = &mapping->subdriver; 262 // skip the checking of usage path 263 goto next; 277 264 } 278 265 } … … 280 267 if (mapping->usage_path != NULL) { 281 268 usb_log_debug("Comparing device against usage path.\n"); 282 if (usb_hid_path_matches(hid_dev, mapping)) { 283 // does not matter if IDs were matched 284 matched = true; 269 if (usb_hid_path_matches(hid_dev, 270 mapping->usage_path, mapping->path_size, 271 mapping->compare)) { 272 subdrivers[count++] = &mapping->subdriver; 273 } else { 274 usb_log_debug("Not matched.\n"); 285 275 } 286 } else { 287 // matched only if IDs were matched and there is no path 288 matched = ids_matched; 289 } 290 291 if (matched) { 292 subdrivers[count++] = &mapping->subdriver; 293 } 294 276 } 277 next: 295 278 mapping = &usb_hid_subdrivers[++i]; 296 279 } … … 304 287 static int usb_hid_check_pipes(usb_hid_dev_t *hid_dev, usb_device_t *dev) 305 288 { 306 assert(hid_dev != NULL && dev != NULL);307 308 289 int rc = EOK; 309 290 -
uspace/drv/usbhub/ports.c
r44b1674 r618f9ed 83 83 void usb_hub_process_interrupt(usb_hub_info_t * hub, 84 84 uint16_t port) { 85 usb_log_debug("interrupt at port % zu\n", (size_t)port);85 usb_log_debug("interrupt at port %d\n", port); 86 86 //determine type of change 87 87 //usb_pipe_t *pipe = hub->control_pipe; … … 93 93 if (opResult != EOK) { 94 94 usb_log_error("Failed to get port %zu status: %s.\n", 95 (size_t)port, str_error(opResult));95 port, str_error(opResult)); 96 96 return; 97 97 } … … 100 100 bool device_connected = usb_port_is_status(status, 101 101 USB_HUB_FEATURE_PORT_CONNECTION); 102 usb_log_debug("Connection change on port %zu: %s.\n", 103 (size_t) port, 102 usb_log_debug("Connection change on port %zu: %s.\n", port, 104 103 device_connected ? "device attached" : "device removed"); 105 104 … … 110 109 usb_log_error( 111 110 "Cannot handle change on port %zu: %s.\n", 112 (size_t) port,str_error(opResult));111 str_error(opResult)); 113 112 } 114 113 } else { … … 211 210 static void usb_hub_port_reset_completed(usb_hub_info_t * hub, 212 211 uint16_t port, uint32_t status){ 213 usb_log_debug("Port %zu reset complete.\n", (size_t)port);212 usb_log_debug("Port %zu reset complete.\n", port); 214 213 if (usb_port_is_status(status, USB_HUB_FEATURE_PORT_ENABLE)) { 215 214 /* Finalize device adding. */ … … 223 222 usb_log_warning( 224 223 "Port %zu reset complete but port not enabled.\n", 225 (size_t)port);224 port); 226 225 } 227 226 } -
uspace/drv/usbhub/usbhub.c
r44b1674 r618f9ed 260 260 port+1, USB_HUB_FEATURE_PORT_POWER); 261 261 if (opResult != EOK) { 262 usb_log_error("cannot power on port % zu: %s.\n",263 port+1, str_error(opResult));262 usb_log_error("cannot power on port %d; %d\n", 263 port+1, opResult); 264 264 } 265 265 } … … 269 269 USB_HUB_FEATURE_C_HUB_LOCAL_POWER); 270 270 if (opResult != EOK) { 271 usb_log_error("cannot power hub : %s\n",272 str_error(opResult));271 usb_log_error("cannot power hub; %d\n", 272 opResult); 273 273 } 274 274 } … … 356 356 } 357 357 358 usb_log_info("Controlling hub `%s' (% zuports).\n",358 usb_log_info("Controlling hub `%s' (%d ports).\n", 359 359 hub_info->usb_device->ddf_dev->name, hub_info->port_count); 360 360 return EOK; … … 424 424 port, USB_HUB_FEATURE_PORT_POWER); 425 425 if (opResult != EOK) { 426 usb_log_error(" Cannot power on port %zu: %s.\n",427 port, str_error(opResult));426 usb_log_error("cannot power on port %d; %d\n", 427 port, opResult); 428 428 } 429 429 } -
uspace/drv/usbkbd/kbddev.c
r44b1674 r618f9ed 567 567 568 568 if (count != kbd_dev->key_count) { 569 usb_log_warning("Number of received keycodes (% zu) differs from"570 " expected (%zu).\n", count, kbd_dev->key_count);569 usb_log_warning("Number of received keycodes (%d) differs from" 570 " expected number (%d).\n", count, kbd_dev->key_count); 571 571 return; 572 572 } -
uspace/drv/usbmid/main.c
r44b1674 r618f9ed 53 53 usb_log_info("Taking care of new MID `%s'.\n", dev->ddf_dev->name); 54 54 55 usb_pipe_start_long_transfer(&dev->ctrl_pipe); 55 int rc; 56 57 rc = usb_pipe_start_long_transfer(&dev->ctrl_pipe); 58 if (rc != EOK) { 59 usb_log_error("Failed to start transfer on control pipe: %s.\n", 60 str_error(rc)); 61 return rc; 62 } 56 63 57 64 bool accept = usbmid_explore_device(dev); -
uspace/drv/usbmouse/init.c
r44b1674 r618f9ed 125 125 } 126 126 127 /* Open the control pipe. */ 128 rc = usb_pipe_start_session(&dev->ctrl_pipe); 129 if (rc != EOK) { 130 goto leave; 131 } 132 127 133 /* Set the boot protocol. */ 128 134 rc = usb_control_request_set(&dev->ctrl_pipe, … … 134 140 } 135 141 136 /* Everything all right. */ 142 /* Close the control pipe (ignore errors). */ 143 usb_pipe_end_session(&dev->ctrl_pipe); 144 145 146 /* Everything allright. */ 137 147 dev->driver_data = mouse; 138 148 mouse->mouse_fun->driver_data = mouse; -
uspace/drv/usbmouse/main.c
r44b1674 r618f9ed 54 54 } 55 55 56 usb_log_debug("Polling pipe at endpoint %d.\n", 57 dev->pipes[0].pipe->endpoint_no); 56 usb_log_debug("Polling pipe at endpoint %d.\n", dev->pipes[0].pipe->endpoint_no); 58 57 59 58 rc = usb_device_auto_poll(dev, 0, … … 67 66 } 68 67 69 usb_log_info("controlling new mouse (handle % " PRIun ").\n",68 usb_log_info("controlling new mouse (handle %llu).\n", 70 69 dev->ddf_dev->handle); 71 70 -
uspace/drv/vhc/conndev.c
r44b1674 r618f9ed 99 99 int rc = get_device_name(callback, devname, DEVICE_NAME_MAXLENGTH); 100 100 101 usb_log_info("New virtual device `%s' (id = % " PRIxn ").\n",101 usb_log_info("New virtual device `%s' (id = %x).\n", 102 102 rc == EOK ? devname : "<unknown>", dev->id); 103 103 … … 122 122 } 123 123 124 usb_log_info("Virtual device disconnected (id = %" PRIxn ").\n", 125 dev->id); 124 usb_log_info("Virtual device disconnected (id = %x).\n", dev->id); 126 125 virtdev_destroy_device(dev); 127 126 } -
uspace/lib/c/include/ipc/dev_iface.h
r44b1674 r618f9ed 45 45 /** Interface provided by USB host controller. */ 46 46 USBHC_DEV_IFACE, 47 /** Interface provided by USB HID devices. */48 USBHID_DEV_IFACE,49 47 50 48 DEV_IFACE_MAX -
uspace/lib/drv/generic/dev_iface.c
r44b1674 r618f9ed 43 43 #include "remote_usb.h" 44 44 #include "remote_usbhc.h" 45 #include "remote_usbhid.h"46 45 #include "remote_pci.h" 47 46 … … 52 51 &remote_pci_iface, 53 52 &remote_usb_iface, 54 &remote_usbhc_iface, 55 &remote_usbhid_iface 53 &remote_usbhc_iface 56 54 } 57 55 }; -
uspace/lib/usb/Makefile
r44b1674 r618f9ed 42 42 src/dp.c \ 43 43 src/dump.c \ 44 src/hidiface.c \45 44 src/hidparser.c \ 46 45 src/hub.c \ -
uspace/lib/usb/include/usb/debug.h
r44b1674 r618f9ed 36 36 #define LIBUSB_DEBUG_H_ 37 37 #include <stdio.h> 38 #include <inttypes.h>39 38 #include <usb/usb.h> 40 39 #include <assert.h> … … 86 85 void usb_log_enable(usb_log_level_t, const char *); 87 86 88 void usb_log_printf(usb_log_level_t, const char *, ...) 89 PRINTF_ATTRIBUTE(2, 3); 87 void usb_log_printf(usb_log_level_t, const char *, ...); 90 88 91 89 /** Log fatal error. */ -
uspace/lib/usb/include/usb/pipes.h
r44b1674 r618f9ed 99 99 /** Number of active transfers over the pipe. */ 100 100 int refcount; 101 /** Number of failed attempts to open the HC phone.102 * When user requests usb_pipe_start_long_transfer() and the operation103 * fails, there is no way to report this to the user.104 * That the soft reference counter is increased to record the attempt.105 * When the user then request e.g. usb_pipe_read(), it will try to106 * add reference as well.107 * If that fails, it is reported to the user. If it is okay, the108 * real reference counter is incremented.109 * The problem might arise when ending the long transfer (since110 * the number of references would be only 1, but logically it shall be111 * two).112 * Decrementing the soft counter first shall solve this.113 */114 int refcount_soft;115 101 116 102 /** Whether to automatically reset halt on the endpoint. … … 177 163 int usb_pipe_unregister(usb_pipe_t *, usb_hc_connection_t *); 178 164 179 void usb_pipe_start_long_transfer(usb_pipe_t *); 165 int usb_pipe_start_session(usb_pipe_t *); 166 int usb_pipe_end_session(usb_pipe_t *); 167 bool usb_pipe_is_session_started(usb_pipe_t *); 168 169 int usb_pipe_start_long_transfer(usb_pipe_t *); 180 170 void usb_pipe_end_long_transfer(usb_pipe_t *); 181 171 -
uspace/lib/usb/src/devdrv.c
r44b1674 r618f9ed 236 236 237 237 /* It is worth to start a long transfer. */ 238 usb_pipe_start_long_transfer(ctrl_pipe); 238 rc = usb_pipe_start_long_transfer(ctrl_pipe); 239 if (rc != EOK) { 240 return rc; 241 } 239 242 240 243 /* Get the device descriptor. */ -
uspace/lib/usb/src/devpoll.c
r44b1674 r618f9ed 78 78 usb_endpoint_mapping_t *mapping 79 79 = &polling_data->dev->pipes[polling_data->pipe_index]; 80 usb_log_debug("Poll %p: started polling of `%s' - " \80 usb_log_debug("Poll0x%x: started polling of `%s' - " \ 81 81 "interface %d (%s,%d,%d), %zuB/%zu.\n", 82 82 polling_data, … … 100 100 if (rc == EOK) { 101 101 usb_log_debug( 102 "Poll %p: received: '%s' (%zuB).\n",102 "Poll0x%x: received: '%s' (%zuB).\n", 103 103 polling_data, 104 104 usb_debug_str_buffer(polling_data->buffer, … … 107 107 } else { 108 108 usb_log_debug( 109 "Poll %p: polling failed: %s.\n",109 "Poll0x%x: polling failed: %s.\n", 110 110 polling_data, str_error(rc)); 111 111 } -
uspace/lib/usb/src/hidparser.c
r44b1674 r618f9ed 167 167 168 168 usb_log_debug2( 169 "i(% zu) data(%X) value(%X): TAG %d, class %u, size %u - ", i,169 "i(%u) data(%X) value(%X): TAG %u, class %u, size %u - ", i, 170 170 data[i], usb_hid_report_tag_data_int32(data+i+1,item_size), 171 171 tag, class, item_size); … … 576 576 report_item = list_get_instance(item, usb_hid_report_item_t, link); 577 577 578 usb_log_debug("\tOFFSET: % zX\n", report_item->offset);578 usb_log_debug("\tOFFSET: %X\n", report_item->offset); 579 579 usb_log_debug("\tCOUNT: %X\n", report_item->count); 580 580 usb_log_debug("\tSIZE: %X\n", report_item->size); -
uspace/lib/usb/src/hidreport.c
r44b1674 r618f9ed 109 109 110 110 if (*d != sizeof(usb_standard_hid_descriptor_t)) { 111 usb_log_error("HID descriptor has wrong size (%u, expected %zu"111 usb_log_error("HID descriptor hass wrong size (%u, expected %u" 112 112 ")\n", *d, sizeof(usb_standard_hid_descriptor_t)); 113 113 return EINVAL; … … 149 149 free(*report_desc); 150 150 *report_desc = NULL; 151 usb_log_error("Report descriptor has wrong size (% zu, expected "151 usb_log_error("Report descriptor has wrong size (%u, expected " 152 152 "%u)\n", actual_size, length); 153 153 return EINVAL; -
uspace/lib/usb/src/pipepriv.c
r44b1674 r618f9ed 77 77 * 78 78 * @param pipe The USB pipe. 79 * @param hide_failure Whether to hide failure when adding reference80 * (use soft refcount).81 79 * @return Error code. 82 80 * @retval EOK Currently always. 83 81 */ 84 int pipe_add_ref(usb_pipe_t *pipe , bool hide_failure)82 int pipe_add_ref(usb_pipe_t *pipe) 85 83 { 84 another_try: 86 85 pipe_acquire(pipe); 87 86 … … 90 89 int phone = devman_device_connect(pipe->wire->hc_handle, 0); 91 90 if (phone < 0) { 92 if (hide_failure) { 93 pipe->refcount_soft++; 94 phone = EOK; 95 } 91 // TODO: treat some error as non-recoverable 92 // and return error from here 96 93 pipe_release(pipe); 97 return phone;94 goto another_try; 98 95 } 99 96 /* … … 117 114 { 118 115 pipe_acquire(pipe); 119 if (pipe->refcount_soft > 0) {120 pipe->refcount_soft--;121 pipe_release(pipe);122 return;123 }124 116 assert(pipe->refcount > 0); 125 117 pipe->refcount--; -
uspace/lib/usb/src/pipepriv.h
r44b1674 r618f9ed 37 37 38 38 #include <usb/pipes.h> 39 #include <bool.h>40 39 41 40 void pipe_acquire(usb_pipe_t *); … … 45 44 void pipe_end_transaction(usb_pipe_t *); 46 45 47 int pipe_add_ref(usb_pipe_t * , bool);46 int pipe_add_ref(usb_pipe_t *); 48 47 void pipe_drop_ref(usb_pipe_t *); 49 48 -
uspace/lib/usb/src/pipes.c
r44b1674 r618f9ed 229 229 } 230 230 231 232 /** Start a session on the endpoint pipe. 233 * 234 * A session is something inside what any communication occurs. 235 * It is expected that sessions would be started right before the transfer 236 * and ended - see usb_pipe_end_session() - after the last 237 * transfer. 238 * The reason for this is that session actually opens some communication 239 * channel to the host controller (or to the physical hardware if you 240 * wish) and thus it involves acquiring kernel resources. 241 * Since they are limited, sessions shall not be longer than strictly 242 * necessary. 243 * 244 * @deprecated 245 * Obsoleted with introduction of usb_pipe_start_long_transfer 246 * 247 * @param pipe Endpoint pipe to start the session on. 248 * @return Error code. 249 */ 250 int usb_pipe_start_session(usb_pipe_t *pipe) 251 { 252 usb_log_warning("usb_pipe_start_session() was deprecated.\n"); 253 return EOK; 254 } 255 256 257 /** Ends a session on the endpoint pipe. 258 * 259 * @deprecated 260 * Obsoleted with introduction of usb_pipe_end_long_transfer 261 * 262 * @see usb_pipe_start_session 263 * 264 * @param pipe Endpoint pipe to end the session on. 265 * @return Error code. 266 */ 267 int usb_pipe_end_session(usb_pipe_t *pipe) 268 { 269 usb_log_warning("usb_pipe_end_session() was deprecated.\n"); 270 return EOK; 271 } 272 273 /** Tell whether a session is started (open) on the endpoint pipe. 274 * 275 * The expected usage of this function is in assertions for some 276 * nested functions. 277 * 278 * @param pipe Endpoint pipe in question. 279 * @return Whether @p pipe has opened a session. 280 */ 281 bool usb_pipe_is_session_started(usb_pipe_t *pipe) 282 { 283 pipe_acquire(pipe); 284 bool started = pipe->refcount > 0; 285 pipe_release(pipe); 286 return started; 287 } 288 231 289 /** Prepare pipe for a long transfer. 232 290 * … … 239 297 * @return Error code. 240 298 */ 241 voidusb_pipe_start_long_transfer(usb_pipe_t *pipe)242 { 243 (void) pipe_add_ref(pipe, true);299 int usb_pipe_start_long_transfer(usb_pipe_t *pipe) 300 { 301 return pipe_add_ref(pipe); 244 302 } 245 303 -
uspace/lib/usb/src/pipesinit.c
r44b1674 r618f9ed 365 365 pipe->direction = direction; 366 366 pipe->refcount = 0; 367 pipe->refcount_soft = 0;368 367 pipe->auto_reset_halt = false; 369 368 … … 420 419 int rc; 421 420 422 usb_pipe_start_long_transfer(pipe); 421 rc = usb_pipe_start_long_transfer(pipe); 422 if (rc != EOK) { 423 return rc; 424 } 425 423 426 424 427 uint8_t dev_descr_start[CTRL_PIPE_MIN_PACKET_SIZE]; -
uspace/lib/usb/src/pipesio.c
r44b1674 r618f9ed 173 173 174 174 int rc; 175 rc = pipe_add_ref(pipe , false);175 rc = pipe_add_ref(pipe); 176 176 if (rc != EOK) { 177 177 return rc; … … 296 296 int rc; 297 297 298 rc = pipe_add_ref(pipe , false);298 rc = pipe_add_ref(pipe); 299 299 if (rc != EOK) { 300 300 return rc; … … 447 447 int rc; 448 448 449 rc = pipe_add_ref(pipe , false);449 rc = pipe_add_ref(pipe); 450 450 if (rc != EOK) { 451 451 return rc; … … 579 579 int rc; 580 580 581 rc = pipe_add_ref(pipe , false);581 rc = pipe_add_ref(pipe); 582 582 if (rc != EOK) { 583 583 return rc;
Note:
See TracChangeset
for help on using the changeset viewer.