The solution of usbredir display problems for windows, temporarily

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Ok, this's not a patch, for I don't think it's good enough to be applied to upstream.
For windows client, it's really not friendly for usbredir:
1. We need usbclerk service to let it redirect automatically --> not stably currently
2. The display of redir-list is ALL "USB DEVICE" -->  make users confused maybe
3. Filtering by class doesn't work at all --> usually need to filter input devices, etc.

The reason for all the above is that libusb supports windows poorly.
So here's the solution for problem 2 & 3,
this's a vs2010 project built with libwdi, the output is usbutils.dll,
and I put the project in github

After building libwdi, add LIBWDI_DIR=path\to\libwdi in environment settings,
then build usbutils project

In gtk/usbutil.c or gtk/usb-device-manager.c ...
do something like this(just an example):
#define MAX_LEN_ 256
typedef struct{
        char desc[MAX_LEN_];
        int pid;
        int vid;
        int clas;
}UsbInfo;

//...
    UsbInfo usbInfo[20];
    typedef int (*fpFun)(UsbInfo[]);
    HMODULE hDllLib = LoadLibraryA("usbutils.dll");
    fpFun getUsbList = (fpFun)GetProcAddress(hDllLib,"getUsbList");
    int num = getUsbList(usbInfo);
    for(int i = 0; i < num; ++i){
        if(usbInfo[i].pid == pid && usbInfo[i].vid == vid)
            return g_strdup_printf("%s [%02X:%04X:%04X]", usbInfo[i].desc,
                usbInfo[i].clas, usbInfo[i].vid, usbInfo[i].pid);
//...

​And at last, here's the effect:

--
QSBDT0RFUiBGUk9NIFJJRVNUIE9GIENUU0VV
_______________________________________________
Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
http://lists.freedesktop.org/mailman/listinfo/spice-devel

[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]     [Monitors]