[Spice-devel] UsbDk

Dmitry Fleytman dmitry at daynix.com
Thu Mar 5 01:23:42 PST 2015


Hi Jason,

> On Mar 5, 2015, at 10:25 AM, Jason Kotzin <jason at flirc.tv> wrote:
> 
> Yes, applied them, and followed up with a compile error.

Please see my answer on this at libusb-devel.

> 
> Okay, but I’m still confused. My application does not always run. So they will be prompted with a ‘new device found message’, But when they run my main application and with libusb, that message will disappear, and my device will be hidden. When the app exits, windows will ask for a driver. So is the only benefit something that is running continuously?

Let me explain…

Currently UsbDK only active when there is a user mode application that has open UsbDk handles. When such an application exits or closes UsbDk handles system reverts to original state and UsbDk effectively does nothing.
Rationale behind that is to avoid scenarios when application captures or hides some device, crashes and leaves that device in a state when Windows is unable to recognise it and load in-box drivers. 

While it is perfectly fine for remote USB solutions, your scenario doesn’t look currently covered.

One possible way to resolve this issue is introduction of additional UsbDk API for setting persistent hide rules stored in registry, so one will be able to set those rules on install and they will exist as long as UsbDk is installed. If setting of those rules requires administrative privileges the risk system end up in an invalid state will be minimised. However there are still concerns because of various misuse and conflict scenarios, especially when there is a number of UsbDk clients installed on the same system. 

I’d suggest to consider installing a null driver for your device (see here: https://msdn.microsoft.com/en-us/library/windows/hardware/ff547608(v=vs.85).aspx) <https://msdn.microsoft.com/en-us/library/windows/hardware/ff547608(v=vs.85).aspx)>.
If I understand your case correctly this is exactly what you’re looking for. If that is not good enough for some reason let’s discuss another options that involve UsbDk extensions.

Thanks,
Dmitry

> 
>> On Mar 5, 2015, at 12:21 AM, Dmitry Fleytman <dmitry at daynix.com <mailto:dmitry at daynix.com>> wrote:
>> 
>> Hi Jason,
>> 
>>> On Mar 4, 2015, at 19:42 PM, Jason Kotzin <jason at flirc.tv <mailto:jason at flirc.tv>> wrote:
>>> 
>>> Hi Dmitry - 
>>> 
>>> Thanks for getting back to me.
>>> 
>>> Yes, I understand HID is the way to go, but I have quite a few devices shipped and flashed, so I need to solve this terrible windows problem with these existing devices. But for future stuff, I’m not doing anything other than HID anymore because of windows.
>>> 
>>> Not sure I understand this: 
>>> 
>>>> Use hider API, UsbDk_AddHideRule() etc.
>>> 
>>> 
>>> If my installer, installs the msi package for me, am I supposed to run some code afterwards that calls this API (because it’s not exposed in libusb) ? 
>> 
>> Yes, this function is not exported by libusb, you’ll need to load UsbDkHelper.dll and call this function from there (see our libusb patches or UsbDkController.exe for sample code).
>> 
>>> 
>>> Or can I simply use this; UsbDkController.exe -H VID
>> 
>> Also an option, but much more heavyweight,
>> pay attention that when UsbDkController.exe exits it cleans hide rules, so you’ll need to have it running all the time.
>> 
>>> 
>>> I’m on the developer mailer and don’t see the patches.
>>> 
>>> Could I trouble you for a copy of these patches as well as the libusb git commit has they intended to be applied to? I’m happy to help test and will even deploy this to several thousand people should this look promising. 
>> 
>> As I understood from mailings on libusb-devel you’ve found patches already, right?
>> 
>> ~Dmitry.
>> 
>>> 
>>> Thanks Dmitry.
>>> 
>>> Very Sincerely,
>>> Jason
>>> 
>>> 
>>> 
>>>> On Mar 4, 2015, at 5:03 AM, Dmitry Fleytman <dmitry at daynix.com <mailto:dmitry at daynix.com>> wrote:
>>>> 
>>>> Hi Jason,
>>>> 
>>>> My name is Dmitry Fleytman and I’m author and maintainer of UsbDk.
>>>> 
>>>>> On Mar 3, 2015, at 23:36 PM, Jason Kotzin <jason at flirc.tv <mailto:jason at flirc.tv>> wrote:
>>>>> 
>>>>> Spice Developers - 
>>>>> 
>>>>> I have been watching the discussion on the libusb developer mailer and am absolutely intrigued. The number one issue I have my product is with windows usb device handling. Drivers and inf’s do not consistently work and with so many versions of windows and hardware, I have battled issue after issue. I’m at the point now where I’m considering re-writing all my firmware, and all my drivers to use a hid device for windows driverless communication (already started).
>>>>> 
>>>>> UsbDk sounds too good to be true.
>>>> 
>>>> 
>>>> Thanks :)
>>>> 
>>>>> 
>>>>> I’m interested in playing with it, and have read through all the documentation, but am a bit unclear how everything works. Please let me know if this is correct:
>>>>> 
>>>>> 1. Instal via msi package (I understand there is an alternative, but this is what I would use)
>>>>> 2. Ensure I have the libusb backend for UsbDk.
>>>>> 3. Done, my libusb on windows should now use the UsbDk filter driver.
>>>>> 
>>>>> Is that correct?
>>>> 
>>>> Yes, exactly.
>>>> 
>>>>> 
>>>>> How do I tell windows not to fire up that ‘new hardware detected’ message. With UsbDkController.exe -r ID sn ?
>>>> 
>>>> 
>>>> Use hider API, UsbDk_AddHideRule() etc.
>>>> 
>>>>> 
>>>>> Where can I find the libusb patches? I’m anxious to try this.
>>>> 
>>>> I’ve posted patches to libusb-devel a few days ago. Please do not hesitate to send us problem reports if any.
>>>> 
>>>>> 
>>>>> Thanks so much.
>>>> 
>>>> You’re welcome!
>>>> 
>>>> ~Dmitry
>>>> 
>>>> P.S. While we are very interested to have people use and test UsbDk for different devices and in different scenarios, I must say that driverless HID device scheme is way better and simpler as long as your device functionally covered by HID specification, so maybe you should go that direction even if UsbDk works good for you...
>>>> 
>>>> 
>>>>> 
>>>>> Very Sincerely,
>>>>> Jason
>>>>> 
>>>>> _______________________________________________
>>>>> Spice-devel mailing list
>>>>> Spice-devel at lists.freedesktop.org <mailto:Spice-devel at lists.freedesktop.org>
>>>>> http://lists.freedesktop.org/mailman/listinfo/spice-devel
> 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/spice-devel/attachments/20150305/e37dcdac/attachment.html>


More information about the Spice-devel mailing list