Real Software Forums

The forum for Real Studio and other Real Software products.
[ REAL Software Website | Board Index ]
It is currently Tue Oct 24, 2017 2:33 am
xojo

All times are UTC - 5 hours




Post new topic Reply to topic  [ 11 posts ] 
Author Message
 Post subject: MBS USB Plugin
PostPosted: Thu Mar 01, 2012 1:59 pm 
Offline

Joined: Fri Jun 05, 2009 4:54 pm
Posts: 484
Location: London, England
Hi,
I am looking to make a small app which will monitor for any usb drives being inserted into a PC or Mac, and then automatically eject / unmount them.
Does anyone know if the MonkeyBread Software USB Plugin would help me achieve this, and if so, how?

Thank you all in advance.

_________________
RealStudio Professional Edition 2012 r2
Developing on OS X 10.8 (Mountain Lion)
Deploying on Windows XP / Vista / 7 / 8


Top
 Profile  
Reply with quote  
 Post subject: Re: MBS USB Plugin
PostPosted: Fri Mar 02, 2012 5:10 pm 
Offline
User avatar

Joined: Wed May 10, 2006 2:42 pm
Posts: 2985
Location: Germany
Please Check WinUSBNotificationMBS and MacUSBNotificationMBS classes in our plugins.

Greetings
Christian

_________________
See you in Orlando, Florida for Real World 2013
More details and registration here:
http://www.realsoftware.com/community/realworld.php


Top
 Profile  
Reply with quote  
 Post subject: Re: MBS USB Plugin
PostPosted: Fri Mar 02, 2012 7:32 pm 
Offline

Joined: Fri Jun 05, 2009 4:54 pm
Posts: 484
Location: London, England
Hi Christian,
I did, but as a beginner I can not quite understand if your plugin is suitable.

I simply want my app to automatically unmount any USB drive as soon as it is inserted / detected.

_________________
RealStudio Professional Edition 2012 r2
Developing on OS X 10.8 (Mountain Lion)
Deploying on Windows XP / Vista / 7 / 8


Top
 Profile  
Reply with quote  
 Post subject: Re: MBS USB Plugin
PostPosted: Sat Mar 03, 2012 4:02 am 
Offline
User avatar

Joined: Wed May 10, 2006 2:42 pm
Posts: 2985
Location: Germany
Well, the task you ask for is based on several smaller tasks.

Those plugin classes help you to get event when you an USB device is connected.
Next step is to get drive letter from the USB device. See here: https://www.mbsplugins.de/archive/2012- ... er_for_an_

Third is to eject it where we have WindowsEjectVolumeMBS function in our plugins.

Greetings
Christian

_________________
See you in Orlando, Florida for Real World 2013
More details and registration here:
http://www.realsoftware.com/community/realworld.php


Top
 Profile  
Reply with quote  
 Post subject: Re: MBS USB Plugin
PostPosted: Sat Mar 03, 2012 6:24 am 
Offline

Joined: Fri Jun 05, 2009 4:54 pm
Posts: 484
Location: London, England
Thanks,
I guess I will give up on this idea, as I did not understand one word of the link that you provided :)

I thought it would be relatively simple to detect any inserted drive and then unmount it, but for a part time newbie like me, I have no chance of achieving it.

Thank you anyway for trying to help.

_________________
RealStudio Professional Edition 2012 r2
Developing on OS X 10.8 (Mountain Lion)
Deploying on Windows XP / Vista / 7 / 8


Top
 Profile  
Reply with quote  
 Post subject: Re: MBS USB Plugin
PostPosted: Sat Mar 03, 2012 6:52 am 
Offline
User avatar

Joined: Wed May 10, 2006 2:42 pm
Posts: 2985
Location: Germany
how about a timer which simply checks volumecount every few seconds?

Greetings
Christian

_________________
See you in Orlando, Florida for Real World 2013
More details and registration here:
http://www.realsoftware.com/community/realworld.php


Top
 Profile  
Reply with quote  
 Post subject: Re: MBS USB Plugin
PostPosted: Sat Mar 03, 2012 7:22 am 
Offline

Joined: Fri Jun 05, 2009 4:54 pm
Posts: 484
Location: London, England
Ok,
Please tell me if I have understood this correctly:

Your plugin can easily count the number of USB drives on a user's PC, then, I simply say - if number of drives = number of drives plus 1, then unmount (or code to that effect :)

_________________
RealStudio Professional Edition 2012 r2
Developing on OS X 10.8 (Mountain Lion)
Deploying on Windows XP / Vista / 7 / 8


Top
 Profile  
Reply with quote  
 Post subject: Re: MBS USB Plugin
PostPosted: Sat Mar 03, 2012 7:25 am 
Offline
User avatar

Joined: Wed May 10, 2006 2:42 pm
Posts: 2985
Location: Germany
Well, the easiest way could be to keep an eye on volume count with a timer and check with the volume() function. You have a list of drive letters and every few seconds, you check if there is a new drive letter. If you find one, call unmount function with that drive letter.

My USB classes could help making sure you only unmount USB drives.

Greetings
Christian

_________________
See you in Orlando, Florida for Real World 2013
More details and registration here:
http://www.realsoftware.com/community/realworld.php


Top
 Profile  
Reply with quote  
 Post subject: Re: MBS USB Plugin
PostPosted: Sat Mar 03, 2012 7:42 am 
Offline

Joined: Fri Jun 05, 2009 4:54 pm
Posts: 484
Location: London, England
Definitely thinking of buying your plugin now :)

I also see on your website you have an example project called "List Windows USB Devices.rbp".

This seems to list all USB devices on a Windows PC in a listbox.
I am guessing I could then use a timer which checks to see if the listbox count has increased and then unmount the additional drive?

_________________
RealStudio Professional Edition 2012 r2
Developing on OS X 10.8 (Mountain Lion)
Deploying on Windows XP / Vista / 7 / 8


Top
 Profile  
Reply with quote  
 Post subject: Re: MBS USB Plugin
PostPosted: Sat Mar 03, 2012 7:46 am 
Offline
User avatar

Joined: Wed May 10, 2006 2:42 pm
Posts: 2985
Location: Germany
Well, there are several ways to do this.
So good luck!

Especially check this blog article on how to get from device ID to drive letter.

Greetings
Christian

_________________
See you in Orlando, Florida for Real World 2013
More details and registration here:
http://www.realsoftware.com/community/realworld.php


Top
 Profile  
Reply with quote  
 Post subject: Re: MBS USB Plugin
PostPosted: Tue Oct 30, 2012 11:40 am 
Offline

Joined: Thu May 13, 2010 7:27 pm
Posts: 341
On Macs you need to Eject first and then remove the USB device.
Just pulling out the USB drive is bad and could result in data loss.

On Windows the same is true. If you remove the drive while File IO is happening you will get a Delayed Write failed message in Windows.

All this doesn't matter if you are making a hardware USB device with an Eject Button.


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 11 posts ] 

All times are UTC - 5 hours


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group