Accessing SD Card in RavPower RP-WD03

I successfully migrated a RavPower RP-WD03 to OpenWRT 18.06 using the instructions at https://openwrt.org/toh/ravpower/ravpower_rp-wd03. I have not figured out how to access the Genesys GL827L SD Card reader in the RP-WD03. I do not see anything in the System or Kernel logs during boot nor when I insert an SD card, suggesting that a driver is missing. So far, Internet searches have not revealed anything useful. Does anyone have suggestions on where I should look next?

Thanks, Norbert

I'd try loading the USB drivers related to mass storage devices and the file systems you typically have on your SD cards. You may need or want to install the block-mount package as well.

@jeff, obvious after the fact (:-). I was seeing insertion of a USB drive but had not verified that it created a /dev/sdx device. I was missing kmod-usb-storage - once I installed it, I am now seeing the the SD card and USB drive devices. Next step is getting the SD card mounted.

Thanks for the fast response!
Norbert

2 Likes

Hi nh905,

Have you been able to mount your sdcard ? I am considering flashing my rp-wd03 but i would like to be sure all the hardware is supported.

thank you

@von-k, I was successfully able to access to SD card by:

opkg update
opkg install kmod-usb-storage block-mount e2fsprogs kmod-fs-ext4

I ended up not using extroot - I had several instances where the SD card became corrupted after a power cycle. It appears the power button on the RP-WD03 is not intercepted by OpenWRT, which may explain the issue. At the moment, I have enough flash space available.

I followed the instructions at https://openwrt.org/toh/ravpower/ravpower_rp-wd03#installation to upgrade to OpenWRT. I ran into a few issues:

  • the default RD-WD03 IP is 10.10.10.254, which conflicted with the static 10.10.10.254 that I assigned to my laptop Ethernet adapter - changed RD-WD03 IP to 10.10.10.128
  • I could not PING the RD-WD03 over Ethernet, even after changing the Ethernet adapter on my laptop from the default Public to Private
  • RP-WD03 bootloader could not contact TFTP server - disabled my laptop firewall to allow TFTP traffic

