Unblock camera after uncontrolled shutdown

For a vision application in an industrial setting we are using USB3 cameras via CVB. This works as intended however because the PCs aren’t properly shut down by the larger machine (it just cuts the power) and the application has the cameras locked at that time they stay locked when the PCs start up.

As a workaround, deleting the %CVBDATA%\Genicam folder and starting the GenICam Browser application makes the cameras available again but this requires remotely logging in to the PC which is undesirable.

I’ve automated the part of deleting the %CVBDATA%\Genicam folder but after this the camera is discovered with access status NOACCESS which means loading the camera fails (LoadImageFileW using the camera’s access token as found via discovery (DoDiscoverW and DoEntryGetInfoW). Discovery does find the camera but indicates its access status is NOACCESS.

Apparently the GenICam browser application has a means of ‘resetting’ the camera which makes access possible. When I start the GenICam Browser it also creates the %CVBDATA%\Genicam folder and subfolders\files (starting my application and running discovery does not).

Obviously the GenICam browser application does something during it’s initialization which unblocks the camera which my own application does not but I have not been able to find what that is (neither on this forum nor in the sample applications).

Has anyone experienced this problem and found a non-manual way to solve it?

Hi, sorry that you have the Problem. To find the problem a log of the error happening could help us:

https://forum.commonvisionblox.com/t/error-loading-genicam-vin-file-on-ubuntu-16-04-running-in-virtualbox/1076/4?u=parsd

I have a logfile in .json format and zipped it for transport but the forum doesn’t allow me to attach it as i’m a new user.

I can include the error in json format I’m getting in this post but the error itself is not unexpected (access denied while trying to open the device in exclusive mode):

{
        "GroupName": "",
        "LogLevel": "trace",
        "LogLevel [Hex]": "0x10",
        "LogMessage": "GenTL call: IFOpenDevice              << hIface=000001B95E1D49E0 sDeviceID=\"CVUSBTL:DEV14FB00A7ACCB\" iOpenFlags=4[DEVICE_ACCESS_EXCLUSIVE] ",
        "LogPos": "",
        "Module": "USBTL.TLCall",
        "ProcessID": "2720",
        "SenderMsgID": "1779",
        "ServiceMsgID": "95390",
        "SourceMsgID": "25",
        "ThreadID": "6044",
        "Timestamp": "19596171580192569"
    },
    {
        "GroupName": "",
        "LogLevel": "err",
        "LogLevel [Hex]": "0x02",
        "LogMessage": "error in CreateFileA(...) \"AccessHandle\", guid: 000001B95C59E980\n",
        "LogPos": "E:\\J\\workspace\\rivers.UAL.dlo_tags_cvb13.2-AKNOSWTOJBBZQ6UQIYGRCMHJWAQMTW737XZZSGNFKDJN5WTC2EGQ@2\\x64_vc14\\src\\usb\\src\\windows\\usb_impl_open_device.cpp(52)",
        "Module": "UAL.CVUSB::OpenDevice",
        "ProcessID": "2720",
        "SenderMsgID": "1780",
        "ServiceMsgID": "95391",
        "SourceMsgID": "10",
        "ThreadID": "6044",
        "Timestamp": "19596171580192569"
    },
    {
        "GroupName": "",
        "LogLevel": "err",
        "LogLevel [Hex]": "0x02",
        "LogMessage": "An error occured: GC_ERR_ACCESS_DENIED, The device is not currently accessible to the application",
        "LogPos": "",
        "Module": "USBTL.Error",
        "ProcessID": "2720",
        "SenderMsgID": "1781",
        "ServiceMsgID": "95392",
        "SourceMsgID": "26",
        "ThreadID": "6044",
        "Timestamp": "19596171580192569"
    },
    {
        "GroupName": "",
        "LogLevel": "trace",
        "LogLevel [Hex]": "0x10",
        "LogMessage": "... returned -1005[GC_ERR_ACCESS_DENIED]          >> *phDevice=0000000000000000 ",
        "LogPos": "",
        "Module": "USBTL.TLCall",
        "ProcessID": "2720",
        "SenderMsgID": "1782",
        "ServiceMsgID": "95393",
        "SourceMsgID": "27",
        "ThreadID": "6044",
        "Timestamp": "19596171580192569"
    },
    {
        "GroupName": "",
        "LogLevel": "trace",
        "LogLevel [Hex]": "0x10",
        "LogMessage": "Exit TL => cvFactory::CImplSystem::IFOpenDevice returned -1005   <pDevHandle = 0>",
        "LogPos": "",
        "Module": "CVFactory.cvfTL.0",
        "ProcessID": "2720",
        "SenderMsgID": "1783",
        "ServiceMsgID": "95394",
        "SourceMsgID": "68",
        "ThreadID": "6044",
        "Timestamp": "19596171580192569"
    },
    {
        "GroupName": "",
        "LogLevel": "trace",
        "LogLevel [Hex]": "0x10",
        "LogMessage": "Enter TL => cvFactory::CImplSystem::GCGetLastError   <ErrorCode = 0x5c59a740> <pErrText = 0000009A6EF1AF30>  <*iSize = 0x9a6ef1aeb0 -> Val = 0x400>",
        "LogPos": "",
        "Module": "CVFactory.cvfTL.0",
        "ProcessID": "2720",
        "SenderMsgID": "1784",
        "ServiceMsgID": "95395",
        "SourceMsgID": "69",
        "ThreadID": "6044",
        "Timestamp": "19596171580192569"
    },

Hi @Bjorn, you can send the log file to support@stemmer-imaging.com.

We will get back to you next week after Christmas holiday.

Have a Happy New Year!

Hi @Bjorn,

which CVB version are you using? This should be fixed in 13.02.004 and up. The lock file that you are deleting should be created in %CVBDATA%GenICam\CameraGUID when the USB camera is opened and be removed when it is closed. This should prevent multiple accidential opening of the same device.

1 Like

I’m using version 13.02.002; i’ll get the latest version and see if that solves the issue.

I can confirm that upgrading to 13.03.001 solves the issue; it is no longer needed to delete the %CVBDATA%\Genicam folder after an uncontrolled shutdown, the camera can successfully be acquired after a power cycle.

2 Likes

Thank you for the confirmation!