Page 2 of 2

Re: USB Devices "Eject"

Posted: Fri Mar 11, 2016 12:47 pm
by salass00
Belxjander wrote: This is already part of the trackdisk/scsi device driver specs from older OS versions... Can we reuse that for this USB functionality?
A trackdisk device level "eject" function would solve nothing as it would have the same effect as simply unplugging the USB storage device.

It's the file system which needs to be cleanly dismounted or inhibited if you want to be sure that it is in a sane state when the disk is removed.

The device driver doesn't necessarily know about file systems so it can't do this.

Re: USB Devices "Eject"

Posted: Fri Mar 11, 2016 1:05 pm
by salass00
Daedalus wrote: I've just given it a go, and it doesn't work. Well, it sort of works, but the Dismount permanently dismounts the device, meaning that it won't mount again until you reboot. I tried using Dismount USB0:, which removed the device but even removing the drive and plugging it into a different USB socket wouldn't make it reappear. Doing a Dismount VolumeName: doesn't work, and using Dismount USB0: SOFT means that the drive simply remounts a couple of seconds later, similar to how Diskchange USB0: behaves.

It seems like it might need a custom little tool that disables a device until it's removed, then resets to normal. Anyone got any ideas of a simple way of achieving this?
It's better to use the "USB MassStorage Driver" commodity to dismount auto-mounted USB file systems as it doesn't like if you dismount file systems in another way, like using the C:Dismount command (doing so may cause crashes even IIRC).

Image

Re: USB Devices "Eject"

Posted: Sat Mar 12, 2016 10:36 pm
by Daedalus
@salass00
True, though that method doesn't lend itself to use in a context-sensitive menu.

Re: USB Devices "Eject"

Posted: Sun Mar 13, 2016 3:18 pm
by Belxjander
salass00 wrote:
Daedalus wrote: I've just given it a go, and it doesn't work. Well, it sort of works, but the Dismount permanently dismounts the device, meaning that it won't mount again until you reboot. I tried using Dismount USB0:, which removed the device but even removing the drive and plugging it into a different USB socket wouldn't make it reappear. Doing a Dismount VolumeName: doesn't work, and using Dismount USB0: SOFT means that the drive simply remounts a couple of seconds later, similar to how Diskchange USB0: behaves.

It seems like it might need a custom little tool that disables a device until it's removed, then resets to normal. Anyone got any ideas of a simple way of achieving this?
It's better to use the "USB MassStorage Driver" commodity to dismount auto-mounted USB file systems as it doesn't like if you dismount file systems in another way, like using the C:Dismount command (doing so may cause crashes even IIRC).

Image
Is this accessible by ARexx/Scripting MessagePort?

Access from scripting as a DISMOUNT command given a volume/dosdriver name may solve this request very neatly.

Re: USB Devices "Eject"

Posted: Mon Mar 14, 2016 9:09 pm
by Daedalus
Belxjander wrote:Is this accessible by ARexx/Scripting MessagePort?

Access from scripting as a DISMOUNT command given a volume/dosdriver name may solve this request very neatly.
I've already checked and there's no mention of any scripting or command-line abilities in the brief documentation. Pity, as that would have been ideal for this.

Re: USB Devices "Eject"

Posted: Wed Apr 27, 2016 10:48 am
by Daedalus
@salass00

So, is there any way of finding out what exactly the Dismount function of the Mass Storage commodity is doing? I'm not familiar with the details of USB programming, but if we knew roughly the steps / calls made by the Dismount option, it should be relatively easy to knock together a simple "USBEject" command for use in scripts.

Re: USB Devices "Eject"

Posted: Wed Apr 27, 2016 2:07 pm
by broadblues
So, is there any way of finding out what exactly the Dismount function of the Mass Storage commodity is doing? I'm not familiar with the details of USB programming, but if we knew roughly the steps / calls made by the Dismount option, it should be relatively easy to knock together a simple "USBEject" command for use in scripts.
Really no, don't try and make a hack command to do that, just use the GUI. trying to pull the device out from under usbmassstorage will just cause system instabilty.

CTRL-ALT-M brings it up, dead easy.

I can't honestly remeber the last time I needed to do this on Amiga OS anyway.

Re: USB Devices "Eject"

Posted: Thu Apr 28, 2016 3:57 pm
by Daedalus
I know that, and that's what I use personally when I want to remove a drive after writing to it. But the aim was to be able to right-click and dismount using a context-sensitive menu, which is even easier than calling up a GUI, searching for the device you want to eject and clicking the Dismount button. If the MassStorage GUI had an ARexx port or even relevant command line options it would be trivial, but alas...

Anyway, I wasn't talking about making something "hacky". I was talking about replicating the exact functionality the GUI uses for dismounting, which one would presume isn't hacky and therefore there must be a "correct" way to do it.

Re: USB Devices "Eject"

Posted: Sat Apr 30, 2016 11:11 pm
by xenic
Daedalus wrote:I know that, and that's what I use personally when I want to remove a drive after writing to it. But the aim was to be able to right-click and dismount using a context-sensitive menu, which is even easier than calling up a GUI, searching for the device you want to eject and clicking the Dismount button. If the MassStorage GUI had an ARexx port or even relevant command line options it would be trivial, but alas...

Anyway, I wasn't talking about making something "hacky". I was talking about replicating the exact functionality the GUI uses for dismounting, which one would presume isn't hacky and therefore there must be a "correct" way to do it.
Actually, I tested the USB MassStorage "Dismount" command and it doesn't do anything on my system.

Re: USB Devices "Eject"

Posted: Sun May 01, 2016 3:29 pm
by Daedalus
xenic wrote:Actually, I tested the USB MassStorage "Dismount" command and it doesn't do anything on my system.
That's strange, maybe something on your system is holding a lock on whatever drive you're testing with because on my system it removes the drive from the device list. With some further testing I've found that the Dismount function of the GUI does exactly the same thing as the Dismount DOS command: it simply calls dos.library DismountDevice() with the relevant device. This also means the same limitation exists there - once a device is dismounted, disconnecting and reconnecting the device won't make the volume show up again without manually mounting it. So the mass storage GUI isn't a good reference for simple "eject" functionality after all.

Slightly worrying perhaps, is that while the USB drive is still attached, the Mount function of the GUI can me used to remount the drive as expected, but if the drive is removed and then reconnected, it shows up as dismounted in the GUI, but clicking on Mount crashes my entire system. So, once dismounted, there's no apparent way to use a particular device again without rebooting.