Device could not be started, need to disable/enable manually

New user here. What a fine piece of software, really impressed. Whatever I have thrown at it so far, it has worked.

My server is a RPi3b, my clients are W10, W11 and Ubuntu. Under Windows there is one device that doesn't always behave properly, though. When I attach it, device manager says it could not be started and I have to manually disable and then enable it after which it works flawlessly. This happens on two different computers, one is W10 the other one W11, but again not always. The exact error is:

This device cannot start. (Code 10)

{Device Timeout}
The specified I/O operation on %hs was not completed before the time-out period expired.

My question, do you have any suggestion how to tackle this? Is there a way to do the disable/enable cycle automatically when this device is attached through VirtualHere Client?

Cheers,

Chris

#2

" one device that doesn't always behave properly"


Any hint on what usb device it is ? :)

 

#3

Sure thing, it's a PCAN-USB FD from PEAK, a USB-to-CAN dongle. Some more info:

USB\VID_0C72&PID_0012

There are two events:

Device USB\VID_0C72&PID_0012\2&3b7c36a2&0&1 was configured.

Driver Name: oem5.inf
Class Guid: {c38c9d86-471e-4d6b-9fb6-78dda20e3f70}
Driver Date: 12/14/2016
Driver Version: 4.1.2.16115
Driver Provider: PEAK-System Technik GmbH, Darmstadt, Germany
Driver Section: PkUsbFd.DeviceInstall.NT
Driver Rank: 0xFF0001
Matching Device Id: USB\VID_0C72&PID_0012
Outranked Drivers:
Device Updated: false
Parent Device: USB\ROOT_HUB30\1&2b53a856&0&0

Device USB\VID_0C72&PID_0012\2&3b7c36a2&0&1 had a problem starting.

Driver Name: oem5.inf
Class Guid: {c38c9d86-471e-4d6b-9fb6-78dda20e3f70}
Service: PCAN_USB
Lower Filters:
Upper Filters:
Problem: 0x0
Problem Status: 0xC00000E5

 

#4

It may not like a RESET being sent. Try this

In the virtualhere client right click on the CAN adapter and select Custom Event Handler and paste in exactly this line:

onReset.$VENDOR_ID$.$PRODUCT_ID$=

Unplug/replug the adapter, then try to use the device via virtualhere again

Does that fix it?

#5

After adding the custom event handler in the client and the physical unplug/replug cycle, the first time I did a start using in the virtualhere client it worked. Then I did a stop using/start using and it didn't work, same error. So it doesn't seem to have changed anything.

Edit: It has gotten worse. Now, when I see this error and do the disable/enable in device manager, the device is no longer properly recognized and put into the "Universal Serial Bus controllers" category, I get a "USB device not recognized" pop up in the system The error in device manager:

Windows has stopped this device because it has reported problems. (Code 43)

A request for the USB device descriptor failed.

I have removed the custom event handler and rebooted server and the client computer but the problem has prevailed and I can no longer use the device.

#6

Just to add, what still always works is if I physically unplug and replug the device at the server and then use it from the virtualhere client, it is recognized immediately. But no success using it after reconnect for any reason, not even if I reboot the server.

#7

I dont know, i think you will have to just disable/enable manually. It probably something to do with it running an FPGA to do the CAN handling. The FPGA needs a bitstream to start and maybe its somehow losing that when its initially redirected for some reason.

#8

In order to make it behave as before, I had to go to the server and remove the onReset statement from config.ini. Didn't expect it to be there because I had removed it in the client. IMO this is a bit misleading - in the client when you select "Custom Event Handler" what you enter there is added to the server configuration but when you remove it it is not removed. I can see the problem that for perfect "visibility" the server would have to sync this with all clients and also there may be more than one event and it would need to manage a list so short of that perhaps you want to consider renaming that function to "Add Custom Event Handler" to make it more obvious what it actually does.

I take it there is no event system for the clients so I will likely go ahead and write something separate. I know how to detect new devices but can you tell me how to detect/distinguish whether a device appeared through virtualhere instead of a native port, under Windows?

#9

To remove the Custom Event Handler, right click on the device and select Custom Event Handler... and paste in this line

onReset.$VENDOR_ID$.$PRODUCT_ID$=REMOVE

That will remove it. The Custom Event Handler is usually set once and not removed so i didn't document the  REMOVE argument in the docs. But that can be used to reverse the change.

All USB devices passed by VirtualHere will appear in Device Manager under the VirtualHere Host Controller:

In Windows Device Manager click View->Devices By Connection and look for VirtualHere USB 3 eXtensible Host Controller and the devices that are used by virtualhere are under there.

#10

Thanks, while that command option I am sure will work fine it is very, very (very :-) far from being obvious to the casual user.

My other question was not clear enough, I meant how to detect it programmatically. I noticed that VMware doesn't see and offer to pass-through any devices that are connected through virtualhere so there must be a way to distinguish devices connected physically and virtually. Perhaps you have seen some clever method that is not too involved.

 

#11