My goal is to turn the RP-WD03 into a mobile travel router. I am testing wwanHotspot (https://github.com/jordi-pujol/wwanHotspot) which provides the core functionality but does not handle channel switching when automatically switching between SSIDs where the APs are on different channels (see https://github.com/jordi-pujol/wwanHotspot/issues/10). Dynamic channel switching would also allow the RP-WD03 to handle multi-AP setups found in hotels.

Regards, Norbert

1 Like

Thank you that worked fine for me, i am trying to find a way to share the ethernet connection over wifi but i havent been successful so far. I opened another topic in the forum regarding this.

1 Like

I am noticing that when the sd-card is ejected, this is not detected by the OS, and the volume is kept mounted although the card is no longer in the device. I am not sure if that's my configuration or a bug....

@von-k, I see the same issue. I had not tested ejecting/inserting SD cards because I was planning to use the SD card with extroot.

According to dmesg, the SD card is detected properly during boot. Ejecting the SD card does not appear to be detected. If I try to access /dev/sda1, I get errors such as "No such file or directory while trying to open /dev/sda1", /dev/sda1 disappears, and dmesg shows "sda: detected capacity change from 1019215872 to 0". Re-inserting the SD card does nothing. It also appears that the SD card is only detected during the boot process - if I boot without the SD card and then insert it, it is not detected.

A USB flash drive that is ejected and re-inserted is properly handled. I noticed that re-inserting the USB drive caused the SD card to be detected. In the snippet below, the first line shows OpenWRT detecting that the SD card was ejected when I tried to access it. I re-inserted the SD card - no messages. The next lines shows the results of inserting the USB flash drive, followed by detection of the SD card.

[  686.399580] sda: detected capacity change from 1019215872 to 0
[  695.703325] usb 1-1.2: new high-speed USB device number 7 using ehci-platform
[  695.761941] usb-storage 1-1.2:1.0: USB Mass Storage device detected
[  695.785810] scsi host1: usb-storage 1-1.2:1.0
[  696.181204] scsi 1:0:0:0: Direct-Access     SanDisk  Cruzer Fit       1.00 PQ: 0 ANSI: 6
[  696.193179] sd 1:0:0:0: [sdb] 31260672 512-byte logical blocks: (16.0 GB/14.9 GiB)
[  696.201854] sd 1:0:0:0: [sdb] Write Protect is off
[  696.206764] sd 1:0:0:0: [sdb] Mode Sense: 43 00 00 00
[  696.212936] sd 1:0:0:0: [sdb] Write cache: disabled, read cache: enabled, doesn't support DPO or FUA
[  696.228205]  sdb: sdb1
[  696.237505] sd 1:0:0:0: [sdb] Attached SCSI removable disk
[  696.276307] sd 0:0:0:0: [sda] 1990656 512-byte logical blocks: (1.02 GB/972 MiB)
[  696.287972]  sda: sda1

I am well out of my depth at this point. I found https://forums.xilinx.com/t5/Embedded-Linux/SD-MMC-card-removal-insertion-detection/td-p/277946 which looks similar. Maybe the OpenWRT system for the RP-WD03 has not identified the SD card properly.

I also played around with https://openwrt.org/docs/guide-user/base-system/hotplug_lede. I dumped the environment variables in /etc/hotplug.d/block/10-mount - I get lots of good stuff when I insert the USB flash drive, but nothing for the SD card. However, trying to access the ejected SD card does create a block event. I am still not clear what inserting the USB flash drive triggers which also causes the SD card to e recognised.

Regards, Norbert

Hi,
sorry I did not see this before but here you go, I have a pending PR for this


To test yourself
1- install block-mount : opkg install block-mount
2- create a file called /etc/hotplug.d/block/00-media-change and put in it (using a text editor)

[ -n "$DISK_MEDIA_CHANGE" ] && /sbin/block info
[ $ACTION == "add" -a $DEVTYPE == "disk" -a $DEVICENAME != mtd* ] && { echo 2000 > /sys/block/$DEVNAME/events_poll_msecs }

It should work better with it , ie : rescan of partitiion eveytime the sd card or usb drive is inserted / ejected

@badzz , thanks for looking into this. I created /etc/hotplug.d/block/00-media-change and pasted in the two lines. I booted OpenWRT without the card inserted. Inserting the card did not cause the file system to be detected. Also, /sys/block/sda/events_poll_msecs remained -1. I dumped the variables passed to block/00-media-change - both insert and eject showed the same data. It looks like $ACTION needs to be checked against "change".

DEVNAME=sda
USER=root
ACTION=change
SHLVL=1
HOME=/
SEQNUM=568
MAJOR=8
HOTPLUG_TYPE=block
DISK_MEDIA_CHANGE=1
DEVPATH=/devices/platform/101c0000.ehci/usb1/1-1/1-1.1/1-1.1:1.0/host0/target0:0
:0/0:0:0:0/block/sda
LOGNAME=root
DEVICENAME=sda
TERM=linux
SUBSYSTEM=block
PATH=/usr/sbin:/usr/bin:/sbin:/bin
MINOR=0
PWD=/
DEVTYPE=disk

Manually setting it to 2000 worked - inserting the card creates /dev/sda1 and ejecting it removes /dev/sda1.

If I mount /dev/sda1 and eject the SD card, it appears that the mounted filesystem prevents the removal of /dev/sda1. Attempting to list the file system on the SD card shows empty directories along with dmesg errors. However, inserting the SD card is now detected and I can access it (no need to remount it). I appreciate that popping out the SD card without first unmounting it is probably a 'bad thing'. I haven't tested switching to a different SD card.

Thanks, Norbert

Thanks,
I had not checked recently. It is strange that the event name changed.
There is not clean way to eject an SD card safely. You might loose data if you are writing on it actually.
I will update the PR and test it before.
Thx

@badzz, I was monitoring the environment variables passed to 00-media-change after OpenWRT had booted. I just did a reboot and found the following "add" events.

DEVNAME=sda1
USER=root
ACTION=add
SHLVL=1
HOME=/
SEQNUM=413
MAJOR=8
HOTPLUG_TYPE=block
DEVPATH=/devices/platform/101c0000.ehci/usb1/1-1/1-1.1/1-1.1:1.0/host0/target0:0:0/0:0:0:0/block/sda/sda1
LOGNAME=root
DEVICENAME=sda1
TERM=linux
SUBSYSTEM=block
PATH=/usr/sbin:/usr/bin:/sbin:/bin
MINOR=1
PARTN=1
PWD=/
SYNTH_UUID=0
DEVTYPE=partition

DEVNAME=sda
USER=root
ACTION=add
SHLVL=1
HOME=/
SEQNUM=415
MAJOR=8
HOTPLUG_TYPE=block
DEVPATH=/devices/platform/101c0000.ehci/usb1/1-1/1-1.1/1-1.1:1.0/host0/target0:0:0/0:0:0:0/block/sda
LOGNAME=root
DEVICENAME=sda
TERM=linux
SUBSYSTEM=block
PATH=/usr/sbin:/usr/bin:/sbin:/bin
MINOR=0
PWD=/
SYNTH_UUID=0
DEVTYPE=disk

So your code should work, but cat /sys/block/sda/events_poll_msecs returns -1.

Regards, Norbert

There was typo .. notice the semi column at the end of the command.

[ -n "$DISK_MEDIA_CHANGE" ] && /sbin/block info

[ $ACTION == "add" -a $DEVTYPE == "disk" -a $DEVICENAME != mtd* ] && { echo 2000 > /sys/block/$DEVNAME/events_poll_msecs; }

@badzz, @von-k, the latest script works fine - added the semi-colon, rebooted, verified that /sys/block/sda/events_poll_msecs was set to 2000, and verified that eject/insert of SD card was properly detected.

I did not know that there had to be a new line or semi-colon before a closing curly bracket - normally, I put it on a line by itself for readability so I have not run into this issue. I created a script to test the second line in 00-media-change. Without the semi-colon, the script fails with syntax error: unexpected end of file (expecting "}") which I guess implies that the curly bracket was treated as part of the preceding command.

Thanks, Norbert

Yep when i ran the script, it gave me the error
My original script had a different syntax which got changed by a reviewer and the typo crept in...and I didn't test.
Sorry to have you use as beta tester.
Good to hear that it works now !

Hey all, late to the conversation here but I just flashed my RP-WD03 last night with the latest OpenWRT image available on the RP-WD03 wiki page. Wifi is fine but yea having issues mounting the SD card and USB drive. I installed all the packages that were recommended (opkg install kmod-usb-storage block-mount e2fsprogs kmod-fs-ext4) and see the packages in /dev and block info and block devices recognizes them as well. However, if I try to actually mount using block nothing seems to happen. Is there something else I need to do here?

@jplee3, do you see the SD card/USB drive added to /etc/config/fstab? The block command should update fstab but sets enabled to '0'. Below are the additional statements added to my fstab for the SD card. I manually mount the SD card so I left the configuration as is.

config 'mount'
        option  target  '/mnt/sda1'
        option  uuid    '750cb966-3e59-4848-b433-6f0c9a43d2a1'
        option  enabled '0'

Regards, Norbert

Thanks! So I ran both 'block info' and 'block detect' but nothing was added to /etc/config/fstab. I just added the output from 'block detect' (similar to yours but different uuid) to fstab and tried running 'block mount' again but it didn't mount anything.

Hi,
we have traction on the PR, one maintainer change the script. I checked and it still works for me

[ -n "$DISK_MEDIA_CHANGE" ] && /sbin/block info

[ $ACTION = "add" -a $DEVTYPE = "disk" ] && {
       case "$DEVNAME" in
               mtd*) : ;;
               *) echo 2000 > /sys/block/$DEVNAME/events_poll_msecs ;;
       esac
}

If a second person could check it

Hi,
and you change enabled to 1 ?
and you have have a /mnt/sda1 folder existing ?