-
Notifications
You must be signed in to change notification settings - Fork 304
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CAN-USB device stop working after 10 xmit fails #187
Comments
That doesn't sound good. My gut feeling says the UCAN has a serious problem. Can you add the following patch to the kernel and reproduce the problem? Then we should have some more debug output. diff --git a/drivers/net/can/usb/gs_usb.c b/drivers/net/can/usb/gs_usb.c
index bc86e9b329fd..46d6fa5c630e 100644
--- a/drivers/net/can/usb/gs_usb.c
+++ b/drivers/net/can/usb/gs_usb.c
@@ -752,7 +752,8 @@ static void gs_usb_xmit_callback(struct urb *urb)
struct net_device *netdev = dev->netdev;
if (urb->status)
- netdev_info(netdev, "usb xmit fail %u\n", txc->echo_id);
+ netdev_info(netdev, "error %pe: usb xmit fail %u\n",
+ ERR_PTR(urb->status), txc->echo_id);
}
static netdev_tx_t gs_can_start_xmit(struct sk_buff *skb, You can try to recover with bringing the interface down and up again: ip link set dev can0 down
ip link set dev can0 up This sends USB control messages, maybe these are still properly handled. Otherwise you can try to disable/enable the USB port with something like this (edit: fixed access of disable=$(realpath /sys/class/net/can0/device/../port/disable)
echo 1 > ${disable}
echo 0 > ${disable} |
Also post version information of your firmware build (somwhere in lsusb -v ouput) |
Thank you for reply!
brings can0 down, but it can't go up after that:
ifconfig before and after "down":
Hope it will help. Will fix gs_usb.c print, but it will take some time to reproduce the problem. lsusb -v output:
Can't find
where should I look next? |
yeah, UCAN firmware based on this commit:
|
Thanks.
So, there is no way for me of knowing if:
You will need to try a current firmware build, from this repo, otherwise there's no point in trying to analyze the situation. |
hmm, that strange. It could be that I flashed one UCAN adapter and plugged the other one. Will check it. |
yeah, in my version.h file I see this:
will check, why it's not in iConfiguration |
I think this isn't needed anymore, if interface down, interface up doesn't help, the patch will not bring any new information. |
Sorry, I was dazed and confused and used wrong disable=$(realpath /sys/class/net/can0/device/../port/disable)
echo 1 > ${disable}
echo 0 > ${disable} Or do it step by step: $ realpath /sys/class/net/can0/device/../port/disable
/sys/devices/pci0000:00/0000:00:14.0/usb2/2-0:1.0/usb2-port2/disable
$ echo 1 > /sys/devices/pci0000:00/0000:00:14.0/usb2/2-0:1.0/usb2-port2/disable
$ echo 0 > /sys/devices/pci0000:00/0000:00:14.0/usb2/2-0:1.0/usb2-port2/disable Does this work? |
Hi! disable don't work:
I'm under root
|
The left side of the echo 1 | sudo tee ${disable} |
I accidently broke usb. First sent
and can0 interface disappear from ifconfig list, but device still was in lsusb
and ucan disappear from lsusb too |
What's the Please use |
|
You can try to use https://github.com/mvp/uhubctl. I think it does the same in the background. I however didn't manage to completely power down the USB port on any of my hubs. |
Hi!
Currently can't access to CAN-USB adapter that stuck. It looks like it has old firmware, maybe it's not UCAN at all (probably CANable). But I have seen same problem with UCAN and new firmware, so I will replace it and continue search. Testing anothe adapter. Checked lsusb -v with another my UCAN adapter, and it shows:
fanfact, if run lsusb without sudo, it shows only
Spent some hours debugging adapter to find what's going on. Next time I catch problem, I will try
Is there anyway to send some magic command via USB to CAN-adapter so it's firmware could catch it and reboot? Or Linux machine will not gonna try to reconnect to it until manually re plug adapter? |
Ah yes, I could have mentioned that, sorry. Depending on your udev rules etc sometimes those extra queries need root perms.
|
Now checking this command on working device with new firmware:
changed usb port to the same as on broken one. For just in case:
|
Your kernel is too old, the sysfs
How did you perform this reset? Was it due to unplug/replug? |
yeah, probably. Embedded linux machine:
Will look for the new controller with 6+ kernel. |
hmm, checked with simple Linux PC with GNU/Linux 6.8.0-45-generic x86_64. Disable worked:
but now UCAN is missing in lsusb (and ifconfig list)
How to turn it back? |
Can you add a sleep of 1 second between disabling and enabling? |
give same result. UCAN disapper from lsusb list. |
Works for me, tested with current master branch 4ae1a7c ("usbd_gs_can: add support for GS_USB_BREQ_DATA_BITTIMING and GS_USB_BREQ_BT_CONST_EXT"): ➜ (pts/62) frogger@hardanger:~ (main✗) disable=$(realpath /sys/class/net/can0/device/../port/disable)
➜ (pts/62) frogger@hardanger:~ (main✗) echo 1 | sudo tee ${disable}
1
➜ (pts/62) frogger@hardanger:~ (main✗) echo 0 | sudo tee ${disable}
0
➜ (pts/62) frogger@hardanger:~ (main✗) sudo lsusb -v|grep -C10 candleLight\ USB
bDescriptorType 1
bcdUSB 2.00
bDeviceClass 0 [unknown]
bDeviceSubClass 0 [unknown]
bDeviceProtocol 0
bMaxPacketSize0 64
idVendor 0x1d50 OpenMoko, Inc.
idProduct 0x606f Geschwister Schneider CAN adapter
bcdDevice 0.00
iManufacturer 1 bytewerk
iProduct 2 candleLight USB to CAN adapter
iSerial 3 004500474D4D511820343033
bNumConfigurations 1
Configuration Descriptor:
bLength 9
bDescriptorType 2
wTotalLength 0x0032
bNumInterfaces 2
bConfigurationValue 1
iConfiguration 4 fw_4ae1a7c2ad06_2023-01-19
bmAttributes 0x80
➜ (pts/62) frogger@hardanger:~ (main✗) sudo dmesg
[1408527.009650] usb 2-1.3.3: USB disconnect, device number 22
[1408532.417154] usb 2-1.3.3: new full-speed USB device number 23 using xhci_hcd
[1408532.519010] usb 2-1.3.3: New USB device found, idVendor=1d50, idProduct=606f, bcdDevice= 0.00
[1408532.519021] usb 2-1.3.3: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[1408532.519025] usb 2-1.3.3: Product: candleLight USB to CAN adapter
[1408532.519029] usb 2-1.3.3: Manufacturer: bytewerk
[1408532.519032] usb 2-1.3.3: SerialNumber: 004500474D4D511820343033
[1408532.529302] gs_usb 2-1.3.3:1.0: Configuring for 1 interfaces |
I hope to find the differences. What is your machine kernel version? What CAN-USB-adapter do you use? What CAN-USB-adapter do u recommend to use? Will try to find the same one. |
I've tested on my Lenovo T440s, x86_64, v6.11.7, as well as on a rapi-4 v6.12.9. Both Debian kernels. I'm using the original candlelight HW design: https://shop.linux-automation.com/candlelight-D02-R01-V01-C00-en |
Hi
I have UCAN adapter with candleLight firmware. After some time it stop working - don't read or write CAN messages, and LED is constantly on. I use device for C++ app on linux with socket API. Unplug USB device solve the problem, but I want to know the proper way to handle this without reinserting device. What commands should I send to device to make it work again?
The text was updated successfully, but these errors were encountered: