View Issue Details

IDProjectCategoryView StatusLast Update
0005894JEDI VCL00 JVCL Componentspublic2015-09-21 17:47
ReporterMellowareAssigned Toobones 
PrioritynormalSeveritymajorReproducibilityrandom
Status resolvedResolutionfixed 
Product Version3.45 
Target VersionFixed in Version3.49 
Summary0005894: HID EControllerError: Device cannot be opened
DescriptionUsers report for some its random another guy can reproduce it every time. For one user it is when he plugs in a specific USB device "Virgin Health Miles GoZone pedometer".

Another user it is every time he Logs and and Logs off the machine. From looking at the source code this error is in the HIDDevice create and it must be returning a INVALID_HANDLE for the device in certain scenarios.

I have only ever had it happen to me once and I could not reproduce it. I was hoping you could take another look where that error is thrown and see what possible causes might be?

This post the user gets the error regularly: http://forum.melloware.com/viewtopic.php?f=1&t=9839

TagsNo tags attached.

Relationships

related to 0006168 resolvedobones crash inside TJvHidDeviceController.DeviceChange( ) internal worker function FillInList( ) 

Activities

2012-06-06 14:59

 

hidtester.zip (90,339 bytes)

Melloware

2012-06-06 15:02

reporter   ~0019802

Attached is HidTester project. It attaches to all HID devices so if you press buttons on your remote you should see HID output.

Where the Tivo Slide has issues is possibly two areas.

1. Press the Force button to force reloading of the USB devices we have seen increased CPU Usage and possibly EControllerError Device cannot be opened when the Machine Wakes from Sleep or upon Logout of User.

2. If that doesn't work try leaving the app running for a while letting your Tivo Remote go to sleep. This seems to cause the Bluetooth stack to trigger a "Devices Have Changed..." event and the USB devices reload and we see increased CPU Usage or EControllerError.

2012-06-06 15:52

 

HIDTester-bin-obones.zip (2,524,576 bytes)

obones

2012-06-06 15:54

administrator   ~0019803

Last edited: 2012-06-06 15:54

I have attached the exe file compiled here with the very latest sources (the content one can get in SVN) and I cannot see the CPU usage that you talk about.

I tried option 1 and option 2 (10 minutes of leaving the remote idle) and no high CPU usage.

The only way to get high CPU usage that I saw was to not use the changes I just made in the SVN version

Melloware

2012-06-06 17:21

reporter   ~0019804

I will have some of my users having Tivo Slide issues try this.

Melloware

2012-06-08 15:12

reporter   ~0019808

OK so good news and bad news.

Good news: I did a full JVCL Clean and Rebuild and I think your patch just never got compiled the first time. The Tivo Slide users are reporting 0% CPU utilization so that is excellent.

Bad News: A few of my users are still getting EControllerError: Device could not be opened when they plug in certain devices or Log off the computer. Is there an elegant way I can handle this situation?

I think since this Exception is thrown on from two places, when the devices change or potentially in TJvHidDevice.Destroy. The problem is there is no place for me to catch this error and handle it gracefully. My ideal I guess would be if a Device could not be opened I could log an error but allow the rest of the devices to continue to be checked out as Normal. Almost like an OnDeviceError callback???

obones

2012-06-11 15:45

administrator   ~0019816

Do you have the stack trace when this happens? I mean you could use JclDebug, MadExcept or EurekaLog to get this and as a result you could see where the call is coming from and add an appropriate try..except block around it.

Melloware

2012-06-11 15:51

reporter   ~0019817

I have attached what the JCLExceptionDialog catches. I think the problem is the Device Unplug and Plug in is running in a background thread of JVHidController that is outside of any execution context of my app to surround with a try catch.

So if you just plug in a device it gets the exception but there is nothing for my app to catch and it is bubbling all the way out the JCLExceptionDialog.

2012-06-11 15:52

 

econtroller-error.txt (13,405 bytes)
Device cannot be opened.

