• Welcome to Forum.Deepsoftware.Com. Please login or sign up.
 

HID device activate when shared mode = false

Started by hid1, September 05, 2011, 11:22:15 am

Previous topic - Next topic

hid1

September 05, 2011, 11:22:15 am Last Edit: September 05, 2011, 04:26:55 pm by hid1
Hello,

hid.shared  mode is false;

First instance  of application can connect device. if another instance running, built in hid component  waiting to connect.

First instance ended. second instance cannot connect the device without hid.update.
(by hid.active := true //Hid not  active)

WMDeviceChange etc cannot triggered. becouse device plugged and runnig on USB port.

How can I connect the shared device  without hid.update  ?

if not hid.active,  periodically hid.update and trying connect looks like solution. but some windows version and pcs, USB mouse freezing problem occured. I want to use hid.update  only application start and when device plugged.

Thank you

Roman Novgorodov

Hello

Thank you for information.

It seems like I do not understand you.

I run two instances of HIDDemo and open same device and get data without any problem.
Note that HIDDemo uses ShareMode = True

If you want to set SharedMode in False, you should understand that only one instance of application can use HID device.

Roman Novgorodov
DeepSoftware LLC
DeepSoftware llc - The professional components for Delphi/CBuilder/.NET. The high quality custom software development.
Forums.nrCommLib.Com - DeepSoftware Tech Support Forum.

hid1

September 07, 2011, 04:59:27 pm #2 Last Edit: September 08, 2011, 02:13:43 pm by hid1
I want to set SharedMode in False, Only one application or nrHid component can connect the device same time. Wanted exactly this.

Please set HIDDemo  ShareMode = False. and compile it.

  • Run 1 instance and activate hid

  • Run second instance , the device invisible. for second instance

  • Close first instance. Now second instance cannot connect the device without hid. update

  • For automatic connect, application must know, hid device available now. Unfortunately this is imposible without  periodically hid. update



Periodically hid.update problem. How can application understand device released by other application for connecting retry?

Roman Novgorodov

Hello

Yes, you are right.
If first application opens device in exclusive mode, the second app can not see this device.
The Update() method opens every enumerated HID device for get detailed info about descriptors and HID features of device.
We need think more for resolve this problem. I hope we will release new lib version in the next week.

Roman Novgorodov
DeepSoftware LLC

DeepSoftware llc - The professional components for Delphi/CBuilder/.NET. The high quality custom software development.
Forums.nrCommLib.Com - DeepSoftware Tech Support Forum.

hid1

This may be enough:

ShareMode := False will prevent only communication.
(2nd instance can enumerate device but cannot receive data. until first instance release the device)

or

New  property may be useful as nrhid.DeviceLocked

Enumerate available for locked device but 2nd instance should wait
until   nrhid.DeviceLocked= false

posdiver

It would also be something interesting for me. Any new development on this?