首页 | 新闻 | 新品 | 文库 | 方案 | 视频 | 下载 | 商城 | 开发板 | 数据中心 | 座谈新版 | 培训 | 工具 | 博客 | 论坛 | 百科 | GEC | 活动 | 主题月 | 电子展
返回列表 回复 发帖

libusb在arm上的编译(2)

libusb在arm上的编译(2)

#include <stdio.h>
#include
<stdlib.h>
#include
<usb.h>
void print_endpoint(struct usb_endpoint_descriptor *endpoint)
{
printf(
" bEndpointAddress: %02xh\n", endpoint->bEndpointAddress);
printf(
" bmAttributes: %02xh\n", endpoint->bmAttributes);
printf(
" wMaxPacketSize: %d\n", endpoint->wMaxPacketSize);
printf(
" bInterval: %d\n", endpoint->bInterval);
printf(
" bRefresh: %d\n", endpoint->bRefresh);
printf(
" bSynchAddress: %d\n", endpoint->bSynchAddress);
}


void print_altsetting(struct usb_interface_descriptor *interface)
{
int i;

printf(
" bInterfaceNumber: %d\n", interface->bInterfaceNumber);
printf(
" bAlternateSetting: %d\n", interface->bAlternateSetting);
printf(
" bNumEndpoints: %d\n", interface->bNumEndpoints);
printf(
" bInterfaceClass: %d\n", interface->bInterfaceClass);
printf(
" bInterfaceSubClass: %d\n", interface->bInterfaceSubClass);
printf(
" bInterfaceProtocol: %d\n", interface->bInterfaceProtocol);
printf(
" iInterface: %d\n", interface->iInterface);

for (i =
0; i <
interface->bNumEndpoints; i++)
print_endpoint(
&interface->endpoint);
}


void print_interface(struct usb_interface *interface)
{
int i;

for (i =
0; i <
interface->num_altsetting; i++)
print_altsetting(
&interface->altsetting);
}


void print_configuration(struct usb_config_descriptor *config)
{
int i;

printf(
" wTotalLength: %d\n", config->wTotalLength);
printf(
" bNumInterfaces: %d\n", config->bNumInterfaces);
printf(
" bConfigurationValue: %d\n", config->bConfigurationValue);
printf(
" iConfiguration: %d\n", config->iConfiguration);
printf(
" bmAttributes: %02xh\n", config->bmAttributes);
printf(
" MaxPower: %d\n", config->MaxPower);

for (i =
0; i < config->bNumInterfaces; i++)
print_interface(
&config->interface);
}
继承事业,薪火相传
返回列表