Exception class: EControllerError
Exception address: 00510E96
----------------------------------------------------------------------------
------------------------
System   : Windows 7 Professional, Version: 6.1, Build: 1DB1, "Service Pack
1"
Processor: Intel, Intel(R) Core(TM)2 CPU          6400  @ 2.13GHz, 2133 MHz
Display  : 1920x1200 pixels, 32 bpp
----------------------------------------------------------------------------
------------------------
List of loaded modules:
[002A0000] C:\Program Files\BillP Studios\WinPatrol\PATROLPRO.DLL
<10000000> 1.4.0.0 - 1.4.0.0
           WinPatrol Helper DLL
[00400000] C:\Program Files\Melloware\Intelliremote\Intelliremote.exe
           2.8.4.921 - 2.8.4.921-BETA
           Intelliremote remote control replacement application
[019F0000] C:\Program Files\Melloware\Intelliremote\AutoItX3.dll
<10000000> 3.3.6.1 - 3, 3, 6, 1
           AutoIt v3 ActiveX Control
[10000000] C:\Program Files\SlySoft\AnyDVD\ADvdDiscHlp1.dll
           2.0.3.5 - 2, 0, 3, 5
           ADvdDisc Dynamic Link Library
[56380000] C:\Program Files\DigitalPersona\Bin\DpOFeedb.dll
           3.0.0.1844 - 3.0.0.1844
           OTS Feedback Module
[5FB30000] C:\Windows\system32\url.dll
           9.0.8112.16443 - 9.00.8112.16443 (WIN7_IE9_GDR.120227-1545)
           Internet Shortcut Shell Extension DLL
[618A0000] C:\Windows\system32\mscms.dll
           6.1.7601.17514 - 6.1.7600.16385 (win7_rtm.090713-1255)
           Microsoft Color Matching System DLL
[61940000] C:\Windows\system32\olepro32.dll
           6.1.7601.17514 - 6.1.7601.17514
[62F20000] C:\Windows\system32\icm32.dll
           6.1.7600.16385 - 6.1.7600.16385 (win7_rtm.090713-1255)
           Microsoft Color Management Module (CMM)
[63250000] C:\Windows\system32\oledlg.dll
           6.1.7600.16385 - 6.1.7600.16385 (win7_rtm.090713-1255)
           OLE User Interface Support
[64CE0000] C:\Windows\system32\RICHED20.DLL
           5.31.23.1230 - 5.31.23.1230
           Rich Text Edit Control, v3.1
[65060000] C:\Windows\system32\appwiz.cpl
           6.1.7601.17514 - 6.1.7600.16385 (win7_rtm.090713-1255)
           Shell Application Manager
[65380000] C:\Windows\system32\osbaseln.dll
           6.1.7600.16385 - 6.1.7600.16385 (win7_rtm.090713-1255)
           Service Reporting API
[65FC0000] C:\Program Files\UltraMon\RTSUltraMonHook.dll
           3.1.0.0 - 3.1.0.0
           Hook DLL for Realtime Soft UltraMon
[67350000] C:\Windows\system32\IEFRAME.dll
           9.0.8112.16443 - 9.00.8112.16421 (WIN7_IE9_RTM.110308-0330)
           Internet Browser
[68430000] C:\Windows\system32\shdocvw.dll
           6.1.7601.17514 - 6.1.7600.16385 (win7_rtm.090713-1255)
           Shell Doc Object and Control Library
[6D850000] C:\Windows\system32\msi.dll
           5.0.7601.17514 - 5.0.7601.17514
           Windows Installer
[709C0000] C:\Windows\system32\rasadhlp.dll
           6.1.7600.16385 - 6.1.7600.16385 (win7_rtm.090713-1255)
           Remote Access AutoDial Helper
[70C40000] C:\Program Files\Bonjour\mdnsNSP.dll
           3.0.0.10 - 3,0,0,10
           Bonjour Namespace Provider
[70CD0000] C:\Windows\system32\MPR.dll
           6.1.7600.16385 - 6.1.7600.16385 (win7_rtm.090713-1255)
           Multiple Provider Router DLL
[70CF0000] C:\Program Files\Common Files\Microsoft Shared\Windows
Live\WLIDNSP.DLL
           7.250.4232.0 - 7.250.4232.0
           MicrosoftR Windows Live ID Namespace Provider
[70DB0000] C:\Windows\System32\winrnr.dll
           6.1.7600.16385 - 6.1.7600.16385 (win7_rtm.090713-1255)
           LDAP RnR Provider DLL