I only know how to do it programatically via SetupAPI and cfgmgr32 functions in c. 

I suspect you can use WMI queries in Powershell to do it but im not sure how.

#12

Thanks, I'll look into it.

#13

Now testing this under Linux (Ubuntu x64), I find that again, when I have physically replugged the device, so in cold state I can attach it fine and it works. The kernel says:

[  449.341678] vhci_hcd vhci_hcd.0: pdev(0) rhport(0) sockfd(8)
[  449.341684] vhci_hcd vhci_hcd.0: devid(4) speed(3) speed_str(high-speed)
[  449.341757] vhci_hcd vhci_hcd.0: Device attached
[  449.577018] usb 5-1: new high-speed USB device number 5 using vhci_hcd
[  449.708943] usb 5-1: SetAddress Request (5) to port 0
[  449.765752] usb 5-1: New USB device found, idVendor=0c72, idProduct=0012, bcdDevice= 0.00
[  449.765757] usb 5-1: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[  449.765758] usb 5-1: Product: PCAN-USB FD
[  449.765760] usb 5-1: Manufacturer: PEAK-System Technik GmbH
[  449.776875] peak_usb 5-1:1.0: PEAK-System PCAN-USB FD v1 fw v3.4.3 (1 channels)
[  449.802069] peak_usb 5-1:1.0 can0: attached to PCAN-USB FD channel 0 (device 0)

However, when I get disconnected or do a "stop using", whenever I try to use it again from hot state, I see this:

[  585.583763] vhci_hcd vhci_hcd.0: pdev(0) rhport(0) sockfd(8)
[  585.583767] vhci_hcd vhci_hcd.0: devid(4) speed(3) speed_str(high-speed)
[  585.583811] vhci_hcd vhci_hcd.0: Device attached
[  585.816478] usb 5-1: new high-speed USB device number 6 using vhci_hcd
[  585.952409] usb 5-1: SetAddress Request (6) to port 0
[  586.012701] usb 5-1: New USB device found, idVendor=0c72, idProduct=0012, bcdDevice= 0.00
[  586.012708] usb 5-1: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[  586.012711] usb 5-1: Product: PCAN-USB FD
[  586.012713] usb 5-1: Manufacturer: PEAK-System Technik GmbH
[  586.023159] peak_usb 5-1:1.0: PEAK-System PCAN-USB FD v1 fw v3.4.3 (1 channels)
[  587.064878] vhci_hcd: unlink->seqnum 276
[  587.064881] vhci_hcd: urb->status -104
[  587.064919] peak_usb 5-1:1.0 can0: sending command failure: -110
[  588.089485] vhci_hcd: unlink->seqnum 278
[  588.089492] vhci_hcd: urb->status -104
[  588.090602] peak_usb 5-1:1.0 can0: sending command failure: -110
[  588.122728] peak_usb: probe of 5-1:1.0 failed with error -110

and the device doesn't work. The unlink->seqnum changes but it is always vhci_hcd: urb->status -104. Can you tell me what that value means?

Edit:

On the server, when I connect to the device in cold state, I see this:

[  891.493970] usb 1-1.3: reset high-speed USB device number 6 using dwc_otg

and nothing else. When I do the "stop/start using" on the client, the kernel on the server reports:

[ 1137.441720] usb 1-1.3: reset high-speed USB device number 7 using dwc_otg
[ 1139.004386]
[ 1139.004411] WARN::dwc_otg_hcd_urb_dequeue:639: Timed out waiting for FSM NP transfer to complete on 1
[ 1140.028510]
[ 1140.028534] WARN::dwc_otg_hcd_urb_dequeue:639: Timed out waiting for FSM NP transfer to complete on 4

So some sort of timing issue?

#14

Interesting...

 

"Timed out waiting for FSM NP transfer to complete on..." seems to be a bug in the pi3b+ kernel

Do you have any other pi you can use as the server? Because i suspect it might be kernel related on the pi3b+ specifically

#15

Tried it with an old RPi1 as server that also has an older version of Raspbian and it behaves pretty much the same:

Aug 23 12:09:10 raspberrypi kernel: usb 1-1.3: reset high-speed USB device number 4 using dwc_otg
Aug 23 12:09:10 raspberrypi vhusbdarm[397]: Device 113 [0c72:0012] BOUND to connection 4
Aug 23 12:09:12 raspberrypi kernel:
Aug 23 12:09:12 raspberrypi kernel: WARN::dwc_otg_hcd_urb_dequeue:639: Timed out waiting for FSM NP transfer to complete on 3

So it's not the server but something the client does. The manufacturer of the device walked me through an elaborate procedure to update the firmware and since then it always works fine in Windows with virtualhere. I also tested it with the client running on another RPi and can use/stop using fine without error. The difference to an Ubuntu system is that Raspbian doesn't actually use the PCAN device (no socketCAN support in the kernel) while Ubuntu does and wants to bring up the CAN port as a network device. It is during this initialization from the Linux system where the error occurs.

I'll stop here since for the vast majority of my use cases, this will now work fine. Thank you for your support.