Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/usb/src/pipesinit.c

    r4ede178 rfa0f53b  
    365365        pipe->direction = direction;
    366366        pipe->refcount = 0;
     367        pipe->auto_reset_halt = false;
    367368
    368369        return EOK;
     
    385386            0, USB_TRANSFER_CONTROL, CTRL_PIPE_MIN_PACKET_SIZE,
    386387            USB_DIRECTION_BOTH);
     388
     389        pipe->auto_reset_halt = true;
    387390
    388391        return rc;
     
    459462    usb_hc_connection_t *hc_connection)
    460463{
     464        return usb_pipe_register_with_speed(pipe, USB_SPEED_MAX + 1,
     465            interval, hc_connection);
     466}
     467
     468/** Register endpoint with a speed at the host controller.
     469 *
     470 * You will rarely need to use this function because it is needed only
     471 * if the registered endpoint is of address 0 and there is no other way
     472 * to tell speed of the device at address 0.
     473 *
     474 * @param pipe Pipe to be registered.
     475 * @param speed Speed of the device
     476 *      (invalid speed means use previously specified one).
     477 * @param interval Polling interval.
     478 * @param hc_connection Connection to the host controller (must be opened).
     479 * @return Error code.
     480 */
     481int usb_pipe_register_with_speed(usb_pipe_t *pipe, usb_speed_t speed,
     482    unsigned int interval,
     483    usb_hc_connection_t *hc_connection)
     484{
    461485        assert(pipe);
    462486        assert(hc_connection);
     
    466490        }
    467491
    468 #define _PACK(high, low) ((high) * 256 + (low))
    469 
    470         return async_req_5_0(hc_connection->hc_phone,
     492#define _PACK2(high, low) (((high) << 16) + (low))
     493#define _PACK3(high, middle, low) (((((high) << 8) + (middle)) << 8) + (low))
     494
     495        return async_req_4_0(hc_connection->hc_phone,
    471496            DEV_IFACE_ID(USBHC_DEV_IFACE), IPC_M_USBHC_REGISTER_ENDPOINT,
    472             _PACK(pipe->wire->address, pipe->endpoint_no),
    473             _PACK(pipe->transfer_type, pipe->direction),
    474             pipe->max_packet_size, interval);
    475 
    476 #undef _PACK
     497            _PACK2(pipe->wire->address, pipe->endpoint_no),
     498            _PACK3(speed, pipe->transfer_type, pipe->direction),
     499            _PACK2(pipe->max_packet_size, interval));
     500
     501#undef _PACK2
     502#undef _PACK3
    477503}
    478504
Note: See TracChangeset for help on using the changeset viewer.