[70DD0000] C:\Windows\system32\wshbth.dll
           6.1.7601.17514 - 6.1.7601.17514 (win7sp1_rtm.101119-1850)
           Windows Sockets Helper DLL
[70DE0000] C:\Windows\system32\pnrpnsp.dll
           6.1.7600.16385 - 6.1.7600.16385 (win7_rtm.090713-1255)
           PNRP Name Space Provider
[70F20000] C:\Windows\system32\napinsp.dll
           6.1.7600.16385 - 6.1.7600.16385 (win7_rtm.090713-1255)
           E-mail Naming Shim Provider
[70F60000] C:\Windows\system32\winspool.drv
           6.1.7601.17514 - 6.1.7600.16385 (win7_rtm.090713-1255)
           Windows Spooler Driver
[72A10000] C:\Windows\System32\fwpuclnt.dll
           6.1.7601.17514 - 6.1.7600.16385 (win7_rtm.090713-1255)
           FWP/IPsec User-Mode API
[72B80000] C:\Windows\system32\OLEACC.dll
           7.0.0.0 - 7.0.0.0 (win7sp1_gdr.110826-1504)
           Active Accessibility Core Component
[731B0000] C:\Windows\system32\WINNSI.DLL
           6.1.7600.16385 - 6.1.7600.16385 (win7_rtm.090713-1255)
           Network Store Information RPC interface
[731C0000] C:\Windows\system32\Iphlpapi.DLL
           6.1.7601.17514 - 6.1.7600.16385 (win7_rtm.090713-1255)
           IP Helper API
[731E0000] C:\Windows\system32\midimap.dll
           6.1.7600.16385 - 6.1.7600.16385 (win7_rtm.090713-1255)
           Microsoft MIDI Mapper
[731F0000] C:\Windows\system32\wsock32.dll
           6.1.7600.16385 - 6.1.7600.16385 (win7_rtm.090713-1255)
           Windows Socket 32-Bit DLL
[73200000] C:\Windows\system32\MSACM32.dll
           6.1.7600.16385 - 6.1.7600.16385 (win7_rtm.090713-1255)
           Microsoft ACM Audio Filter
[73230000] C:\Windows\system32\msacm32.drv
           6.1.7600.16385 - 6.1.7600.16385 (win7_rtm.090713-1255)
           Microsoft Sound Mapper
[73240000] C:\Windows\system32\AUDIOSES.DLL
           6.1.7601.17514 - 6.1.7600.16385 (win7_rtm.090713-1255)
           Audio Session
[733E0000] C:\Windows\system32\ksuser.dll
           6.1.7600.16385 - 6.1.7600.16385 (win7_rtm.090713-1255)
           User CSA Library
[73410000] C:\Windows\system32\wdmaud.drv
           6.1.7601.17514 - 6.1.7600.16385 (win7_rtm.090713-1255)
           Winmm  audio system driver
[734C0000] C:\Windows\system32\ATL.DLL
           3.5.2284.0 - 3.05.2284
           ATL Module for Windows XP (Unicode)
[73530000] C:\Windows\system32\winmm.dll
           6.1.7601.17514 - 6.1.7600.16385 (win7_rtm.090713-1255)
           MCI API DLL
[735E0000] C:\Windows\system32\NLAapi.dll
           6.1.7601.17514 - 6.1.7601.17514 (win7sp1_rtm.101119-1850)
           Network Location Awareness 2
[73750000] C:\Windows\system32\dwmapi.dll
           6.1.7600.16385 - 6.1.7600.16385 (win7_rtm.090713-1255)
           Microsoft Desktop Window Manager API
[73770000] C:\Windows\system32\HID.dll
           6.1.7600.16385 - 6.1.7600.16385 (win7_rtm.090713-1255)
           Hid User Library
[737C0000] C:\Windows\system32\DUser.dll
           6.1.7600.16385 - 6.1.7600.16385 (win7_rtm.090713-1255)
           Windows DirectUser Engine
[738B0000] C:\Windows\system32\MMDevAPI.DLL
           6.1.7601.17514 - 6.1.7600.16385 (win7_rtm.090713-1255)
           MMDevice API
