linux-usb-gadgets / libusbgx

C library encapsulating the Linux kernel USB gadget configfs userspace API functionality
GNU General Public License v2.0
216 stars 72 forks source link

Questionable usage of DEFAULT_UDC in examples #90

Closed wbehrens-on-gh closed 4 months ago

wbehrens-on-gh commented 4 months ago

DEFAULT_UDC is defined to NULL here https://github.com/linux-usb-gadgets/libusbgx/blob/a5bfa81017a9b2064bc449cf74f5f9d106445f62/include/usbg/usbg.h#L50

and is used in all the examples when calling usbg_enable_gadget(). This function will perform a NULL check on the udc though causing it to always fail when using DEFAULT_UDC (like in the examples

https://github.com/linux-usb-gadgets/libusbgx/blob/a5bfa81017a9b2064bc449cf74f5f9d106445f62/src/usbg.c#L2553

wbehrens-on-gh commented 4 months ago

Was looking at to much code and missed the obvious line where udc gets set. Why was this reopened?

pabs3 commented 3 months ago

Sorry, I reopened because I didn't see a reason for the closing for the issue, so I assumed it was still relevant and should be kept option until it gets fixed.