Author Topic: HID device activate when shared mode = false  (Read 2111 times)

hid1

  • Jr. Member
  • **
  • Posts: 66
    • View Profile
HID device activate when shared mode = false
« on: September 05, 2011, 02:22:15 pm »
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
« Last Edit: September 05, 2011, 07:26:55 pm by hid1 »

Roman Novgorodov

  • Engineer
  • Administrator
  • Hero Member
  • *****
  • Posts: 994
  • we will win
    • View Profile
    • Forums.nrCommLib.Com
Re: HID device activate when shared mode = false
« Reply #1 on: September 07, 2011, 04:51:29 pm »
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

  • Jr. Member
  • **
  • Posts: 66
    • View Profile
Re: HID device activate when shared mode = false
« Reply #2 on: September 07, 2011, 07:59:27 pm »
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?
« Last Edit: September 08, 2011, 05:13:43 pm by hid1 »

Roman Novgorodov

  • Engineer
  • Administrator
  • Hero Member
  • *****
  • Posts: 994
  • we will win
    • View Profile
    • Forums.nrCommLib.Com
Re: HID device activate when shared mode = false
« Reply #3 on: September 08, 2011, 05:13:42 pm »
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

  • Jr. Member
  • **
  • Posts: 66
    • View Profile
Re: HID device activate when shared mode = false
« Reply #4 on: September 09, 2011, 07:30:10 am »
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

  • Newbie
  • *
  • Posts: 3
    • View Profile
Re: HID device activate when shared mode = false
« Reply #5 on: September 16, 2015, 03:27:18 pm »
It would also be something interesting for me. Any new development on this?