[738F0000] C:\Windows\system32\AVRT.dll
           6.1.7600.16385 - 6.1.7600.16385 (win7_rtm.090713-1255)
           Multimedia Realtime Runtime
[73C40000] C:\Windows\system32\uxtheme.dll
           6.1.7600.16385 - 6.1.7600.16385 (win7_rtm.090713-1255)
           Microsoft UxTheme Library
[73C80000] C:\Windows\system32\PROPSYS.dll
           7.0.7601.17514 - 7.00.7600.16385 (win7_rtm.090713-1255)
           Microsoft Property System
[73E00000]
C:\Windows\WinSxS\x86_microsoft.windows.common-controls_6595b64144ccf1df_6.0
.7601.17514_none_41e6975e2bd6f2b2\comctl32.dll
           6.10.7601.17514 - 6.10 (win7_rtm.090713-1255)
           User Experience Controls Library
[74350000] C:\Windows\system32\ntmarta.dll
           6.1.7600.16385 - 6.1.7600.16385 (win7_rtm.090713-1255)
           Windows NT MARTA provider
[74400000] C:\Windows\System32\wshtcpip.dll
           6.1.7600.16385 - 6.1.7600.16385 (win7_rtm.090713-1255)
           Winsock2 Helper DLL (TL/IPv4)
[744C0000] C:\Windows\system32\USERENV.dll
           6.1.7601.17514 - 6.1.7600.16385 (win7_rtm.090713-1255)
           Userenv
[747E0000] C:\Windows\system32\DNSAPI.dll
           6.1.7601.17570 - 6.1.7600.16385 (win7_rtm.090713-1255)
           DNS Client API DLL
[748D0000] C:\Windows\system32\version.dll
           6.1.7600.16385 - 6.1.7600.16385 (win7_rtm.090713-1255)
           Version Checking and File Installation Libraries
[74930000] C:\Windows\System32\mswsock.dll
           6.1.7601.17514 - 6.1.7600.16385 (win7_rtm.090713-1255)
           Microsoft Windows Sockets 2.0 Service Provider
[74E50000] C:\Windows\system32\CRYPTBASE.dll
           6.1.7600.16385 - 6.1.7600.16385 (win7_rtm.090713-1255)
           Base cryptographic API DLL
[74EA0000] C:\Windows\system32\profapi.dll
           6.1.7600.16385 - 6.1.7600.16385 (win7_rtm.090713-1255)
           User Profile Basic API
[74F10000] C:\Program Files\Alwil Software\Avast5\snxhk.dll
           7.0.1426.0 - 7.0.1426.0
           avast! snxhk
[74FB0000] C:\Windows\system32\MSASN1.dll
           6.1.7601.17514 - 6.1.7601.17514 (win7sp1_rtm.101119-1850)
           ASN.1 Runtime APIs
[74FC0000] C:\Windows\system32\CRYPT32.dll
           6.1.7601.17514 - 6.1.7600.16385 (win7_rtm.090713-1255)
           Crypto API32
[750E0000] C:\Windows\system32\KERNELBASE.dll
           6.1.7601.17651 - 6.1.7600.16385 (win7_rtm.090713-1255)
           Windows NT BASE API Client DLL
[75130000] C:\Windows\system32\DEVOBJ.dll
           6.1.7600.16385 - 6.1.7600.16385 (win7_rtm.090713-1255)
           Device Information Set DLL
[751E0000] C:\Windows\system32\CFGMGR32.dll
           6.1.7601.17514 - 6.1.7601.17514 (win7sp1_rtm.101119-1850)
           Configuration Manager DLL
[75210000] C:\Windows\system32\WINTRUST.dll
           6.1.7601.17787 - 6.1.7601.17787 (win7sp1_gdr.120229-1502)
           Microsoft Trust Verification APIs
[75240000] C:\Windows\system32\RPCRT4.dll
           6.1.7601.17514 - 6.1.7600.16385 (win7_rtm.090713-1255)
           Remote Procedure Call Runtime
[752F0000] C:\Windows\SYSTEM32\sechost.dll
           6.1.7600.16385 - 6.1.7600.16385 (win7_rtm.090713-1255)
           Host for SCM/SDDL/LSA Lookup APIs
