jreveane Posted May 14, 2014 at 06:59 AM Posted May 14, 2014 at 06:59 AM Hi, I'm accessing Linux brickd running over TCP/IP. I using both the Brickviewer and a small C client. Trying to stop the Linux brickd service, I can observe that the Brickviewer and my C clients get notified properly. However, if I unplug the TKF stack from the USB host port, this is not reflected either on Brickviewer or my small client. Please not that I'm not trying to disconnect the bricklets themselves, which is not supported and I guest could damage the whole stack, and which is already the subject of an other thread, but simply perform a valid USB device unplug. So, should I use a specific API call to get notified by brickd that the USB stack is gone ? Thanks. Quote
photron Posted May 14, 2014 at 08:00 AM Posted May 14, 2014 at 08:00 AM The events of stopping brickd and unplugging a stack from USB is delivered with different callbacks. If you stop brickd, it'll close all open client connections. Your program and brickv will receive a disconnected callback for this event. If you unplug a stack from USB then brickd will send you an enumerate callback with type disconnected for this event. In brickv this event is used to remove the affected Bricks and Bricklets from the devices list. If this is not working in brickv then there might be a problem with USB hot(un)plug detection on your Linux system. You can take a look at the brickd log at /var/log/brickd.log, as brickd logs USB device arrival/removal. Quote
jreveane Posted May 14, 2014 at 07:37 PM Author Posted May 14, 2014 at 07:37 PM Thanks. You might be right, this could be an issue with the host USB stack. I will dig into brickd logs. Thanks. Quote
jreveane Posted May 14, 2014 at 08:06 PM Author Posted May 14, 2014 at 08:06 PM So, I did a quick test and it sounds that brickd does not get notified of the USB unplug event. Running dmesg, I got this line only: [time stamp] musb_stage0_irq 790: unhandled DISCONNECT transition (a_idle) BTW, I'm using a BeagleBone Black running Debian. Thanks. Quote
photron Posted May 16, 2014 at 06:49 PM Posted May 16, 2014 at 06:49 PM brickd is relying on udev events to be notified about USB device arrival/removal. The kernel message sound like the musb driver is not handling the disconnect properly. In the end there is no udev event send for this USB device removal and brickd does not get notified about it. I'm afraid there's not much I can do here. Quote
jreveane Posted May 16, 2014 at 08:38 PM Author Posted May 16, 2014 at 08:38 PM Hi, Thanks for your reply. I get bunch of "Bable Interrupts" with this BBB platform. As soon as this happens, the only way to recover seems to power cycle the BBB. I get better results with the Raspberry Pi for the moment and I will probably give up on the BeagleBone Black then. Things will get simpler (I hope), when the RED brick will be available. Thanks for your help. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.