/**
 * Returns the current event
 *
 * @param [in] h
 *
 * @return 0 if h is NULL
 * @return current event otherwise
 */
int bus_ev_read(bus_ev_hdle_t *h)
{
    bus_ev_t *bus_events = (bus_ev_t *)h;
    int ev = 0;

    if (bus_events)
        ev = usb_host_read_event(bus_events->ctx);

    return ev;
}
Esempio n. 2
0
void usb_host_run(struct usb_host_context *context,
                  usb_device_added_cb added_cb,
                  usb_device_removed_cb removed_cb,
                  usb_discovery_done_cb discovery_done_cb,
                  void *client_data)
{
    int done;

    done = usb_host_load(context, added_cb, removed_cb, discovery_done_cb, client_data);

    while (!done) {

        done = usb_host_read_event(context);
    }
} /* usb_host_run() */