| KDK_USB_GET_LIST(3) | Library Functions Manual | KDK_USB_GET_LIST(3) |
NAME
kdk_usb_get_list - 获取外接usb设备信息
SYNOPSIS
#include <libkyusb.h> extern pDriverInfoList kdk_usb_get_list(); Link with -lkyusb.
Detailed Description
The main function of the interface is to obtain the external usb device information.
RETURN VALUE
On success, returns a pointer to a pDriverInfoList structure containing usb information.
The pDriverInfoList structure is defined in <libkyusb.h> as follows:
typedef struct driver_list
{
struct driver_info *data;
struct driver_list *next;
} DriverInfoList, *pDriverInfoList;
typedef struct driver_info
{
char name[32]; //名称
char type[2 + 1]; //类型
char pid[4 + 1];
char vid[4 + 1];
char serialNo[32]; //序列号
char devNode[32]; //路径
} DriverInfo, *pDriverInfo;
On error, return NULL.
EXAMPLES
#include "stdio.h"
#include "libkyusb.h"
int main()
{
pDriverInfoList list = kdk_usb_get_list();
if(list)
{
pDriverInfoList tmp = list;
while (tmp)
{
printf("Name: %s",tmp->data->name);
printf("Class: %s",tmp->data->type);
printf("PID: %s",tmp->data->pid);
printf("VID: %s",tmp->data->vid);
printf("Serial: %s",tmp->data->serialNo);
printf("DevNode: %s0,tmp->data->devNode);
tmp = tmp->next;
}
}
kdk_usb_free(list);
return 0;
}
CONFORMING TO
These functions are as per the withdrawn POSIX.1e draft specification. The following functions are Linux extensions: kdk_usb_free().
SEE ALSO
| Fri Aug 25 2023 | Linux Programmer's Manual |