On Thu, Apr 10, 2014 at 11:24:49PM +0300, Philippe De Swert wrote: > Hi all, > > On first sight it seems that the two things in the subject have > nothing to do with each other, so I will quickly explain why they do > (at least for me). So for some time already I have been working on > usb_moded, which is a small daemon which handles setting up gadget > drivers, so that a device can offer several different levels of > functionality (for this it is also capable of setting up network and > start/stop services over dbus/systemd/upstart when needed) > > Now I would like to add support for the new gadgetfs. And there I > run into two issues. > > 1. It seems that libusbg from Matt Porter seems the library to use. > Is that correct? I saw patches on the mailing list, but they did not > seem to have made it to: https://github.com/libusbg/libusbg > > Is this the correct place, and should patches be sent to the mailing > list here? I also pushed it through a coverity scan already and have > a nice to do list. > > 2. I am playing around on a ATSAM5D36-EK and I tried to use that as > a testing platform. Now the USB udc etc works fine. But there is no > real way to detect the insertion of a cable. Most udc drivers seem > to track vbus but this is not exposed. So I added a vbus attribute > to the base udc, but this only works when a gadget driver is > actually loaded. So as long as a gadget is active I can see the > attribute change. (A possible work-around would be a gadget driver > just to detect vbus, but that is a bit insane) > > What would be the best way to track cable insertion and expose it in > some way? As in this case I cannot short-cut it by using a > power_supply class type of device. And just to be sure I would like > to find a way that would be acceptable upstream. > The usb gadget state has already been exported (see udc-core.c), you only need to call usb_gadget_set_state(gadget, USB_STATE_ATTACHED) at your udc for cable connection. -- Best Regards, Peter Chen -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html