B4J Question USB pendrive on raspberry

micro

Well-Known Member
Licensed User
Longtime User
Hi to all
I have a strange problem on a product of the comfile technology a industrial Touch with raspberry 3.
I can not write on the USB pendrive, or rather the file seems to have been written but the pendrive is empty
These are the steps:
First of all I create the virtual path of the pendrive
mkdir /mnt/usb
chmod 777 /mnt/usb

Then in the code ceck if device is inserted
I find in the /dev the file sdx (sdx1 ..) where x = [a .... z].
If the device is present, mount the path with a shell
B4X:
Dim shmount As Shell
shmount.Initialize("shmount", "mount", Array As String("-t", "auto", "/dev/" & hd, "/mnt/usb"))
shmount.Run(-1)
where hd = sdx1.
The shell returns successfully so the mount is ok.
After writing the file check if the writing is successful with
B4X:
If File.Exists("/mnt/usb/", fname) Then
     NotificaShow("", "File " & fname & " salvato correttamente!", "none", 1500)
Else
     NotificaShow("", "Errore salvataggio file " & fname, "none", 1500)
End If
And in fact the notification tells me that the file is present.
A further test I do with winscp viewing the path /mnt/usb and the file is present.
But if remove the pendrive and inserted this in a pc the file is not present.
Why?
I remember that I always did this way and it worked.

Thanks.
 

micro

Well-Known Member
Licensed User
Longtime User
solved
Applying umount after writing.
I do not know if this is a general solution or only for this product.
Thanks to all.
 
Upvote 0
Top