Open ple1n opened 2 days ago
@jamesmunns
seems to be some problem with Tx on stm32 and Rx on host. I tried to trace it down to the source but its difficult
a while ago I used a postcard cobs over usb serial which worked. sorry im not familiar with embedded internals
have to fork them to track it down
The TX error = 2 means "Timeout", it's possible that my timeout code here:
Is slightly too aggressive.
Could you please confirm if you are running the firmware in --release
mode? Also, do you know what core frequency you are setting the CPU to? If running in release doesn't work, could you please try increasing the timeout in the snippet above to something bigger, like:
// Calculate an estimated timeout based on the number of frames we need to send
// For now, we use 2ms/frame, rounded UP
let frames = (out.len() + 63) / 64;
- let timeout_ms = frames * 2;
+ let timeout_ms = frames * 50;
And maybe remove this line?
https://github.com/ple1n/meter/blob/163a4cc5ee919843a7c29bd25deb9f5c3827fe6f/device/src/main.rs#L196
I'm not sure why the host client isn't handling this well, but the timeout might be causing the transfer to be reported as "cancelled", causing the server to assume something has gone wrong.
@jamesmunns
no its not timeout problem i have tried some large numbers hardcoded and it simply delays the error.
anyway here i forked all the things
and why should that line be removed. isnt that async command supposed to be long running and only exit when critical errors happen.
the source of error was,
here I printed the err code
so what file is it trying to open, can you tell me where to possibly find the origin of the error
so what file is it trying to open
I don't know. postcard-rpc itself does not try to open any files, I am guessing this error is caused somewhere in nusb, possibly due to the timeout on the embedded side.
I still see "tx error Timeout" errors on your embassy firmware. It's possible (I'm guessing here):
Just to confirm, can you please confirm:
--release
/optimized modeErrno 2 is ENOENT, which std::io::Error will display as No such file or directory
because it assumes it's file IO, but if that is coming from a usbfs ioctl, means either "specified interface or endpoint does not exist or is not enabled" or "URB was synchronously unlinked" (canceled). The latter would be consistent with postcard-rpc cancelling the transfer after a timeout.
Your strace log doesn't show the relevant ioctl calls or errors from submitting or completing transfers though, so it's not fully clear where that error is coming from. If you're submitting transfers and reaching errno_to_transfer_error
I'd expect to see USBDEVFS_SUBMITURB
and USBDEVFS_REAPURB
ioctls in strace, but I'm confused why there's nothing in your strace log beyond claiming the interface.
Can you get the nusb logs? If you have env_logger
, set RUST_LOG=nusb=debug
, maybe something similar with tracing_subscriber
.
➜ e_gui git:(33bc568) ✗ RUST_LOG=trace sudo -E ./target/debug/cli
2024-11-28T09:46:28.940903Z DEBUG nusb::platform::linux_usbfs::enumeration: probe device SysfsPath("/sys/bus/usb/devices/1-9:1.0")
2024-11-28T09:46:28.940950Z DEBUG nusb::platform::linux_usbfs::enumeration: sysfs read "/sys/bus/usb/devices/1-9:1.0/busnum": Err(Os { code: 2, kind: NotFound, message: "No such file or directory" })
2024-11-28T09:46:28.940966Z DEBUG nusb::platform::linux_usbfs::enumeration: failed to probe, skipping: No such file or directory (os error 2)
2024-11-28T09:46:28.940976Z DEBUG nusb::platform::linux_usbfs::enumeration: probe device SysfsPath("/sys/bus/usb/devices/usb5")
2024-11-28T09:46:28.941008Z DEBUG nusb::platform::linux_usbfs::enumeration: sysfs read "/sys/bus/usb/devices/usb5/busnum": Ok("5\n")
2024-11-28T09:46:28.941034Z DEBUG nusb::platform::linux_usbfs::enumeration: sysfs read "/sys/bus/usb/devices/usb5/devnum": Ok("1\n")
2024-11-28T09:46:28.941056Z DEBUG nusb::platform::linux_usbfs::enumeration: sysfs read "/sys/bus/usb/devices/usb5/idVendor": Ok("1d6b\n")
2024-11-28T09:46:28.941081Z DEBUG nusb::platform::linux_usbfs::enumeration: sysfs read "/sys/bus/usb/devices/usb5/idProduct": Ok("0002\n")
2024-11-28T09:46:28.941103Z DEBUG nusb::platform::linux_usbfs::enumeration: sysfs read "/sys/bus/usb/devices/usb5/bcdDevice": Ok("0611\n")
2024-11-28T09:46:28.941124Z DEBUG nusb::platform::linux_usbfs::enumeration: sysfs read "/sys/bus/usb/devices/usb5/bDeviceClass": Ok("09\n")
2024-11-28T09:46:28.941145Z DEBUG nusb::platform::linux_usbfs::enumeration: sysfs read "/sys/bus/usb/devices/usb5/bDeviceSubClass": Ok("00\n")
2024-11-28T09:46:28.941164Z DEBUG nusb::platform::linux_usbfs::enumeration: sysfs read "/sys/bus/usb/devices/usb5/bDeviceProtocol": Ok("01\n")
2024-11-28T09:46:28.941184Z DEBUG nusb::platform::linux_usbfs::enumeration: sysfs read "/sys/bus/usb/devices/usb5/speed": Ok("480\n")
2024-11-28T09:46:28.941204Z DEBUG nusb::platform::linux_usbfs::enumeration: sysfs read "/sys/bus/usb/devices/usb5/manufacturer": Ok("Linux 6.11.7-200.fc40.x86_64 xhci-hcd\n")
2024-11-28T09:46:28.941224Z DEBUG nusb::platform::linux_usbfs::enumeration: sysfs read "/sys/bus/usb/devices/usb5/product": Ok("xHCI Host Controller\n")
2024-11-28T09:46:28.941245Z DEBUG nusb::platform::linux_usbfs::enumeration: sysfs read "/sys/bus/usb/devices/usb5/serial": Ok("0000:07:00.4\n")
2024-11-28T09:46:28.941300Z DEBUG nusb::platform::linux_usbfs::enumeration: sysfs read "/sys/bus/usb/devices/usb5/5-0:1.0/bInterfaceNumber": Ok("00\n")
2024-11-28T09:46:28.941323Z DEBUG nusb::platform::linux_usbfs::enumeration: sysfs read "/sys/bus/usb/devices/usb5/5-0:1.0/bInterfaceClass": Ok("09\n")
2024-11-28T09:46:28.941344Z DEBUG nusb::platform::linux_usbfs::enumeration: sysfs read "/sys/bus/usb/devices/usb5/5-0:1.0/bInterfaceSubClass": Ok("00\n")
2024-11-28T09:46:28.941365Z DEBUG nusb::platform::linux_usbfs::enumeration: sysfs read "/sys/bus/usb/devices/usb5/5-0:1.0/bInterfaceProtocol": Ok("00\n")
2024-11-28T09:46:28.941380Z DEBUG nusb::platform::linux_usbfs::enumeration: sysfs read "/sys/bus/usb/devices/usb5/5-0:1.0/interface": Err(Os { code: 2, kind: NotFound, message: "No such file or directory" })
2024-11-28T09:46:28.941398Z DEBUG nusb::platform::linux_usbfs::enumeration: probe device SysfsPath("/sys/bus/usb/devices/5-1:1.0")
2024-11-28T09:46:28.941417Z DEBUG nusb::platform::linux_usbfs::enumeration: sysfs read "/sys/bus/usb/devices/5-1:1.0/busnum": Err(Os { code: 2, kind: NotFound, message: "No such file or directory" })
2024-11-28T09:46:28.941426Z DEBUG nusb::platform::linux_usbfs::enumeration: failed to probe, skipping: No such file or directory (os error 2)
2024-11-28T09:46:28.941434Z DEBUG nusb::platform::linux_usbfs::enumeration: probe device SysfsPath("/sys/bus/usb/devices/6-0:1.0")
2024-11-28T09:46:28.941451Z DEBUG nusb::platform::linux_usbfs::enumeration: sysfs read "/sys/bus/usb/devices/6-0:1.0/busnum": Err(Os { code: 2, kind: NotFound, message: "No such file or directory" })
2024-11-28T09:46:28.941460Z DEBUG nusb::platform::linux_usbfs::enumeration: failed to probe, skipping: No such file or directory (os error 2)
2024-11-28T09:46:28.941467Z DEBUG nusb::platform::linux_usbfs::enumeration: probe device SysfsPath("/sys/bus/usb/devices/1-9")
2024-11-28T09:46:28.941489Z DEBUG nusb::platform::linux_usbfs::enumeration: sysfs read "/sys/bus/usb/devices/1-9/busnum": Ok("1\n")
2024-11-28T09:46:28.941510Z DEBUG nusb::platform::linux_usbfs::enumeration: sysfs read "/sys/bus/usb/devices/1-9/devnum": Ok("5\n")
2024-11-28T09:46:28.941531Z DEBUG nusb::platform::linux_usbfs::enumeration: sysfs read "/sys/bus/usb/devices/1-9/idVendor": Ok("048d\n")
2024-11-28T09:46:28.941552Z DEBUG nusb::platform::linux_usbfs::enumeration: sysfs read "/sys/bus/usb/devices/1-9/idProduct": Ok("5702\n")
2024-11-28T09:46:28.941573Z DEBUG nusb::platform::linux_usbfs::enumeration: sysfs read "/sys/bus/usb/devices/1-9/bcdDevice": Ok("0001\n")
2024-11-28T09:46:28.941594Z DEBUG nusb::platform::linux_usbfs::enumeration: sysfs read "/sys/bus/usb/devices/1-9/bDeviceClass": Ok("00\n")
2024-11-28T09:46:28.941614Z DEBUG nusb::platform::linux_usbfs::enumeration: sysfs read "/sys/bus/usb/devices/1-9/bDeviceSubClass": Ok("00\n")
2024-11-28T09:46:28.941634Z DEBUG nusb::platform::linux_usbfs::enumeration: sysfs read "/sys/bus/usb/devices/1-9/bDeviceProtocol": Ok("00\n")
2024-11-28T09:46:28.941655Z DEBUG nusb::platform::linux_usbfs::enumeration: sysfs read "/sys/bus/usb/devices/1-9/speed": Ok("12\n")
2024-11-28T09:46:28.941676Z DEBUG nusb::platform::linux_usbfs::enumeration: sysfs read "/sys/bus/usb/devices/1-9/manufacturer": Ok("ITE Tech. Inc.\n")
2024-11-28T09:46:28.941696Z DEBUG nusb::platform::linux_usbfs::enumeration: sysfs read "/sys/bus/usb/devices/1-9/product": Ok("ITE Device\n")
2024-11-28T09:46:28.941711Z DEBUG nusb::platform::linux_usbfs::enumeration: sysfs read "/sys/bus/usb/devices/1-9/serial": Err(Os { code: 2, kind: NotFound, message: "No such file or directory" })
2024-11-28T09:46:28.941758Z DEBUG nusb::platform::linux_usbfs::enumeration: sysfs read "/sys/bus/usb/devices/1-9/1-9:1.0/bInterfaceNumber": Ok("00\n")
2024-11-28T09:46:28.941780Z DEBUG nusb::platform::linux_usbfs::enumeration: sysfs read "/sys/bus/usb/devices/1-9/1-9:1.0/bInterfaceClass": Ok("03\n")
2024-11-28T09:46:28.941802Z DEBUG nusb::platform::linux_usbfs::enumeration: sysfs read "/sys/bus/usb/devices/1-9/1-9:1.0/bInterfaceSubClass": Ok("00\n")
2024-11-28T09:46:28.941823Z DEBUG nusb::platform::linux_usbfs::enumeration: sysfs read "/sys/bus/usb/devices/1-9/1-9:1.0/bInterfaceProtocol": Ok("00\n")
2024-11-28T09:46:28.941840Z DEBUG nusb::platform::linux_usbfs::enumeration: sysfs read "/sys/bus/usb/devices/1-9/1-9:1.0/interface": Err(Os { code: 2, kind: NotFound, message: "No such file or directory" })
2024-11-28T09:46:28.941872Z DEBUG nusb::platform::linux_usbfs::enumeration: probe device SysfsPath("/sys/bus/usb/devices/usb3")
2024-11-28T09:46:28.941899Z DEBUG nusb::platform::linux_usbfs::enumeration: sysfs read "/sys/bus/usb/devices/usb3/busnum": Ok("3\n")
2024-11-28T09:46:28.941921Z DEBUG nusb::platform::linux_usbfs::enumeration: sysfs read "/sys/bus/usb/devices/usb3/devnum": Ok("1\n")
2024-11-28T09:46:28.941941Z DEBUG nusb::platform::linux_usbfs::enumeration: sysfs read "/sys/bus/usb/devices/usb3/idVendor": Ok("1d6b\n")
2024-11-28T09:46:28.941962Z DEBUG nusb::platform::linux_usbfs::enumeration: sysfs read "/sys/bus/usb/devices/usb3/idProduct": Ok("0002\n")
2024-11-28T09:46:28.941982Z DEBUG nusb::platform::linux_usbfs::enumeration: sysfs read "/sys/bus/usb/devices/usb3/bcdDevice": Ok("0611\n")
2024-11-28T09:46:28.942003Z DEBUG nusb::platform::linux_usbfs::enumeration: sysfs read "/sys/bus/usb/devices/usb3/bDeviceClass": Ok("09\n")
2024-11-28T09:46:28.942023Z DEBUG nusb::platform::linux_usbfs::enumeration: sysfs read "/sys/bus/usb/devices/usb3/bDeviceSubClass": Ok("00\n")
2024-11-28T09:46:28.942044Z DEBUG nusb::platform::linux_usbfs::enumeration: sysfs read "/sys/bus/usb/devices/usb3/bDeviceProtocol": Ok("01\n")
2024-11-28T09:46:28.942063Z DEBUG nusb::platform::linux_usbfs::enumeration: sysfs read "/sys/bus/usb/devices/usb3/speed": Ok("480\n")
2024-11-28T09:46:28.942084Z DEBUG nusb::platform::linux_usbfs::enumeration: sysfs read "/sys/bus/usb/devices/usb3/manufacturer": Ok("Linux 6.11.7-200.fc40.x86_64 xhci-hcd\n")
2024-11-28T09:46:28.942106Z DEBUG nusb::platform::linux_usbfs::enumeration: sysfs read "/sys/bus/usb/devices/usb3/product": Ok("xHCI Host Controller\n")
2024-11-28T09:46:28.942126Z DEBUG nusb::platform::linux_usbfs::enumeration: sysfs read "/sys/bus/usb/devices/usb3/serial": Ok("0000:07:00.3\n")
2024-11-28T09:46:28.942173Z DEBUG nusb::platform::linux_usbfs::enumeration: sysfs read "/sys/bus/usb/devices/usb3/3-0:1.0/bInterfaceNumber": Ok("00\n")
2024-11-28T09:46:28.942195Z DEBUG nusb::platform::linux_usbfs::enumeration: sysfs read "/sys/bus/usb/devices/usb3/3-0:1.0/bInterfaceClass": Ok("09\n")
2024-11-28T09:46:28.942216Z DEBUG nusb::platform::linux_usbfs::enumeration: sysfs read "/sys/bus/usb/devices/usb3/3-0:1.0/bInterfaceSubClass": Ok("00\n")
2024-11-28T09:46:28.942236Z DEBUG nusb::platform::linux_usbfs::enumeration: sysfs read "/sys/bus/usb/devices/usb3/3-0:1.0/bInterfaceProtocol": Ok("00\n")
2024-11-28T09:46:28.942252Z DEBUG nusb::platform::linux_usbfs::enumeration: sysfs read "/sys/bus/usb/devices/usb3/3-0:1.0/interface": Err(Os { code: 2, kind: NotFound, message: "No such file or directory" })
2024-11-28T09:46:28.942269Z DEBUG nusb::platform::linux_usbfs::enumeration: probe device SysfsPath("/sys/bus/usb/devices/5-1.3:1.0")
2024-11-28T09:46:28.942296Z DEBUG nusb::platform::linux_usbfs::enumeration: sysfs read "/sys/bus/usb/devices/5-1.3:1.0/busnum": Err(Os { code: 2, kind: NotFound, message: "No such file or directory" })
2024-11-28T09:46:28.942305Z DEBUG nusb::platform::linux_usbfs::enumeration: failed to probe, skipping: No such file or directory (os error 2)
2024-11-28T09:46:28.942312Z DEBUG nusb::platform::linux_usbfs::enumeration: probe device SysfsPath("/sys/bus/usb/devices/1-7")
2024-11-28T09:46:28.942337Z DEBUG nusb::platform::linux_usbfs::enumeration: sysfs read "/sys/bus/usb/devices/1-7/busnum": Ok("1\n")
2024-11-28T09:46:28.942359Z DEBUG nusb::platform::linux_usbfs::enumeration: sysfs read "/sys/bus/usb/devices/1-7/devnum": Ok("3\n")
2024-11-28T09:46:28.942380Z DEBUG nusb::platform::linux_usbfs::enumeration: sysfs read "/sys/bus/usb/devices/1-7/idVendor": Ok("05e3\n")
2024-11-28T09:46:28.942402Z DEBUG nusb::platform::linux_usbfs::enumeration: sysfs read "/sys/bus/usb/devices/1-7/idProduct": Ok("0608\n")
2024-11-28T09:46:28.942423Z DEBUG nusb::platform::linux_usbfs::enumeration: sysfs read "/sys/bus/usb/devices/1-7/bcdDevice": Ok("8536\n")
2024-11-28T09:46:28.942444Z DEBUG nusb::platform::linux_usbfs::enumeration: sysfs read "/sys/bus/usb/devices/1-7/bDeviceClass": Ok("09\n")
2024-11-28T09:46:28.942465Z DEBUG nusb::platform::linux_usbfs::enumeration: sysfs read "/sys/bus/usb/devices/1-7/bDeviceSubClass": Ok("00\n")
2024-11-28T09:46:28.942487Z DEBUG nusb::platform::linux_usbfs::enumeration: sysfs read "/sys/bus/usb/devices/1-7/bDeviceProtocol": Ok("01\n")
2024-11-28T09:46:28.942509Z DEBUG nusb::platform::linux_usbfs::enumeration: sysfs read "/sys/bus/usb/devices/1-7/speed": Ok("480\n")
2024-11-28T09:46:28.942524Z DEBUG nusb::platform::linux_usbfs::enumeration: sysfs read "/sys/bus/usb/devices/1-7/manufacturer": Err(Os { code: 2, kind: NotFound, message: "No such file or directory" })
2024-11-28T09:46:28.942546Z DEBUG nusb::platform::linux_usbfs::enumeration: sysfs read "/sys/bus/usb/devices/1-7/product": Ok("USB2.0 Hub\n")
2024-11-28T09:46:28.942562Z DEBUG nusb::platform::linux_usbfs::enumeration: sysfs read "/sys/bus/usb/devices/1-7/serial": Err(Os { code: 2, kind: NotFound, message: "No such file or directory" })
2024-11-28T09:46:28.942610Z DEBUG nusb::platform::linux_usbfs::enumeration: sysfs read "/sys/bus/usb/devices/1-7/1-7:1.0/bInterfaceNumber": Ok("00\n")
2024-11-28T09:46:28.942632Z DEBUG nusb::platform::linux_usbfs::enumeration: sysfs read "/sys/bus/usb/devices/1-7/1-7:1.0/bInterfaceClass": Ok("09\n")
2024-11-28T09:46:28.942653Z DEBUG nusb::platform::linux_usbfs::enumeration: sysfs read "/sys/bus/usb/devices/1-7/1-7:1.0/bInterfaceSubClass": Ok("00\n")
2024-11-28T09:46:28.942675Z DEBUG nusb::platform::linux_usbfs::enumeration: sysfs read "/sys/bus/usb/devices/1-7/1-7:1.0/bInterfaceProtocol": Ok("00\n")
2024-11-28T09:46:28.942692Z DEBUG nusb::platform::linux_usbfs::enumeration: sysfs read "/sys/bus/usb/devices/1-7/1-7:1.0/interface": Err(Os { code: 2, kind: NotFound, message: "No such file or directory" })
2024-11-28T09:46:28.942706Z DEBUG nusb::platform::linux_usbfs::enumeration: probe device SysfsPath("/sys/bus/usb/devices/usb1")
2024-11-28T09:46:28.942729Z DEBUG nusb::platform::linux_usbfs::enumeration: sysfs read "/sys/bus/usb/devices/usb1/busnum": Ok("1\n")
2024-11-28T09:46:28.942751Z DEBUG nusb::platform::linux_usbfs::enumeration: sysfs read "/sys/bus/usb/devices/usb1/devnum": Ok("1\n")
2024-11-28T09:46:28.942771Z DEBUG nusb::platform::linux_usbfs::enumeration: sysfs read "/sys/bus/usb/devices/usb1/idVendor": Ok("1d6b\n")
2024-11-28T09:46:28.942792Z DEBUG nusb::platform::linux_usbfs::enumeration: sysfs read "/sys/bus/usb/devices/usb1/idProduct": Ok("0002\n")
2024-11-28T09:46:28.942812Z DEBUG nusb::platform::linux_usbfs::enumeration: sysfs read "/sys/bus/usb/devices/usb1/bcdDevice": Ok("0611\n")
2024-11-28T09:46:28.942833Z DEBUG nusb::platform::linux_usbfs::enumeration: sysfs read "/sys/bus/usb/devices/usb1/bDeviceClass": Ok("09\n")
2024-11-28T09:46:28.942862Z DEBUG nusb::platform::linux_usbfs::enumeration: sysfs read "/sys/bus/usb/devices/usb1/bDeviceSubClass": Ok("00\n")
2024-11-28T09:46:28.942887Z DEBUG nusb::platform::linux_usbfs::enumeration: sysfs read "/sys/bus/usb/devices/usb1/bDeviceProtocol": Ok("01\n")
2024-11-28T09:46:28.942907Z DEBUG nusb::platform::linux_usbfs::enumeration: sysfs read "/sys/bus/usb/devices/usb1/speed": Ok("480\n")
2024-11-28T09:46:28.942928Z DEBUG nusb::platform::linux_usbfs::enumeration: sysfs read "/sys/bus/usb/devices/usb1/manufacturer": Ok("Linux 6.11.7-200.fc40.x86_64 xhci-hcd\n")
2024-11-28T09:46:28.942951Z DEBUG nusb::platform::linux_usbfs::enumeration: sysfs read "/sys/bus/usb/devices/usb1/product": Ok("xHCI Host Controller\n")
2024-11-28T09:46:28.942972Z DEBUG nusb::platform::linux_usbfs::enumeration: sysfs read "/sys/bus/usb/devices/usb1/serial": Ok("0000:01:00.0\n")
2024-11-28T09:46:28.943020Z DEBUG nusb::platform::linux_usbfs::enumeration: sysfs read "/sys/bus/usb/devices/usb1/1-0:1.0/bInterfaceNumber": Ok("00\n")
2024-11-28T09:46:28.943042Z DEBUG nusb::platform::linux_usbfs::enumeration: sysfs read "/sys/bus/usb/devices/usb1/1-0:1.0/bInterfaceClass": Ok("09\n")
2024-11-28T09:46:28.943064Z DEBUG nusb::platform::linux_usbfs::enumeration: sysfs read "/sys/bus/usb/devices/usb1/1-0:1.0/bInterfaceSubClass": Ok("00\n")
2024-11-28T09:46:28.943085Z DEBUG nusb::platform::linux_usbfs::enumeration: sysfs read "/sys/bus/usb/devices/usb1/1-0:1.0/bInterfaceProtocol": Ok("00\n")
2024-11-28T09:46:28.943100Z DEBUG nusb::platform::linux_usbfs::enumeration: sysfs read "/sys/bus/usb/devices/usb1/1-0:1.0/interface": Err(Os { code: 2, kind: NotFound, message: "No such file or directory" })
2024-11-28T09:46:28.943115Z DEBUG nusb::platform::linux_usbfs::enumeration: probe device SysfsPath("/sys/bus/usb/devices/1-8:1.1")
2024-11-28T09:46:28.943133Z DEBUG nusb::platform::linux_usbfs::enumeration: sysfs read "/sys/bus/usb/devices/1-8:1.1/busnum": Err(Os { code: 2, kind: NotFound, message: "No such file or directory" })
2024-11-28T09:46:28.943142Z DEBUG nusb::platform::linux_usbfs::enumeration: failed to probe, skipping: No such file or directory (os error 2)
2024-11-28T09:46:28.943150Z DEBUG nusb::platform::linux_usbfs::enumeration: probe device SysfsPath("/sys/bus/usb/devices/1-6:1.0")
2024-11-28T09:46:28.943169Z DEBUG nusb::platform::linux_usbfs::enumeration: sysfs read "/sys/bus/usb/devices/1-6:1.0/busnum": Err(Os { code: 2, kind: NotFound, message: "No such file or directory" })
2024-11-28T09:46:28.943177Z DEBUG nusb::platform::linux_usbfs::enumeration: failed to probe, skipping: No such file or directory (os error 2)
2024-11-28T09:46:28.943184Z DEBUG nusb::platform::linux_usbfs::enumeration: probe device SysfsPath("/sys/bus/usb/devices/3-0:1.0")
2024-11-28T09:46:28.943199Z DEBUG nusb::platform::linux_usbfs::enumeration: sysfs read "/sys/bus/usb/devices/3-0:1.0/busnum": Err(Os { code: 2, kind: NotFound, message: "No such file or directory" })
2024-11-28T09:46:28.943207Z DEBUG nusb::platform::linux_usbfs::enumeration: failed to probe, skipping: No such file or directory (os error 2)
2024-11-28T09:46:28.943214Z DEBUG nusb::platform::linux_usbfs::enumeration: probe device SysfsPath("/sys/bus/usb/devices/5-1.3")
2024-11-28T09:46:28.943240Z DEBUG nusb::platform::linux_usbfs::enumeration: sysfs read "/sys/bus/usb/devices/5-1.3/busnum": Ok("5\n")
2024-11-28T09:46:28.943261Z DEBUG nusb::platform::linux_usbfs::enumeration: sysfs read "/sys/bus/usb/devices/5-1.3/devnum": Ok("50\n")
2024-11-28T09:46:28.943284Z DEBUG nusb::platform::linux_usbfs::enumeration: sysfs read "/sys/bus/usb/devices/5-1.3/idVendor": Ok("b1e1\n")
2024-11-28T09:46:28.943306Z DEBUG nusb::platform::linux_usbfs::enumeration: sysfs read "/sys/bus/usb/devices/5-1.3/idProduct": Ok("0001\n")
2024-11-28T09:46:28.943327Z DEBUG nusb::platform::linux_usbfs::enumeration: sysfs read "/sys/bus/usb/devices/5-1.3/bcdDevice": Ok("0010\n")
2024-11-28T09:46:28.943349Z DEBUG nusb::platform::linux_usbfs::enumeration: sysfs read "/sys/bus/usb/devices/5-1.3/bDeviceClass": Ok("ef\n")
2024-11-28T09:46:28.943371Z DEBUG nusb::platform::linux_usbfs::enumeration: sysfs read "/sys/bus/usb/devices/5-1.3/bDeviceSubClass": Ok("02\n")
2024-11-28T09:46:28.943393Z DEBUG nusb::platform::linux_usbfs::enumeration: sysfs read "/sys/bus/usb/devices/5-1.3/bDeviceProtocol": Ok("01\n")
2024-11-28T09:46:28.943414Z DEBUG nusb::platform::linux_usbfs::enumeration: sysfs read "/sys/bus/usb/devices/5-1.3/speed": Ok("12\n")
2024-11-28T09:46:28.943436Z DEBUG nusb::platform::linux_usbfs::enumeration: sysfs read "/sys/bus/usb/devices/5-1.3/manufacturer": Ok("Plein\n")
2024-11-28T09:46:28.943457Z DEBUG nusb::platform::linux_usbfs::enumeration: sysfs read "/sys/bus/usb/devices/5-1.3/product": Ok("meter\n")
2024-11-28T09:46:28.943472Z DEBUG nusb::platform::linux_usbfs::enumeration: sysfs read "/sys/bus/usb/devices/5-1.3/serial": Err(Os { code: 2, kind: NotFound, message: "No such file or directory" })
2024-11-28T09:46:28.943519Z DEBUG nusb::platform::linux_usbfs::enumeration: sysfs read "/sys/bus/usb/devices/5-1.3/5-1.3:1.0/bInterfaceNumber": Ok("00\n")
2024-11-28T09:46:28.943541Z DEBUG nusb::platform::linux_usbfs::enumeration: sysfs read "/sys/bus/usb/devices/5-1.3/5-1.3:1.0/bInterfaceClass": Ok("ff\n")
2024-11-28T09:46:28.943563Z DEBUG nusb::platform::linux_usbfs::enumeration: sysfs read "/sys/bus/usb/devices/5-1.3/5-1.3:1.0/bInterfaceSubClass": Ok("00\n")
2024-11-28T09:46:28.943585Z DEBUG nusb::platform::linux_usbfs::enumeration: sysfs read "/sys/bus/usb/devices/5-1.3/5-1.3:1.0/bInterfaceProtocol": Ok("00\n")
2024-11-28T09:46:28.943604Z DEBUG nusb::platform::linux_usbfs::enumeration: sysfs read "/sys/bus/usb/devices/5-1.3/5-1.3:1.0/interface": Err(Os { code: 2, kind: NotFound, message: "No such file or directory" })
2024-11-28T09:46:28.943647Z DEBUG nusb::platform::linux_usbfs::enumeration: sysfs read "/sys/bus/usb/devices/5-1.3/bConfigurationValue": Ok("1\n")
2024-11-28T09:46:28.943659Z DEBUG nusb::platform::linux_usbfs::device: Opening usbfs device /dev/bus/usb/005/050
2024-11-28T09:46:28.943774Z DEBUG nusb::platform::linux_usbfs::device: Opened device fd=9 with id 0
2024-11-28T09:46:28.943785Z DEBUG nusb::platform::linux_usbfs::device: Opened device bus=5 addr=50
2024-11-28T09:46:28.943813Z DEBUG nusb::platform::linux_usbfs::device: Claimed interface 0 on device id 0
2024-11-28T09:46:28.943961Z DEBUG nusb::platform::linux_usbfs::device: Submitted URB 0x7f2218000cf0 on ep 1
2024-11-28T09:46:28.943961Z DEBUG nusb::platform::linux_usbfs::device: Failed to submit URB 0x7f22200010e0 on ep 81: No such file or directory (os error 2) Urb { ep_type: 3, endpoint: 129, status: 0, flags: 0, buffer: 0x7f2220000cd0, buffer_length: 1024, actual_length: 0, start_frame: 0, number_of_packets_or_stream_id: 0, error_count: 0, signr: 0, usercontext: 0x7f2220001120 }
2024-11-28T09:46:28.943986Z DEBUG nusb::platform::linux_usbfs::device: Failed to submit URB 0x7f2220001830 on ep 81: No such file or directory (os error 2) Urb { ep_type: 3, endpoint: 129, status: 0, flags: 0, buffer: 0x7f2220001420, buffer_length: 1024, actual_length: 0, start_frame: 0, number_of_packets_or_stream_id: 0, error_count: 0, signr: 0, usercontext: 0x7f22200018a0 }
2024-11-28T09:46:28.943997Z DEBUG nusb::platform::linux_usbfs::device: Failed to submit URB 0x7f2220001d20 on ep 81: No such file or directory (os error 2) Urb { ep_type: 3, endpoint: 129, status: 0, flags: 0, buffer: 0x7f2220001910, buffer_length: 1024, actual_length: 0, start_frame: 0, number_of_packets_or_stream_id: 0, error_count: 0, signr: 0, usercontext: 0x7f2220001d60 }
2024-11-28T09:46:28.944012Z DEBUG nusb::platform::linux_usbfs::device: Failed to submit URB 0x7f22200021e0 on ep 81: No such file or directory (os error 2) Urb { ep_type: 3, endpoint: 129, status: 0, flags: 0, buffer: 0x7f2220001dd0, buffer_length: 1024, actual_length: 0, start_frame: 0, number_of_packets_or_stream_id: 0, error_count: 0, signr: 0, usercontext: 0x7f2220002220 }
errno: No such file or directory (os error 2)
2024-11-28T09:46:28.944032Z ERROR postcard_rpc::host_client::raw_nusb: In Worker error: Cancelled, consecutive: 1
2024-11-28T09:46:28.944028Z DEBUG nusb::platform::linux_usbfs::device: Handling events for device 0
2024-11-28T09:46:28.944040Z ERROR postcard_rpc::host_client::raw_nusb: Giving up after 1 errors in a row, final error: Cancelled
2024-11-28T09:46:28.944047Z ERROR postcard_rpc::host_client::raw_nusb: Fatal Error, exiting
2024-11-28T09:46:28.944047Z DEBUG nusb::platform::linux_usbfs::device: URB 0x7f2218000cf0 for ep 1 completed, status=0 actual_length=11
2024-11-28T09:46:28.944058Z WARN postcard_rpc::host_client::util: in_worker: wire receive error, exiting Transfer(Cancelled)
[src/bin/cli.rs:57:5] &rx = Err(
Closed,
)
2024-11-28T09:46:28.944113Z DEBUG nusb::platform::linux_usbfs::device: Released interface 0 on device 0: Ok(())
2024-11-28T09:46:28.944130Z DEBUG nusb::platform::linux_usbfs::device: Closing device 0
➜ e_gui git:(33bc568) ✗
@kevinmehall
postcard-rpc is trying to submit transfers on endpoint 0x81, which does not exist. In the configuration descriptor extracted from your strace log, the device's endpoints are numbered 0x01 and 0x82.
@jamesmunns i have that branch locally available tag me to test your code if u are interested. im using cobs over serial rn https://github.com/ple1n/egui_cobs
@kevinmehall thanks for that catch! I'm actually pretty confused on how that ends up like that. I'll look into using https://docs.rs/nusb/latest/nusb/struct.Interface.html#method.descriptors to peek through the actual endpoints that are present. We recently added the ability to pick a specific Interface, so I should likely add a similar way of picking a specific endpoint.
Embassy USB numbers endpoints sequentially, though it seems that the RP2040 has a separate list for in/out (so you get 0x01/0x81 - both are the first entry), whereas the embassy-stm32 USB driver counts in a single list, which means you get 0x01 and 0x82 instead.
Postcard-rpc should be more robust about this, or at least allow you to pick your endpoint IDs instead of using hardcoded ones.
USB device controllers have different constraints on what endpoint addresses can be used. Yes, to be compatible across devices, you want to look at the endpoint descriptors under the specified interface instead of hard-coding endpoint addresses.
https://github.com/ple1n/meter/tree/postcard_rpc