Author Topic: USB Device Restart/Enable/Disable  (Read 10949 times)

hid1

  • Jr. Member
  • **
  • Posts: 66
    • View Profile
USB Device Restart/Enable/Disable
« on: May 17, 2010, 09:41:27 pm »
Hello,
latest nrcomlib used, at Program Files\nrComm Lib\Demos\USBDeviceDemo\
usbdevicedemo.exe does not eject any USB devices.  
Custom HID devices or another. Absolutely not work.
tested on > Windows Vista

I need USB HID device eject and plug. (when devicefails)

« Last Edit: May 19, 2010, 03:11:01 pm by hid1 »

Roman Novgorodov

  • Engineer
  • Administrator
  • Hero Member
  • *****
  • Posts: 994
  • we will win
    • View Profile
    • Forums.nrCommLib.Com
Re: USB eject function doesnt work
« Reply #1 on: May 18, 2010, 03:08:27 am »
Hello

This feature is intended for eject USB disks.
Like system well know function "Safely Remove Device" in tray box.
By the way Windows does not allow to unplug HID devices in  "Safely Remove Device".

We will try to find solution.

Roman Novgorodov
DeepSoftwae.Com
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: USB eject function doesnt work
« Reply #2 on: May 18, 2010, 10:03:33 am »
Ok. I will try device based fail monitor to  reset usb HID device.

hid1

  • Jr. Member
  • **
  • Posts: 66
    • View Profile
Re: USB eject function doesnt work
« Reply #3 on: May 18, 2010, 10:08:34 am »
But programmatically disable or enable HID device like device manager right click, this is possible by nrhid ?

Roman Novgorodov

  • Engineer
  • Administrator
  • Hero Member
  • *****
  • Posts: 994
  • we will win
    • View Profile
    • Forums.nrCommLib.Com
Re: USB eject function doesnt work
« Reply #4 on: May 18, 2010, 03:47:12 pm »
We will try to add such functionality. But I can't promise anything :-(

Roman
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: USB eject function doesnt work
« Reply #5 on: May 19, 2010, 03:06:47 pm »
Ok. thanks.

Re-detect USB Device without unplugging, USB device enable/disable, Devcon.exe can do it.  I believe, nrUSB can also. But I don't know how?

For example I need restart usb transfers for my device
Code: [Select]
devcon.exe restart USB\VID_XXXX*PID_XXXX*   This is ok with devcon. (XXX.. MY VID and MY PID) by  function DiRestartDevice? or another functions in nrwin32di unit?


http://www.eggheadcafe.com/software/aspnet/29682755/redetect-a-usb-device-wi.aspx

I've download Windows Driver KIT. devcon.exe source available. But I 'm not familiar for cpp
« Last Edit: May 19, 2010, 03:11:24 pm by hid1 »

Roman Novgorodov

  • Engineer
  • Administrator
  • Hero Member
  • *****
  • Posts: 994
  • we will win
    • View Profile
    • Forums.nrCommLib.Com
Re: USB Device Restart/Enable/Disable
« Reply #6 on: May 20, 2010, 10:32:25 am »
Hello

Thank you for information.

Did you try TnrUsb.Restart() method?

Roman Novgorodov
DeepSoftware.Com
« Last Edit: May 20, 2010, 11:07:20 am by Roman Novgorodov »
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: USB Device Restart/Enable/Disable
« Reply #7 on: May 20, 2010, 11:52:15 am »
nrUSB1.Restart() method not available
and
nrUSB1.Reset do not reset the bus and data transfer.
 
My device is Custom HID device winusb driver not used.
My nrcomm lib  version nrcomm_pro_906 (latest which I know)

Program Files\nrComm Lib\Demos\USBDriverDemo used,
Device selected from device box and new added button pressed.

Code: [Select]
procedure TForm1.Button2Click(Sender: TObject);
begin
 nrUSB1.Reset;
 // cannot reset HID device data trasfer. when other app. uses device or not.
 
end;
Thank you for quick reply


I found smilar Delphi demos for any device. (HID etc. no problem)
http://www.yeahware.com/download/eject.zip
http://www.yeahware.com/download/enable.zip

http://www.yeahware.com/
« Last Edit: May 20, 2010, 02:11:59 pm by hid1 »

Roman Novgorodov

  • Engineer
  • Administrator
  • Hero Member
  • *****
  • Posts: 994
  • we will win
    • View Profile
    • Forums.nrCommLib.Com
Re: USB Device Restart/Enable/Disable
« Reply #8 on: May 20, 2010, 08:57:35 pm »
Hello

Thank you for information.

Please try new version of demo from attachment.

Roman Novgorodov
DeepSoftware.Com
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: USB Device Restart/Enable/Disable
« Reply #9 on: May 23, 2010, 08:43:13 am »
Thanks for version nrCommLib 9.07.  It works fine.