Android Question Smartmedia Reader

miguelinssrc

Member
Licensed User
Longtime User
Hi all,
is there any way to read a smartmedia card with android >= 6.0. I used an usb adaptor and usb otg cable and worked ok for android <=5 but in newer versions of android It tries to format the card (which I dont like obviously).

thanks in advance.

Miguel
 

miguelinssrc

Member
Licensed User
Longtime User
Hi Erel, the code for older versions....

B4X:
Sub leertarjetainfo

    folder=""
    Dim dwname As String = ""
    paths = storage.Initialize
    For i = 0 To paths.Size-1
        Log(paths.GetKeyAt(i)&"="&paths.GetValueAt(i))
        If paths.GetKeyAt(i)="DIRECTORY_DOWNLOADS" Then
            dwname=paths.GetValueAt(i)
            Log(dwname)
        End If
    Next
    Dim de As String = File.DirRootExternal
    Log ("DirRootExternal = "&de)
    Dim mtc As Matcher = Regex.Matcher("(/|\\)[^(/|\\)]*(/|\\)",de)
      extsdcard = de
    If mtc.Find = True Then
        Dim mnt As String = mtc.Group(0)
  
        Log ("mount point = "& mnt)
        Dim dirs As List = File.ListFiles(mnt)
        For Each f As String In dirs
            If storage.isExternalStorageRemovable(mnt&f) Then
                Log ("Device = "& f&":"&mnt&f&" is removable")
                If File.ListFiles(mnt&f).IsInitialized Then
                    Log("probably ExtSDCard: "&mnt&f)
                    extsdcard = mnt&f
                Else
                    'Log("Problem reading "&mnt&f)
                End If
            Else
                Log ("Device = "& f&":"&mnt&f&" is NOT removable")
            End If
        Next
    End If
    Log("extsdcard probably="&extsdcard)
    
    folder=extsdcard 'revert
    
    For Each f As String In File.ListFiles(extsdcard)
        Log(">"&f)
        If f=dwname Then
            dwf = True
        End If
    Next
    
    Log(extsdcard) ' this is the folder!!!!
    If extsdcard.Contains("Usb") Then
            usbready=True
        Else
            usbready=False
            ' if dwf exists revert to local folder
            If dwf Then
                extsdcard=folder & "/" & dwname
                Log(extsdcard)
            End If
    End If
End Sub

Data (log files) is located in the root folder of the SMCard.
Thanks in advance.
 
Upvote 0

miguelinssrc

Member
Licensed User
Longtime User
Tested before the first email. There is a warning on the top line of the Android screen: external medium: the USB drive is not compatible and then it offers the possibility to change to a compatible format, but the card and its contents are the same, so I suppose it is a limitation of Android OS. and there is no way to avoid it.

thanks Erel
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…