Disabling/enabling the USB slave interface dynamically

79 views
Skip to first unread message

Jon Lundstrom

unread,
Apr 25, 2018, 5:25:37 AM4/25/18
to BeagleBoard
I share files created on the BBB with a USB host (e.g. Windows PC) using the USB mass storage device (almost like a digital camera). It works fine except for one point: Whenever a new file is created by BBB, I need to unplug-reinsert the USB cable in order for the file to become visible in the host (master).

It would be nice if I could have my BBB-application to "unplug" the USB whenever it creates new files, and then reenable it again, forcing the host to update its file info.

But how do I do that? Is it possible to easily disable/enable the slave USB interface on the go? Or even better, only the mass storage device, leaving the other USB functions running.

Googling the issue I find a lot of solutions on how to disable it permanently, editing the am335x_evm.sh, but that's not what I want.

I'm running a recent Debian Stretch from the BBB distribution web page.

Dennis Lee Bieber

unread,
Apr 25, 2018, 8:49:36 AM4/25/18
to beagl...@googlegroups.com
On Wed, 25 Apr 2018 02:25:37 -0700 (PDT), Jon Lundstrom
<j.b.lu...@gmail.com> declaimed the
following:

>I share files created on the BBB with a USB host (e.g. Windows PC) using
>the USB mass storage device (almost like a digital camera). It works fine
>except for one point: Whenever a new file is created by BBB, I need to
>unplug-reinsert the USB cable in order for the file to become visible in
>the host (master).

Just out of curiosity -- have you tried a <right-click>Refresh in the
Windows FileExplorer that is opened on the "USB mass storage".


--
Wulfraed Dennis Lee Bieber AF6VN
wlf...@ix.netcom.com HTTP://wlfraed.home.netcom.com/

Jon Lundstrom

unread,
Apr 26, 2018, 3:09:57 AM4/26/18
to beagl...@googlegroups.com
Yes,

But I haven't found the refresh option. Double-checking right now on Windows7 and Kubuntu... nope, no refresh available. However, I tried <F5>, but with no effect. I tried Windows10 before writing my question and no success there either.

Unplugging/reinserting the USB cable was the only remedy.
It would be nice if I could do that from the SW that adds the files to the gadget.



--
For more options, visit http://beagleboard.org/discuss
---
You received this message because you are subscribed to a topic in the Google Groups "BeagleBoard" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/beagleboard/ppkuhZB0Z0M/unsubscribe.
To unsubscribe from this group and all its topics, send an email to beagleboard+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/beagleboard/dft0ed9qt6kdq2jgq7aums02guboro78qt%404ax.com.
For more options, visit https://groups.google.com/d/optout.

Jon Lundstrom

unread,
Apr 26, 2018, 4:43:15 AM4/26/18
to beagl...@googlegroups.com
Yes,

But I haven't found the refresh option. Double-checking right now on Windows7 and Kubuntu... nope, no refresh available. However, I tried <F5>, but with no effect. I tried Windows10 before writing my question and no success there either.

Unplugging/reinserting the USB cable was the only remedy.
It would be nice if I could do that from the SW that adds the files to the gadget.


2018-04-25 14:49 GMT+02:00 Dennis Lee Bieber <wlf...@ix.netcom.com>:
--
For more options, visit http://beagleboard.org/discuss
---
You received this message because you are subscribed to a topic in the Google Groups "BeagleBoard" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/beagleboard/ppkuhZB0Z0M/unsubscribe.
To unsubscribe from this group and all its topics, send an email to beagleboard+unsubscribe@googlegroups.com.

Mala Dies

unread,
May 13, 2018, 9:42:17 PM5/13/18
to BeagleBoard
Hello,

Are you using software to perform this action or a shell script?

Seth

P.S. I found that there are particular software, WinSCP, that transfers files from bbb to host easily and vice versa. This may be something to look into. 
To unsubscribe from this group and all its topics, send an email to beagleboard...@googlegroups.com.

Jon Lundstrom

unread,
May 16, 2018, 4:24:51 AM5/16/18
to BeagleBoard


I'm using my c-program that creates files. It uses the the USB-mass storage device that comes with the BBB which is created by /opt/scripts/boot/am335x_evm.sh (so, in that sense, you could say I use a script).
I've mounted the disc-image-file it uses, so my application simply writes its files to that device, for the host PC to copy.

The BBB with my application is a measuring device which produces result files (in the same way as a digital camera).
It would nice to be able to upload these files to a PC via USB.

Scp could be a solution but I don't have control over the host PC, in the sence that I don't want to install programs on it. The PC usually belongs to somebody else. Simply put, I want to the ability to connect to any PC, have my application to create files on the BBB and then letting the owner of the PC to upload them to his domain.

Another solution is to unplug-reinsert the cable after every measurement. That's where I stand today  ...but it's not pretty.
I feel I'm so close: I only need my application to toggle the USB device off/on, so the host will behave as if it was unplugged/reinserted, and update its file info.

But I don't know how. I have difficulties understanding the am335x_evm-script and it seems to be run once, at startup. Isn't there an easy way of turning the USB-mass- storage-device on and off from an application?

Yes, I have been thinking of buying a mechanical relay, controlled by a gpio, to unplug the cable from my application. That would probably do the job, but it feels awkward.

Mala Dies

unread,
May 16, 2018, 5:10:13 AM5/16/18
to BeagleBoard
Hello,

I was incorrect on what you were attempting to do w/ your idea and set up. Maybe setting a reset pin would help. For instance, I use a Cape called the Motor Bridge Cape. Primarily, I use this Cape for testing and fun. I have created a mower that runs in angles until it is done but on this MotorBridge.py library, the idea is that it resets a pin. 

I thought using a reset pin may work. Do you think there is a way to use the USB as a reset pin? 

Just for kicks, I am replying, e.g. as your method of using the BBB is out of my scope. I am sorry.

Seth

P.S. If you get bored and you think I am on to something, do not hesitate to reply. If not, I understand. 
Reply all
Reply to author
Forward
0 new messages