[75370000] C:\Windows\system32\NSI.dll
           6.1.7600.16385 - 6.1.7600.16385 (win7_rtm.090713-1255)
           NSI User-mode interface DLL
[75380000] C:\Windows\system32\ole32.dll
           6.1.7601.17514 - 6.1.7600.16385 (win7_rtm.090713-1255)
           Microsoft OLE for Windows
[754E0000] C:\Windows\system32\user32.dll
           6.1.7601.17514 - 6.1.7601.17514 (win7sp1_rtm.101119-1850)
           Multi-User Windows USER API Client DLL
[755B0000] C:\Windows\system32\comdlg32.dll
           6.1.7601.17514 - 6.1.7600.16385 (win7_rtm.090713-1255)
           Common Dialogs DLL
[75630000] C:\Windows\system32\LPK.dll
           6.1.7600.16385 - 6.1.7600.16385 (win7_rtm.090713-1255)
           Language Pack
[75640000] C:\Windows\system32\GDI32.dll
           6.1.7601.17514 - 6.1.7601.17514 (win7sp1_rtm.101119-1850)
           GDI Client DLL
[756C0000] C:\Windows\system32\shell32.dll
           6.1.7601.17755 - 6.1.7601.17514 (win7sp1_rtm.101119-1850)
           Windows Shell Common Dll
[76310000] C:\Windows\system32\MSCTF.dll
           6.1.7600.16385 - 6.1.7600.16385 (win7_rtm.090713-1255)
           MSCTF Server DLL
[763E0000] C:\Windows\system32\msvcrt.dll
           7.0.7601.17744 - 7.0.7601.17744 (win7sp1_gdr.111215-1535)
           Windows NT CRT DLL
[765C0000] C:\Windows\system32\USP10.dll
           1.626.7601.17514 - 1.0626.7601.17514 (win7sp1_rtm.101119-1850)
           Uniscribe Unicode script processor
[76660000] C:\Windows\system32\SetupApi.dll
           6.1.7601.17514 - 6.1.7600.16385 (win7_rtm.090713-1255)
           Windows Setup API
[76800000] C:\Windows\system32\WS2_32.dll
           6.1.7601.17514 - 6.1.7600.16385 (win7_rtm.090713-1255)
           Windows Socket 2.0 32-Bit DLL
[76840000] C:\Windows\system32\PSAPI.DLL
           6.1.7600.16385 - 6.1.7600.16385 (win7_rtm.090713-1255)
           Process Status Helper
[76850000] C:\Windows\system32\iertutil.dll
           9.0.8112.16443 - 9.00.8112.16443 (WIN7_IE9_GDR.120227-1545)
           Run time utility for Internet Explorer
[76A10000] C:\Windows\system32\advapi32.dll
           6.1.7601.17514 - 6.1.7600.16385 (win7_rtm.090713-1255)
           Advanced Windows 32 Base API
[76AB0000] C:\Windows\system32\CLBCatQ.DLL
           2001.12.8530.16385 - 2001.12.8530.16385 (win7_rtm.090713-1255)
           COM+ Configuration Catalog
[76B40000] C:\Windows\system32\IMM32.DLL
           6.1.7601.17514 - 6.1.7601.17514 (win7sp1_rtm.101119-1850)
           Multi-User Windows IMM32 API Client DLL
[76B60000] C:\Windows\system32\WLDAP32.dll
           6.1.7601.17514 - 6.1.7600.16385 (win7_rtm.090713-1255)
           Win32 LDAP API DLL
[76CD0000] C:\Windows\system32\kernel32.dll
           6.1.7601.17651 - 6.1.7600.16385 (win7_rtm.090713-1255)
           Windows NT BASE API Client DLL
[76DB0000] C:\Windows\SYSTEM32\ntdll.dll
           6.1.7601.17725 - 6.1.7600.16385 (win7_rtm.090713-1255)
           NT Layer DLL
[76EF0000] C:\Windows\system32\oleaut32.dll
           6.1.7601.17676 - 6.1.7601.17676
[76F80000] C:\Windows\system32\SHLWAPI.dll
           6.1.7601.17514 - 6.1.7600.16385 (win7_rtm.090713-1255)
           Shell Light-weight Utility Library
----------------------------------------------------------------------------
econtroller-error.txt (13,405 bytes)

