static int test_list_devices(struct harness_t *harness_p) { BTASSERT(usb_host_init(&usb, &usb_device[0], host_devices, membersof(host_devices)) == 0); BTASSERT(usb_host_start(&usb) == 0); std_printf(FSTR("ADDRESS CLASS VENDOR PRODUCT\r\n")); BTASSERT(usb_host_stop(&usb) == 0); return (0); }
static int storage_init(fat16_read_t *read_p, fat16_write_t *write_p, void **arg_pp) { struct usb_host_device_t *device_p; union usb_message_t message; std_printf(FSTR("USB storage.\r\n")); /* Initialize the USB host driver. */ usb_host_init(&usb, &usb_device[0], host_devices, membersof(host_devices)); usb_host_class_mass_storage_init(&mass_storage, &usb, mass_storage_devices, membersof(mass_storage_devices)); usb_host_class_mass_storage_start(&mass_storage); /* Start the USB driver. */ usb_host_start(&usb); chan_read(&usb.control, &message, sizeof(message)); std_printf(FSTR("The USB control thread read a message of type %d\r\n"), message.header.type); if (message.header.type != USB_MESSAGE_TYPE_ADD) { std_printf(FSTR("bad message type %d\r\n"), message.header.type); return (-1); } device_p = usb_host_device_open(&usb, message.add.device); *read_p = read_block; *write_p = write_block; *arg_pp = device_p; return (0); }