Actions
Bug #5921
opensimtrace2 cardem vs. Linux kernel USB autosuspend
Start date:
02/23/2023
Due date:
% Done:
10%
Spec Reference:
Description
(at least) after the following patch was merged, simtrace2-cardem doesn't work with Linux kernels' USB autosuspend anymore:
commit a5d537973db9359804e82a506057f3dd6d53fab9 Author: Harald Welte <laforge@osmocom.org> Date: Mon Jul 25 19:59:08 2022 +0200 cardem: reset the uC in case of USB disconnect
The problem is that the USB kernel notices the simtrace2 device is not in use (no application using it), which in turn means it will power-down the device after 5s. The device then recognizes this as USB disconnect, and we use that to reset the firmware:
============================================================================= SIMtrace2 firmware 0.8.1.58-773d, BOARD=simtrace, APP=cardem (C) 2010-2019 by Harald Welte, 2018-2019 by Kevin Redon ============================================================================= -I- Chip ID: 0x299b0a60 (Ext 0x00000000) -I- Serial Nr. 44203020-48574336-30303931-32323032 -I- Reset Cause: software reset (processor reset required by the software) -I- USB init... USBD_Init SetAddr(22) -W- Sta 0x888A8 [0] -W- _ -W- Sta 0x888A8 [0] -W- _ -W- Sta 0x888A8 [0] -W- _ SetCfg(1) cfgChanged1 -I- calling configure of all configurations... -I- calling init of config 1... -I- Modem 0: physical SIM -I- 0: Use local/physical SIM -I- entering main loop... -I- USB is now configured -I- Resetting uC on USB disconnect ============================================================================= SIMtrace2 firmware 0.8.1.58-773d, BOARD=simtrace, APP=cardem (C) 2010-2019 by Harald Welte, 2018-2019 by Kevin Redon ============================================================================= -I- Chip ID: 0x299b0a60 (Ext 0x00000000) -I- Serial Nr. 44203020-48574336-30303931-32323032 -I- Reset Cause: software reset (processor reset required by the software) -I- USB init... USBD_Init SetAddr(23) -W- Sta 0x888A8 [0] -W- _ -W- Sta 0x888A8 [0] -W- _ -W- Sta 0x888A8 [0] -W- _ SetCfg(1) cfgChanged1 -I- calling configure of all configurations... -I- calling init of config 1... -I- Modem 0: physical SIM -I- 0: Use local/physical SIM -I- entering main loop... -I- USB is now configured -I- Resetting uC on USB disconnect
This in turn will make the device enumerate and re-enumerate in 5s cycles:
[585591.174222] usb 1-1: new full-speed USB device number 84 using xhci_hcd [585591.330180] usb 1-1: New USB device found, idVendor=1d50, idProduct=60e3, bcdDevice= 0.02 [585591.330216] usb 1-1: New USB device strings: Mfr=1, Product=2, SerialNumber=11 [585591.330231] usb 1-1: Product: SIMtrace 2 [585591.330242] usb 1-1: Manufacturer: sysmocom - s.f.m.c. GmbH [585591.330253] usb 1-1: SerialNumber: 44203020485743363030393132323032 [585594.759881] usb 1-1: USB disconnect, device number 84 [585595.530214] usb 1-1: new full-speed USB device number 85 using xhci_hcd [585595.682690] usb 1-1: New USB device found, idVendor=1d50, idProduct=60e3, bcdDevice= 0.02 [585595.682697] usb 1-1: New USB device strings: Mfr=1, Product=2, SerialNumber=11 [585595.682701] usb 1-1: Product: SIMtrace 2 [585595.682704] usb 1-1: Manufacturer: sysmocom - s.f.m.c. GmbH [585595.682706] usb 1-1: SerialNumber: 44203020485743363030393132323032 [585598.802549] usb 1-1: USB disconnect, device number 85 [585602.158170] usb 1-1: new full-speed USB device number 86 using xhci_hcd [585602.313720] usb 1-1: New USB device found, idVendor=1d50, idProduct=60e3, bcdDevice= 0.02 [585602.313757] usb 1-1: New USB device strings: Mfr=1, Product=2, SerialNumber=11 [585602.313772] usb 1-1: Product: SIMtrace 2 [585602.313784] usb 1-1: Manufacturer: sysmocom - s.f.m.c. GmbH [585602.313795] usb 1-1: SerialNumber: 44203020485743363030393132323032 [585606.602416] usb 1-1: USB disconnect, device number 86
Related issues
Updated by laforge 3 months ago
- Status changed from New to In Progress
- % Done changed from 0 to 10
so the easy work-around is to disable autosuspend by something like
echo 'on' > /sys/bus/usb/devices/usb8/8-1/power/control
which can be made persistent via an udev rule like this
ACTION=="add", SUBSYSTEM=="usb", ATTR{idVendor}=="1d50", ATTR{idProduct}=="60e3", TEST=="power/control", ATTR{power/control}="on"
The proper solution is of course to fix the firmware, but the workaround will buy us some time.
Actions