obones

2012-06-11 16:27

administrator   ~0019818

Well, thanks for the attached log, but it does not show any stack information. Are you sure you activated the stack information and that you deployed the map file (or the jdbg, compressed version of it) ?
As it is, this file is not usable.

Melloware

2012-06-11 16:39

reporter   ~0019820

the same user can get it with your HID tester attached above. Is there something I can retrieve from it so I can attach it here?

2012-06-11 17:02

 

HIDTester-bin-jdbg.zip (3,166,070 bytes)

obones

2012-06-11 17:03

administrator   ~0019821

I attached a new version of the tester that uses JclDebug to get a full stack trace, it would be nice if I could see the details when the exception occurs.

Melloware

2012-06-11 17:08

reporter   ~0019823

OK I will get back to you thanks!

Melloware

2012-10-13 17:09

reporter   ~0020262

OK I learned more about this. I have a private USB stick which requires a license to communicate with it.

In TJvHidDevice.CtlCreate if it can't open a device it throws this Exception.

else
   raise EControllerError.CreateRes(@RsEDeviceCannotBeOpened);

However I don't want this to stop processing the rest of the USB devices but this does. So I simply commented out this error and my code goes on its merry way.

Is there some switch that can be added to ignore this error if we don't care?

obones

2012-11-05 10:33

administrator   ~0020295

I have added the OnDeviceCreateError event in revision 13468, it should be sufficient for your needs.

Melloware

2012-11-05 12:30

reporter   ~0020297

Thank you!

yury_a

2012-12-13 15:04

reporter   ~0020309

Hello obones,

we have the same issue on a TabletPC computer and tried your solution with OnDeviceCreateError. It seems to contain a problem. Although the handler is called and Handled is set to True in it, there comes endless loop of errors.

I guess the lines

if Assigned(HidDev) then
begin
  NewList.Add(HidDev);
  Inc(Devn);
end;

should be replaced with

if Assigned(HidDev) then
  NewList.Add(HidDev);
Inc(Devn);

We've tried -- it works.

Thank you!

Melloware

2012-12-27 19:43

reporter   ~0020324

Nice post yury_a. Hopefully this will get incorporated

obones

2013-01-15 14:57

administrator   ~0020334

I went a bit further than that, it should cover other cases as well.
Sorry for the delay.

Issue History

Date Modified Username Field Change
2012-06-02 00:15 Melloware New Issue
2012-06-06 14:59 Melloware File Added: hidtester.zip
2012-06-06 15:02 Melloware Note Added: 0019802
2012-06-06 15:42 obones Status new => acknowledged
2012-06-06 15:52 obones File Added: HIDTester-bin-obones.zip
2012-06-06 15:54 obones Note Added: 0019803
2012-06-06 15:54 obones Note Edited: 0019803
2012-06-06 17:21 Melloware Note Added: 0019804
2012-06-08 15:12 Melloware Note Added: 0019808
2012-06-11 15:45 obones Note Added: 0019816
2012-06-11 15:51 Melloware Note Added: 0019817
2012-06-11 15:52 Melloware File Added: econtroller-error.txt
2012-06-11 16:27 obones Note Added: 0019818
2012-06-11 16:39 Melloware Note Added: 0019820
2012-06-11 17:02 obones File Added: HIDTester-bin-jdbg.zip
2012-06-11 17:03 obones Note Added: 0019821
2012-06-11 17:08 Melloware Note Added: 0019823
2012-10-13 17:09 Melloware Note Added: 0020262
2012-11-05 10:34 obones Note Added: 0020295
2012-11-05 12:30 Melloware Note Added: 0020297
2012-12-13 15:04 yury_a Note Added: 0020309
2012-12-27 19:43 Melloware Note Added: 0020324
2013-01-15 14:57 obones Note Added: 0020334
2013-01-15 14:57 obones Status acknowledged => resolved
2013-01-15 14:57 obones Fixed in Version => Daily / SVN
2013-01-15 14:57 obones Resolution open => fixed
2013-01-15 14:57 obones Assigned To => obones
2013-12-13 14:37 obones Relationship added related to 0006168
2015-09-21 17:47 obones Fixed in Version Daily / GIT => 3.49