在没有接口端点的情况下如何与 CDC 设备进行交互?
How is interaction with CDC device with no interface endpoints working?
我正在上传到 Digispark board. It uses micronucleus bootloader and i can see uploader code。我对其进行了一些修改以查看接口和端点数:
nucleus->device = usb_open(dev);
// added by me - start
int interfaces, endpoints, j;
struct usb_interface_descriptor *interface = NULL;
interfaces = dev->config->bNumInterfaces;
fprintf(stderr, "Found interfaces: %i\n", interfaces);
interface = &(dev->config->interface[0].altsetting[0]);
fprintf(stderr, "Endpoints: %i\n", interface->bNumEndpoints);
// added by me - end
// get nucleus info
unsigned char buffer[4];
int res = usb_control_msg(nucleus->device, USB_ENDPOINT_IN| USB_TYPE_VENDOR | USB_RECIP_DEVICE, 0, 0, 0, (char *)buffer, 4, MICRONUCLEUS_USB_TIMEOUT);
我想知道它是如何工作的,因为接口 #0 没有端点:
$./micronucleus --type intel-hex /tmp/Start.ino.hex
> Please plug in the device ...
> Press CTRL+C to terminate the program.
Found interfaces: 1
Endpoints: 0
> Device is found!
connecting: 40% complete
> Device has firmware version 1.6
> Available space for user applications: 6012 bytes
> Suggested sleep time between sending pages: 8ms
> Whole page count: 94 page size: 64
> Erase function sleep duration: 752ms
parsing: 60% complete
> Erasing the memory ...
erasing: 80% complete
> Starting to upload ...
writing: 100% complete
>> Micronucleus done. Thank you!
通常我希望接口有 2 个端点(从 usb.h 进出):
#define USB_ENDPOINT_IN 0x80
#define USB_ENDPOINT_OUT 0x00
任何人都可以向我解释 usb_control_msg(nucleus->device, USB_ENDPOINT_IN| USB_TYPE_VENDOR | USB_RECIP_DEVICE, 0, 0, 0, (char *)buffer, 4, MICRONUCLEUS_USB_TIMEOUT);
在没有端点的情况下如何工作吗?
此处回答:https://arduino.stackexchange.com/a/44026/8327。
简而言之:它没有端点(0 除外)并且仅使用控制传输进行交互。
我正在上传到 Digispark board. It uses micronucleus bootloader and i can see uploader code。我对其进行了一些修改以查看接口和端点数:
nucleus->device = usb_open(dev);
// added by me - start
int interfaces, endpoints, j;
struct usb_interface_descriptor *interface = NULL;
interfaces = dev->config->bNumInterfaces;
fprintf(stderr, "Found interfaces: %i\n", interfaces);
interface = &(dev->config->interface[0].altsetting[0]);
fprintf(stderr, "Endpoints: %i\n", interface->bNumEndpoints);
// added by me - end
// get nucleus info
unsigned char buffer[4];
int res = usb_control_msg(nucleus->device, USB_ENDPOINT_IN| USB_TYPE_VENDOR | USB_RECIP_DEVICE, 0, 0, 0, (char *)buffer, 4, MICRONUCLEUS_USB_TIMEOUT);
我想知道它是如何工作的,因为接口 #0 没有端点:
$./micronucleus --type intel-hex /tmp/Start.ino.hex
> Please plug in the device ...
> Press CTRL+C to terminate the program.
Found interfaces: 1
Endpoints: 0
> Device is found!
connecting: 40% complete
> Device has firmware version 1.6
> Available space for user applications: 6012 bytes
> Suggested sleep time between sending pages: 8ms
> Whole page count: 94 page size: 64
> Erase function sleep duration: 752ms
parsing: 60% complete
> Erasing the memory ...
erasing: 80% complete
> Starting to upload ...
writing: 100% complete
>> Micronucleus done. Thank you!
通常我希望接口有 2 个端点(从 usb.h 进出):
#define USB_ENDPOINT_IN 0x80
#define USB_ENDPOINT_OUT 0x00
任何人都可以向我解释 usb_control_msg(nucleus->device, USB_ENDPOINT_IN| USB_TYPE_VENDOR | USB_RECIP_DEVICE, 0, 0, 0, (char *)buffer, 4, MICRONUCLEUS_USB_TIMEOUT);
在没有端点的情况下如何工作吗?
此处回答:https://arduino.stackexchange.com/a/44026/8327。 简而言之:它没有端点(0 除外)并且仅使用控制传输进行交互。