Project JEDI - Issue Tracker
Mantis Bugtracker

Viewing Issue Simple Details Jump to Notes ] View Advanced ] Issue History ] Print ]
ID Category Severity Reproducibility Date Submitted Last Update
0005894 [JEDI VCL] 00 JVCL Components major random 2012-06-02 00:15 2015-09-21 17:47
Reporter Melloware View Status public  
Assigned To obones
Priority normal Resolution fixed  
Status resolved   Product Version 3.45
Summary 0005894: HID EControllerError: Device cannot be opened
Description Users 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 [^]

Additional Information
Tags No tags attached.
Attached Files zip file icon hidtester.zip [^] (90,339 bytes) 2012-06-06 14:59
zip file icon HIDTester-bin-obones.zip [^] (2,524,576 bytes) 2012-06-06 15:52
txt file icon econtroller-error.txt [^] (13,405 bytes) 2012-06-11 15:52
zip file icon HIDTester-bin-jdbg.zip [^] (3,166,070 bytes) 2012-06-11 17:02

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

-  Notes
(0019802)
Melloware (reporter)
2012-06-06 15:02

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.
(0019803)
obones (administrator)
2012-06-06 15:54
edited on: 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

(0019804)
Melloware (reporter)
2012-06-06 17:21

I will have some of my users having Tivo Slide issues try this.
(0019808)
Melloware (reporter)
2012-06-08 15:12

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???
(0019816)
obones (administrator)
2012-06-11 15:45

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.
(0019817)
Melloware (reporter)
2012-06-11 15:51

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.
(0019818)
obones (administrator)
2012-06-11 16:27

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.
(0019820)
Melloware (reporter)
2012-06-11 16:39

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?
(0019821)
obones (administrator)
2012-06-11 17:03

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.
(0019823)
Melloware (reporter)
2012-06-11 17:08

OK I will get back to you thanks!
(0020262)
Melloware (reporter)
2012-10-13 17:09

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?
(0020295)
obones (administrator)
2012-11-05 10:33

I have added the OnDeviceCreateError event in revision 13468, it should be sufficient for your needs.
(0020297)
Melloware (reporter)
2012-11-05 12:30

Thank you!
(0020309)
yury_a (reporter)
2012-12-13 15:04

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!
(0020324)
Melloware (reporter)
2012-12-27 19:43

Nice post yury_a. Hopefully this will get incorporated
(0020334)
obones (administrator)
2013-01-15 14:57

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-04 02:08 zoppa Issue Monitored: zoppa
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-13 15:06 yury_a Issue Monitored: yury_a
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


Mantis 1.1.6[^]
Copyright © 2000 - 2008 Mantis Group
Powered by Mantis Bugtracker