ataradov / edbg

Simple utility for programming MCUs and FPGAs though CMSIS-DAP protocol. Works on Linux, MAC and Windows.
BSD 3-Clause "New" or "Revised" License
283 stars 93 forks source link

Can't list devices on Ubuntu 20.04 #136

Closed strawberryhacker closed 8 months ago

strawberryhacker commented 8 months ago

Hi,

I am using a fresh install of Ubuntu 20.04 with libudev-dev installed.

Running edbg -l does not detect any programmers.

Trying with sudo result in Error: ioctl(CONTROL): -1.

I replaced the following line with if (res < 0) return 0;: https://github.com/ataradov/edbg/blob/c983cef053f4e64f5c8311dba541b35fa9af0d47/dbg_lin.c#L46

Now it worked running the command as sudo.

I have no idea why it happens, or if it is a real issue.

ataradov commented 8 months ago

I will try to replicate this. What debugger was used?

As far as sudo part goes - did the same debugger work on the old version (before CMSIS-DAP v2 support) without sudo?

ataradov commented 8 months ago

Also, does it fail the same way with sudo if debugger is not plugged in?

I think this may be due to some other device failing to send the string descriptor.

ataradov commented 8 months ago

After looking at it for a bit, I guess there is no real reason to fail if device does not return a string descriptor. Empty string would do just fine. If it ends up being a string that matters for device identification, then it will be filtered out anyway. But bad devices will not stop the enumeration process.

I've made that change.

strawberryhacker commented 8 months ago

Sorry the late response. Nice. Now it worked using sudo. All debuggers showed up. Thank you :-)