<div dir="ltr"><div class="gmail_default" style="font-family:verdana,sans-serif;font-size:small;color:rgb(0,0,0)">Ok, this's not a patch, for I don't think it's good enough to be applied to upstream.</div><div class="gmail_default" style="font-family:verdana,sans-serif;font-size:small;color:rgb(0,0,0)">
For windows client, it's really not friendly for usbredir:</div><div class="gmail_default" style="font-family:verdana,sans-serif;font-size:small;color:rgb(0,0,0)">1. We need usbclerk service to let it redirect automatically --> not stably currently</div>
<div class="gmail_default" style="font-family:verdana,sans-serif;font-size:small;color:rgb(0,0,0)">2. The display of redir-list is ALL "USB DEVICE" --> make users <span style="font-family:'Microsoft YaHei';font-size:13px;white-space:nowrap">confused maybe</span></div>
<div class="gmail_default" style="font-family:verdana,sans-serif;font-size:small;color:rgb(0,0,0)">3. Filtering by class doesn't work at all --> usually need to filter input devices, etc.</div><div class="gmail_default" style="font-family:verdana,sans-serif;font-size:small;color:rgb(0,0,0)">
<br></div><div class="gmail_default" style="font-family:verdana,sans-serif;font-size:small;color:rgb(0,0,0)">The reason for all the above is that libusb supports windows poorly.</div><div class="gmail_default" style="font-family:verdana,sans-serif;font-size:small;color:rgb(0,0,0)">
So here's the solution for problem 2 & 3,</div><div class="gmail_default" style="font-family:verdana,sans-serif;font-size:small;color:rgb(0,0,0)">this's a vs2010 project built with <a href="http://sourceforge.net/projects/libwdi/">libwdi</a>, the output is usbutils.dll,</div>
<div class="gmail_default" style="font-family:verdana,sans-serif;font-size:small;color:rgb(0,0,0)">and I put the project in <a href="https://github.com/int64Ago/UsbUtils4Spice">github</a></div><div class="gmail_default" style="font-family:verdana,sans-serif;font-size:small;color:rgb(0,0,0)">
<br></div><div class="gmail_default" style="font-family:verdana,sans-serif;font-size:small;color:rgb(0,0,0)">After building libwdi, add LIBWDI_DIR=path\to\libwdi in environment settings,</div><div class="gmail_default" style="font-family:verdana,sans-serif;font-size:small;color:rgb(0,0,0)">
then build usbutils project</div><div class="gmail_default" style="font-family:verdana,sans-serif;font-size:small;color:rgb(0,0,0)"><br></div><div class="gmail_default" style="font-family:verdana,sans-serif;font-size:small;color:rgb(0,0,0)">
In gtk/usbutil.c or gtk/usb-device-manager.c ...</div><div class="gmail_default" style="font-family:verdana,sans-serif;font-size:small;color:rgb(0,0,0)">do something like this(just an example):</div><div class="gmail_default" style="font-family:verdana,sans-serif;font-size:small;color:rgb(0,0,0)">
<div class="" style="font-family:monospace;white-space:pre;color:rgb(0,136,0);line-height:normal">#define MAX_LEN_ 256</div><div class="" style="font-family:monospace;white-space:pre;color:rgb(0,136,0);line-height:normal">
typedef struct{</div><div class="" style="font-family:monospace;white-space:pre;color:rgb(0,136,0);line-height:normal"> char desc[MAX_LEN_];</div><div class="" style="font-family:monospace;white-space:pre;color:rgb(0,136,0);line-height:normal">
int pid;</div><div class="" style="font-family:monospace;white-space:pre;color:rgb(0,136,0);line-height:normal"> int vid;</div><div class="" style="font-family:monospace;white-space:pre;color:rgb(0,136,0);line-height:normal">
int clas;</div><div class="" style="font-family:monospace;white-space:pre;color:rgb(0,136,0);line-height:normal">}UsbInfo;</div><div class="" style="font-family:monospace;white-space:pre;color:rgb(0,136,0);line-height:normal">
<br></div><div class="" style="font-family:monospace;white-space:pre;color:rgb(0,136,0);line-height:normal">//...</div><div class="" style="font-family:monospace;white-space:pre;color:rgb(0,136,0);line-height:normal"><div class="" style="line-height:normal">
UsbInfo usbInfo[20];</div><div class="" style="line-height:normal"> typedef int (*fpFun)(UsbInfo[]);</div><div class="" style="line-height:normal"> HMODULE hDllLib = LoadLibraryA("usbutils.dll");</div>
<div class="" style="line-height:normal"> fpFun getUsbList = (fpFun)GetProcAddress(hDllLib,"getUsbList");</div><div class="" style="line-height:normal"> int num = getUsbList(usbInfo);</div><div class="" style="line-height:normal">
for(int i = 0; i < num; ++i){</div><div class="" style="line-height:normal"> if(usbInfo[i].pid == pid && usbInfo[i].vid == vid)</div><div class="" style="line-height:normal"> return g_strdup_printf("%s [%02X:%04X:%04X]", usbInfo[i].desc,</div>
<div class="" style="line-height:normal"> usbInfo[i].clas, usbInfo[i].vid, usbInfo[i].pid);</div><div class="" style="line-height:normal">//...</div></div></div><div><br></div><div><div class="gmail_default" style="font-family:verdana,sans-serif;font-size:small;color:rgb(0,0,0)">
And at last, here's the effect:</div><div class="gmail_default" style="font-family:verdana,sans-serif;font-size:small;color:rgb(0,0,0)"><a href="http://int64ago.qiniudn.com/o_190vus62h3lh1pr81kf0be6v4b9.png">http://int64ago.qiniudn.com/o_190vus62h3lh1pr81kf0be6v4b9.png</a></div>
<br></div>-- <br><div dir="ltr"><font color="#cfe2f3">Q</font><font color="#9fc5e8">S</font><font color="#6fa8dc">B</font><font color="#3d85c6">D</font><font color="#0b5394">T</font><font color="#073763">0</font><font color="#0c343d">R</font><font color="#134f5c">F</font><font color="#45818e">U</font><font color="#76a5af">i</font><font color="#a2c4c9">B</font><font color="#d0e0e3">G</font><font color="#d9ead3">U</font><font color="#b6d7a8">k</font><font color="#93c47d">9</font><font color="#6aa84f">N</font><font color="#38761d">I</font><font color="#274e13">F</font><font color="#7f6000">J</font><font color="#bf9000">J</font><font color="#f1c232">R</font><font color="#ffd966">V</font><font color="#ffe599">N</font><font color="#fff2cc">U</font><font color="#fce5cd">I</font><font color="#f9cb9c">E</font><font color="#f6b26b">9</font><font color="#e69138">G</font><font color="#b45f06">I</font><font color="#783f04">E</font><font color="#660000">N</font><font color="#990000">U</font><font color="#cc0000">U</font><font color="#e06666">0V</font><font color="#ea9999">V</font></div>
</div>