OpenWrt Forum Archive

Topic: wr740n v4 USB mod! [AR9331] [FW compiled for all wr740/741 versions!]

The content of this topic has been archived between 6 Jun 2015 and 1 May 2018. Unfortunately there are posts – most likely complete pages – missing.

hehe tongue I thought it wasn't, but yes, it's well written on the first post...

dabyd64 wrote:

Compile it for the first time, with the modules/settings you want.
For mounting USB drives, select kernel kmod modules:
        USB support: usb2, ohci, storage
        Filesystems: ext4, ntfs, vfat
        Native language support: cp437,cp852,iso-8859-1, utf8.

If you want R/W NTFS support, select:
        Utilities/filesystems/ntfs-3g
       
Then go to build_dir/linux-ar71xx_generic/linux-3.3.8/arch/mips/ath79
Edit this files:

        mach-tl-wr741nd-v4.c
add        #include "dev-usb.h"           at the top of the file
add        ath79_register_usb();          before ath79_register_m25p80(&tl_wr741ndv4_flash_data)

        Kconfig
add        select ATH79_DEV_USB           under "config ATH79_MACH_TL_WR741ND_V4"

Now, run make again. Now the USB will work.

(Last edited by dabyd64 on 24 May 2013, 14:37)

Just it wasn't clear enough so I misunderstood :S, now with colours I think it is much better for beginners big_smile as well.

Cheers

dabyd64 wrote:

hehe tongue I thought it wasn't, but yes, it's well written on the first post...

dabyd64 wrote:

Compile it for the first time, with the modules/settings you want.
For mounting USB drives, select kernel kmod modules:
        USB support: usb2, ohci, storage
        Filesystems: ext4, ntfs, vfat
        Native language support: cp437,cp852,iso-8859-1, utf8.

If you want R/W NTFS support, select:
        Utilities/filesystems/ntfs-3g
       
Then go to build_dir/linux-ar71xx_generic/linux-3.3.8/arch/mips/ath79
Edit this files:

        mach-tl-wr741nd-v4.c
add        #include "dev-usb.h"           at the top of the file
add        ath79_register_usb();          before ath79_register_m25p80(&tl_wr741ndv4_flash_data)

        Kconfig
add        select ATH79_DEV_USB           under "config ATH79_MACH_TL_WR741ND_V4"

Now, run make again. Now the USB will work.

Hi all.

Finally I made my own image. It is based on Attitude Adjustment 12.09 final.
Removed IPv6 and pppoe support (I no need it, so just waste my free space), and unnecessary packages, now we have 668 KB free space after install.
There is usb support complied in with vfat and ext4 support. It have luci as web interface.

Everything else can install from packages.

WR741ND v1.x http://www.sendspace.com/file/7w2k7v
WR741ND v2.x http://www.sendspace.com/file/kdiiwf
WR741ND v4.x http://www.sendspace.com/file/50u2d6

The list of included packages and the md5sum infos are in packages above.

Other packages: http://www.sendspace.com/file/k7mcxr (13MB)

NEW LINK!!! (updated at 2014 03 04) http://www.sendspace.com/filegroup/Iqmy … 2BPX2Armrg

Have fun wink

(Last edited by pczolee on 4 Mar 2014, 10:26)

Guys please help me add correct info to the wiki, I added two images from this post (I hope that author agrees), but wiki page is probably missing some additional info so please check it out:
http://wiki.openwrt.org/toh/tp-link/tl-wr741nd#usb.host

Nice work!
I miss some BIG title like "740/741 v4.x USB MOD" on top of that, else it looks that its part of the 741 v2 usb mod.
Another thing that needs attention is the wire lenght. Some users were not able to make usb working due they were using the small wire to connect the cpu to the usb socket directly, getting errors and other issues.
Use the thin wire to connect the cpu to other thicker wires, keeping the lenght of the thin wires as short as possible, then connect the thicker wires to the usb socket.
And connect the 100µF capacitor very near of the usb socket... for the rest it's ok smile

thank you for how to.
confirm error "Device is not enumerated" because long wire lenght . i cuted wires twice. first time wires long was near as in first post photo.  "Device is not enumerated" still persist. after i left only 1 cm long wires and now all OK.
http://ge.tt/3Phhdxi?c

pczolee wrote:

Hi all.

Finally I made my own image. It is based on Attitude Adjustment 12.09 final.

please share how to compile Attitude Adjustment 12.09 with USB support for wr740n.

(Last edited by derrij on 10 Jun 2013, 12:18)

derrij wrote:
pczolee wrote:

Hi all.

Finally I made my own image. It is based on Attitude Adjustment 12.09 final.

please share how to compile Attitude Adjustment 12.09 with USB support for wr740n.


Hi.

So, the steps was (if I remember well wink )

If you are using debian, or ubuntu, install the needed packages in this way, other systems may have different package manager, and the package names could be also different.

apt-get install subversion build-essential libncurses5-dev zlib1g-dev gawk git ccache gettext libssl-dev xsltproc

mkdir ~/openwrt
cd ~/openwrt

If you want the latest svn:
svn co svn://svn.openwrt.org/openwrt/branches/attitude_adjustment

If you want the 12.09 final:
svn co svn://svn.openwrt.org/openwrt/tags/attitude_adjustment_12.09/

cd attitude_adjustment
./scripts/feeds update -a
./scripts/feeds install

Select what you want:
make menuconfig

Than build:
make

After this follow the first post (about apply the patch), and build again.

I hope it helps wink.

still, can't compile firmware with usb support. tried 4 times with different branches, but I can't find build_dir/linux-ar71xx_generic folder. even after 

make prereq && make tools/install && make toolchain/install 

as wiki says.
now i have build_dir/linux-ar71xx_generic , thanks to pczolee.
but still usb not working. i tried attitude_adjustment_12.09
which version of openwrt-ar71xx-generic-tl-wr741nd-v to flash, if i have wr740n v4?

derrij wrote:

still, can't compile firmware with usb support. tried 4 times with different branches, but I can't find build_dir/linux-ar71xx_generic folder. even after 

make prereq && make tools/install && make toolchain/install 

as wiki says.
now i have build_dir/linux-ar71xx_generic , thanks to pczolee.
but still usb not working. i tried attitude_adjustment_12.09
which version of openwrt-ar71xx-generic-tl-wr741nd-v to flash, if i have wr740n v4?

Well, I think you can use wr741nd v4, but I'm not 100% sure.
Forget the wiki, do what I wrote above.
So, I don't know if I understand, what you wrote, but, finally, you built the image or not?

Otherwise, there are precompiled images in the first port for 740n v4, try it.

If you still have problems, please post the messages, debug log, or console output etc.

the image compiled and flashed many times, many patch variation.
but every time, now answer to cat /sys/kernel/debug/usb/devices.
i tried image from the first post, but i need pwc and uvc video modules.

root@OpenWrt:~# opkg install kmod-video-pwc
Installing kmod-video-pwc (3.8.13-1) to root...
Downloading http://downloads.openwrt.org/snapshots/trunk/ar71xx/packages/kmod-video-pwc_3.8.13-1_ar71xx.ipk.
Multiple packages (kmod-usb-core and kmod-usb-core) providing same name marked HOLD or PREFER. Using latest.
Collected errors:
 * satisfy_dependencies_for: Cannot satisfy the following dependencies for kmod-video-pwc:
 *      kernel (= 3.8.13-1-219a148eccacc618878de12f719f457f) *  kernel (= 3.8.13-1-219a148eccacc618878de12f719f457f) *  kernel (= 3.8.13-1-219a148eccacc618878de12f719f457f) *
 * opkg_install_cmd: Cannot install package kmod-video-pwc.

i do sysupgrade from the first post. or i need to flash factory.bin to have ability install kernel modules?

(Last edited by derrij on 12 Jun 2013, 07:28)

derrij: if you build your custom image, you should also build the needed kernel modules and install them. trying to use the officially built ones will be pretty messy. You might need to edit your /etc/opkg.conf. Consult the documentation how to do that.

Non-kernel dependant packages usually work between kernel versions, but not the "kmod" and other kernel related packages.
So...yes, you must select all the packages you need in menuconfig, specially the kmod packages.
If you set it with "M" it will compile but not add them in the final image, if you select with "y" it will compile and include in the image, so they will be installed from the beginning.

(Last edited by dabyd64 on 12 Jun 2013, 14:08)

successfully compiled with patch from the wiki

Index: target/linux/ar71xx/patches-3.3/990-WR741ND-usb.patch
===================================================================
--- target/linux/ar71xx/patches-3.3/990-WR741ND-usb.patch    (revision 0)
+++ target/linux/ar71xx/patches-3.3/990-WR741ND-usb.patch    (revision 0)
@@ -0,0 +1,10 @@
+--- a/arch/mips/ath79/Kconfig    2013-03-12 15:18:29.827389883 +0400
++++ b/arch/mips/ath79/Kconfig    2013-03-12 15:21:57.884753554 +0400
+@@ -506,6 +506,7 @@
+     select ATH79_DEV_AP9X_PCI if PCI
+     select ATH79_DEV_ETH
+     select ATH79_DEV_GPIO_BUTTONS
++    select ATH79_DEV_USB
+     select ATH79_DEV_LEDS_GPIO
+     select ATH79_DEV_M25P80
+ 
Index: target/linux/ar71xx/files/arch/mips/ath79/mach-tl-wr741nd.c
===================================================================
--- target/linux/ar71xx/files/arch/mips/ath79/mach-tl-wr741nd.c    (revision 36033)
+++ target/linux/ar71xx/files/arch/mips/ath79/mach-tl-wr741nd.c    (working copy)
@@ -16,6 +16,7 @@
 #include "dev-eth.h"
 #include "dev-gpio-buttons.h"
 #include "dev-leds-gpio.h"
+#include "dev-usb.h"
 #include "dev-m25p80.h"
 #include "machtypes.h"
 
@@ -97,6 +98,8 @@
     u8 *mac = (u8 *) KSEG1ADDR(0x1f01fc00);
     u8 *ee = (u8 *) KSEG1ADDR(0x1fff1000);
 
+    ath79_register_usb();
+
     ath79_register_m25p80(&tl_wr741nd_flash_data);
 
     ath79_gpio_function_disable(AR724X_GPIO_FUNC_ETH_SWITCH_LED0_EN |

if patch applied after first make. do make clean first, then make again

Hello All,

dabyd64, thank You for Your useful thread and all the research going on here!
I did Your mod to my TP-Link TL-WR740n v.4.23. Then I flashed the router with pczolee's compiled version and finally - with dabyd64's.
However, when I attach a USB storage (flash drive or MP3 player), I get the following added to the system log:

[  941.730000] usb 1-1: new full-speed USB device number 2 using ehci-platform
[  941.890000] scsi0 : usb-storage 1-1:1.0
[  942.890000] scsi 0:0:0:0: Direct-Access     OMNI     MP3 Player       0100 PQ: 0 ANSI: 4
[  942.900000] scsi 0:0:0:1: Direct-Access     OMNI     MP3 Player       0100 PQ: 0 ANSI: 4
[  942.920000] sd 0:0:0:0: [sda] 247808 512-byte logical blocks: (126 MB/121 MiB)
[  942.940000] sd 0:0:0:0: [sda] Write Protect is off
[  942.940000] sd 0:0:0:0: [sda] Mode Sense: 38 00 00 00
[  942.960000] sd 0:0:0:0: [sda] No Caching mode page present
[  942.960000] sd 0:0:0:0: [sda] Assuming drive cache: write through
[  942.970000] sd 0:0:0:1: [sdb] Attached SCSI removable disk
[  942.990000] sd 0:0:0:0: [sda] No Caching mode page present
[  943.000000] sd 0:0:0:0: [sda] Assuming drive cache: write through
[  943.010000]  sda: sda1
[  943.030000] sd 0:0:0:0: [sda] No Caching mode page present
[  943.030000] sd 0:0:0:0: [sda] Assuming drive cache: write through
[  943.040000] sd 0:0:0:0: [sda] Attached SCSI removable disk

So the file system doesn't get mounted.
Here's the output of fdisk -l:

root@OpenWrt:~# fdisk -l

Disk /dev/mtdblock0: 0 MB, 131072 bytes
255 heads, 63 sectors/track, 0 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Disk /dev/mtdblock0 doesn't contain a valid partition table

Disk /dev/mtdblock1: 1 MB, 1004032 bytes
255 heads, 63 sectors/track, 0 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Disk /dev/mtdblock1 doesn't contain a valid partition table

Disk /dev/mtdblock2: 2 MB, 2993152 bytes
255 heads, 63 sectors/track, 0 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Disk /dev/mtdblock2 doesn't contain a valid partition table

Disk /dev/mtdblock3: 0 MB, 327680 bytes
255 heads, 63 sectors/track, 0 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Disk /dev/mtdblock3 doesn't contain a valid partition table

Disk /dev/mtdblock4: 0 MB, 65536 bytes
255 heads, 63 sectors/track, 0 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Disk /dev/mtdblock4 doesn't contain a valid partition table

Disk /dev/mtdblock5: 3 MB, 3997696 bytes
255 heads, 63 sectors/track, 0 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Disk /dev/mtdblock5 doesn't contain a valid partition table

Disk /dev/sda: 126 MB, 126877696 bytes
256 heads, 44 sectors/track, 22 cylinders
Units = cylinders of 11264 * 512 = 5767168 bytes

   Device Boot      Start         End      Blocks  Id System
/dev/sda1   *           1          22      123882   b Win95 FAT32

And here's what happens when I create a directory /tmp/run/mountd/sda1 and try to mount /dev/sda1:

root@OpenWrt:/tmp/run/mountd/sda1# pwd
/tmp/run/mountd/sda1
root@OpenWrt:/tmp/run/mountd/sda1# mount /dev/sda1 /tmp/run/mountd/sda1
NTFS signature is missing.
Failed to mount '/dev/sda1': Invalid argument
The device '/dev/sda1' doesn't seem to have a valid NTFS.
Maybe the wrong device is used? Or the whole disk instead of a
partition (e.g. /dev/sda, not /dev/sda1)? Or the other way around?

If I try to mount /dev/sda, I also get an error:

root@OpenWrt:/tmp/run/mountd# mount /dev/sda /tmp/run/mountd/sda1/
NTFS signature is missing.
Failed to mount '/dev/sda': Invalid argument
The device '/dev/sda' doesn't seem to have a valid NTFS.
Maybe the wrong device is used? Or the whole disk instead of a
partition (e.g. /dev/sda, not /dev/sda1)? Or the other way around?
mount: mounting /dev/sda on /tmp/run/mountd/sda1/ failed: Invalid argument

The file system I formatted the player in is ext4. Here's the ouput of dmesg when I connect it to a Debian Squeeze PC:

[ 4960.560527] usb 2-8: new full speed USB device using ohci_hcd and address 4
[ 4960.847146] usb 2-8: New USB device found, idVendor=066f, idProduct=8305
[ 4960.847156] usb 2-8: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[ 4960.847163] usb 2-8: Product: MP3 Player      
[ 4960.847168] usb 2-8: Manufacturer: OMNI    
[ 4960.847172] usb 2-8: SerialNumber: 23DE8E08B9D449A0
[ 4960.847383] usb 2-8: configuration #1 chosen from 1 choice
[ 4960.907586] Initializing USB Mass Storage driver...
[ 4960.907808] scsi6 : SCSI emulation for USB Mass Storage devices
[ 4960.908273] usbcore: registered new interface driver usb-storage
[ 4960.908279] USB Mass Storage support registered.
[ 4960.909488] usb-storage: device found at 4
[ 4960.909494] usb-storage: waiting for device to settle before scanning
[ 4965.909862] usb-storage: device scan complete
[ 4965.916826] scsi 6:0:0:0: Direct-Access     OMNI     MP3 Player       0100 PQ: 0 ANSI: 4
[ 4965.923802] scsi 6:0:0:1: Direct-Access     OMNI     MP3 Player       0100 PQ: 0 ANSI: 4
[ 4965.924962] sd 6:0:0:0: Attached scsi generic sg4 type 0
[ 4965.926398] sd 6:0:0:1: Attached scsi generic sg5 type 0
[ 4965.947800] sd 6:0:0:0: [sdd] 247808 512-byte logical blocks: (126 MB/121 MiB)
[ 4965.965816] sd 6:0:0:0: [sdd] Write Protect is off
[ 4965.965827] sd 6:0:0:0: [sdd] Mode Sense: 38 00 00 00
[ 4965.965833] sd 6:0:0:0: [sdd] Assuming drive cache: write through
[ 4965.976801] sd 6:0:0:1: [sde] Attached SCSI removable disk
[ 4966.042784] sd 6:0:0:0: [sdd] Assuming drive cache: write through
[ 4966.042796]  sdd: sdd1
[ 4966.081808] sd 6:0:0:0: [sdd] Assuming drive cache: write through
[ 4966.081821] sd 6:0:0:0: [sdd] Attached SCSI removable disk
[ 4967.325887] EXT4-fs (sdd1): recovery complete
[ 4967.325900] EXT4-fs (sdd1): mounted filesystem with ordered data mode

I tried with other flash drives, too. Some of them were formatted in FAT32.
I also measured the voltage when a device is connected and it stays about 5.1 V. I also tried with another 5V power supply and the result is the same.
Here are some photographs of the setup:
http://img62.imageshack.us/img62/6944/am55.jpg
http://img713.imageshack.us/img713/8191/v81p.jpg
http://img580.imageshack.us/img580/4755/kw5o.jpg
http://img109.imageshack.us/img109/7896/5h9.jpg


Does anybody have any clue on what this issue might be produced from?
Any advice will be very appreciated!
Thank You!


Best regards,
Nickolay

You have some nice soldering skills! smile

Install dosfstools (apt-get install dosfstools )
Then try to format the usb drive with FAT32: mkfs.fat32 /dev/sdx
Then connect it to the router and post here what happens, with dmesg and fdisk -l outputs.

Also, althought I don't think it's the problem, try with shorter wires, too long wires may cause some serious interferences and data errors...

(Last edited by dabyd64 on 8 Sep 2013, 23:24)

Did you install kmod-nls-cp437 and kmod-nls-iso8859-1 ? If I remmember correctly ext4 need one of them to the standard codepage of the filesystem.

(Last edited by zhadoom on 8 Sep 2013, 23:36)

is kmod-fs-ext4 already installed/built-in the kernel?

Hello,

dabyd64, thank You for the kind words!
I shortened the data wires coming from the CPU with about 10 cm. I formatted a memory card (mini SD) with FAT32 using gparted. Then connected a card reader with this card (which should essentially be the same as using a pendrive) to the router. Below are the outputs of fdisk -l and the latest lines of dmesg:

root@OpenWrt:~# fdisk -l

Disk /dev/mtdblock0: 0 MB, 131072 bytes
255 heads, 63 sectors/track, 0 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Disk /dev/mtdblock0 doesn't contain a valid partition table

Disk /dev/mtdblock1: 1 MB, 1004032 bytes
255 heads, 63 sectors/track, 0 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Disk /dev/mtdblock1 doesn't contain a valid partition table

Disk /dev/mtdblock2: 2 MB, 2993152 bytes
255 heads, 63 sectors/track, 0 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Disk /dev/mtdblock2 doesn't contain a valid partition table

Disk /dev/mtdblock3: 0 MB, 327680 bytes
255 heads, 63 sectors/track, 0 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Disk /dev/mtdblock3 doesn't contain a valid partition table

Disk /dev/mtdblock4: 0 MB, 65536 bytes
255 heads, 63 sectors/track, 0 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Disk /dev/mtdblock4 doesn't contain a valid partition table

Disk /dev/mtdblock5: 3 MB, 3997696 bytes
255 heads, 63 sectors/track, 0 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Disk /dev/mtdblock5 doesn't contain a valid partition table

Disk /dev/sda: 125 MB, 125960192 bytes
76 heads, 60 sectors/track, 53 cylinders
Units = cylinders of 4560 * 512 = 2334720 bytes

   Device Boot      Start         End      Blocks  Id System
/dev/sda1               1          54      121856   b Win95 FAT32
Partition 1 has different physical/logical beginnings (non-Linux?):
     phys=(0, 32, 33) logical=(0, 34, 9)
Partition 1 has different physical/logical endings:
     phys=(15, 75, 60) logical=(53, 67, 60)
root@OpenWrt:~# dmesg
[ 1740.950000] usb 1-1: new high-speed USB device number 3 using ehci-platform
[ 1741.360000] scsi1 : usb-storage 1-1:1.0
[ 1742.360000] scsi 1:0:0:0: Direct-Access     Generic- SD/MMC           1.00 PQ: 0 ANSI: 0 CCS
[ 1743.120000] sd 1:0:0:0: [sda] 246016 512-byte logical blocks: (125 MB/120 MiB)
[ 1743.120000] sd 1:0:0:0: [sda] Write Protect is off
[ 1743.130000] sd 1:0:0:0: [sda] Mode Sense: 03 00 00 00
[ 1743.140000] sd 1:0:0:0: [sda] No Caching mode page present
[ 1743.140000] sd 1:0:0:0: [sda] Assuming drive cache: write through
[ 1743.150000] sd 1:0:0:0: [sda] No Caching mode page present
[ 1743.160000] sd 1:0:0:0: [sda] Assuming drive cache: write through
[ 1743.160000]  sda: sda1
[ 1743.170000] sd 1:0:0:0: [sda] No Caching mode page present
[ 1743.180000] sd 1:0:0:0: [sda] Assuming drive cache: write through
[ 1743.180000] sd 1:0:0:0: [sda] Attached SCSI removable disk

To me it seems the router can recognize the device, but won't mount it. This should mean that the connections from the CPU are working properly and the power supply is sufficient.
Could it be a software problem? I think both distributions I tried (pczolee's and then dabyd64's) are tested successfully.

zhadoom and MBS: yes, those packages are present in the distribution I'm using:

kmod-fs-ext4 - 3.8.7-1
kmod-nls-cp437 - 3.8.7-1
kmod-nls-iso8859-1 - 3.8.7-1

Thank You all for the support!

Nickolay

(Last edited by n_dandanov on 9 Sep 2013, 22:22)

Try this way: ( assuming /dev/sda as the device is detected )
1- using fdisk delete any partitions in the usb storage device
2- using fdisk create a ext4 partition ( sda1 ) of full size of the device. Mark the partition as 83 ( ext ).
3- using mke2fs -j /dev/sda1 to create a filesystem
4- mount the partition.

The steps 1-3 can be made in other linux if you don't have fdisk / mke2fs in openwrt.

Hello, zhadoom,

Thanks for the advices! I went through these steps. Here's the result after plugging the device in the router's USB port:

root@OpenWrt:~# logread -f
Apr 17 05:43:26 OpenWrt kern.info kernel: [ 4843.300000] usb 1-1: new high-speed USB device number 4 using ehci-platform
Apr 17 05:43:27 OpenWrt kern.info kernel: [ 4843.720000] scsi2 : usb-storage 1-1:1.0
Apr 17 05:43:28 OpenWrt kern.notice kernel: [ 4844.720000] scsi 2:0:0:0: Direct-Access     Generic- SD/MMC           1.00 PQ: 0 ANSI: 0 CCS
Apr 17 05:43:29 OpenWrt kern.notice kernel: [ 4845.480000] sd 2:0:0:0: [sda] 246016 512-byte logical blocks: (125 MB/120 MiB)
Apr 17 05:43:29 OpenWrt kern.notice kernel: [ 4845.480000] sd 2:0:0:0: [sda] Write Protect is off
Apr 17 05:43:29 OpenWrt kern.debug kernel: [ 4845.490000] sd 2:0:0:0: [sda] Mode Sense: 03 00 00 00
Apr 17 05:43:29 OpenWrt kern.err kernel: [ 4845.500000] sd 2:0:0:0: [sda] No Caching mode page present
Apr 17 05:43:29 OpenWrt kern.err kernel: [ 4845.500000] sd 2:0:0:0: [sda] Assuming drive cache: write through
Apr 17 05:43:29 OpenWrt kern.err kernel: [ 4845.510000] sd 2:0:0:0: [sda] No Caching mode page present
Apr 17 05:43:29 OpenWrt kern.err kernel: [ 4845.520000] sd 2:0:0:0: [sda] Assuming drive cache: write through
Apr 17 05:43:29 OpenWrt kern.info kernel: [ 4845.530000]  sda: sda1
Apr 17 05:43:29 OpenWrt kern.err kernel: [ 4845.530000] sd 2:0:0:0: [sda] No Caching mode page present
Apr 17 05:43:29 OpenWrt kern.err kernel: [ 4845.540000] sd 2:0:0:0: [sda] Assuming drive cache: write through
Apr 17 05:43:29 OpenWrt kern.notice kernel: [ 4845.540000] sd 2:0:0:0: [sda] Attached SCSI removable disk

root@OpenWrt:~# fdisk -l

Disk /dev/sda: 125 MB, 125960192 bytes
76 heads, 60 sectors/track, 53 cylinders
Units = cylinders of 4560 * 512 = 2334720 bytes

   Device Boot      Start         End      Blocks  Id System
/dev/sda1               1          53      120810  83 Linux

root@OpenWrt:/tmp/run# mount /dev/sda1 /tmp/run/mnt/
NTFS signature is missing.
Failed to mount '/dev/sda1': Invalid argument
The device '/dev/sda1' doesn't seem to have a valid NTFS.
Maybe the wrong device is used? Or the whole disk instead of a
partition (e.g. /dev/sda, not /dev/sda1)? Or the other way around?
root@OpenWrt:/tmp/run# mount /dev/sda /tmp/run/mnt/
NTFS signature is missing.
Failed to mount '/dev/sda': Invalid argument
The device '/dev/sda' doesn't seem to have a valid NTFS.
Maybe the wrong device is used? Or the whole disk instead of a
partition (e.g. /dev/sda, not /dev/sda1)? Or the other way around?
mount: mounting /dev/sda on /tmp/run/mnt/ failed: Device or resource busy

So still not able to mount the system.

Edit:
After reading this wiki post, I mounted the drive successfully:

root@OpenWrt:/tmp/run# mkdir /mnt/share
root@OpenWrt:/tmp/run# mount -t ext4 /dev/sda1 /mnt/share/ -o rw,sync
root@OpenWrt:/tmp/run# ls /mnt/share/
lost+found

This directory is left by the Debian OS I partitioned the drive under.
After unmounting and unplugging the storage and then plugging it again, it got mounted automatically.
However, when I rebooted the router and tried again, I found something interesting. I plugged in the USB device and it didn't mount automatically. I mounted it without specifying any options and got the already mentioned error message. Despite this, the drive got mounted successfully. Here are the trimmed outputs:

root@OpenWrt:~# fdisk -l

Disk /dev/sda: 125 MB, 125960192 bytes
76 heads, 60 sectors/track, 53 cylinders
Units = cylinders of 4560 * 512 = 2334720 bytes

   Device Boot      Start         End      Blocks  Id System
/dev/sda1               1          53      120810  83 Linux

root@OpenWrt:~# mount /dev/sda1 /mnt/sda1/
NTFS signature is missing.
Failed to mount '/dev/sda1': Invalid argument
The device '/dev/sda1' doesn't seem to have a valid NTFS.
Maybe the wrong device is used? Or the whole disk instead of a
partition (e.g. /dev/sda, not /dev/sda1)? Or the other way around?

root@OpenWrt:~# logread 

Apr 17 06:13:58 OpenWrt kern.info kernel: [  314.470000] usb 1-1: new high-speed USB device number 4 using ehci-platform
Apr 17 06:13:58 OpenWrt kern.info kernel: [  314.880000] scsi2 : usb-storage 1-1:1.0
Apr 17 06:13:59 OpenWrt kern.notice kernel: [  315.880000] scsi 2:0:0:0: Direct-Access     Generic- SD/MMC           1.00 PQ: 0 ANSI: 0 CCS
Apr 17 06:14:00 OpenWrt kern.notice kernel: [  316.640000] sd 2:0:0:0: [sda] 246016 512-byte logical blocks: (125 MB/120 MiB)
Apr 17 06:14:00 OpenWrt kern.notice kernel: [  316.640000] sd 2:0:0:0: [sda] Write Protect is off
Apr 17 06:14:00 OpenWrt kern.debug kernel: [  316.650000] sd 2:0:0:0: [sda] Mode Sense: 03 00 00 00
Apr 17 06:14:00 OpenWrt kern.err kernel: [  316.660000] sd 2:0:0:0: [sda] No Caching mode page present
Apr 17 06:14:00 OpenWrt kern.err kernel: [  316.660000] sd 2:0:0:0: [sda] Assuming drive cache: write through
Apr 17 06:14:00 OpenWrt kern.err kernel: [  316.670000] sd 2:0:0:0: [sda] No Caching mode page present
Apr 17 06:14:00 OpenWrt kern.err kernel: [  316.680000] sd 2:0:0:0: [sda] Assuming drive cache: write through
Apr 17 06:14:00 OpenWrt kern.info kernel: [  316.680000]  sda: sda1
Apr 17 06:14:00 OpenWrt kern.err kernel: [  316.700000] sd 2:0:0:0: [sda] No Caching mode page present
Apr 17 06:14:00 OpenWrt kern.err kernel: [  316.700000] sd 2:0:0:0: [sda] Assuming drive cache: write through
Apr 17 06:14:00 OpenWrt kern.notice kernel: [  316.710000] sd 2:0:0:0: [sda] Attached SCSI removable disk
Apr 17 06:14:32 OpenWrt kern.info kernel: [  348.400000] EXT4-fs (sda1): mounting ext3 file system using the ext4 subsystem
Apr 17 06:14:32 OpenWrt kern.info kernel: [  348.510000] EXT4-fs (sda1): mounted filesystem with ordered data mode. Opts: (null)

root@OpenWrt:~# ls /mnt/sda1/
config      lost+found  mwan3

Those three folders are in fact present on the drive.
Later I tried with a drive formatted with FAT32:

Disk /dev/sda: 16.0 GB, 16022241280 bytes
82 heads, 18 sectors/track, 21201 cylinders
Units = cylinders of 1476 * 512 = 755712 bytes

   Device Boot      Start         End      Blocks  Id System
/dev/sda1   *           6       21202    15642688   c Win95 FAT32 (LBA)

The error message appeared again, but the mount seemed to be successful.


Thank You,
Nickolay

(Last edited by n_dandanov on 9 Sep 2013, 02:08)

Hello All,

Thank You for the support so far!
I wanted to implement mwan3 package, as I had it running before adding the USB functionality (https://forum.openwrt.org/viewtopic.php?id=39052). This package depends on a few others, one of which is iptables-mod-conntrack-extra.
Currently I'm having pczolee's WR741ND v4.x image installed (http://www.sendspace.com/file/50u2d6). When trying to install the package in question with opkg, the following error is produced:

Collected errors:
 * satisfy_dependencies_for: Cannot satisfy the following dependencies for iptables-mod-conntrack-extra:
 *     kernel (= 3.3.8-1-d6597ebf6203328d3519ea3c3371a493) * 
 * opkg_install_cmd: Cannot install package iptables-mod-conntrack-extra.

If I install via the --force-depends option, the router won't boot after a restart. The sys LED will flash, but there's no ping to the device even with static network settings on the PC. I managed to reset to factory defaults via the mentioned QSS switch procedure (http://wiki.openwrt.org/toh/tp-link/tl-wr740n), afterwards connecting with telnet and static IP assignments and then running the command:

mtd -r erase rootfs_data

Is there any way to make this package working properly? The error about kernel version appeared when installing other packages, too, but I forced installation and no further problems appeared. I'd like to stay with the stable release.
If there's no easy way, I guess I'll have to learn how to build a new image based on the final Attitude adjustment. I tried today but didn't do it well and have to read more about it. However, I think that's what pczolee has done.
Or perhaps making the trunk stable release work with USB would be great.

Best regards,
Nickolay

iptables is kernel dependant. You need to compile your own firmware!
Check that you have the package "block-mount".
If you compile your own, remember to enter in the block-mount setting and lower the 30 seconds wait for the usb devices to be ready.
I've tried myself and 7 seconds are more than enough.
Otherwise your router will wait 30 seconds each boot, which can be annoying in certain circunstances!

You have to edit you /etc/fstab to mount your usb drive automatically:

/dev/sda1       /USB    vfat    rw,async,umask=0,dmask=0,fmask=0        0       0

I plugged an usb drive, all went fine, see my logs:
dmesg

[16497.460000] usb 1-1: new high-speed USB device number 2 using ehci-platform
[16497.610000] scsi0 : usb-storage 1-1:1.0
[16498.610000] scsi 0:0:0:0: Direct-Access     JetFlash Transcend 32GB   1.00 PQ: 0 ANSI: 6
[16498.620000] sd 0:0:0:0: [sda] 61734912 512-byte logical blocks: (31.6 GB/29.4 GiB)
[16498.620000] sd 0:0:0:0: [sda] Write Protect is off
[16498.630000] sd 0:0:0:0: [sda] Mode Sense: 23 00 00 00
[16498.640000] sd 0:0:0:0: [sda] Write cache: disabled, read cache: disabled, doesn't support DPO or FUA
[16498.650000]  sda: sda1
[16498.660000] sd 0:0:0:0: [sda] Attached SCSI removable disk

mount

root@pc:/# mount
rootfs on / type rootfs (rw)
/dev/root on /rom type squashfs (ro,relatime)
proc on /proc type proc (rw,noatime)
sysfs on /sys type sysfs (rw,noatime)
tmpfs on /tmp type tmpfs (rw,nosuid,nodev,noatime,size=30908k)
tmpfs on /dev type tmpfs (rw,noatime,size=512k,mode=755)
devpts on /dev/pts type devpts (rw,noatime,mode=600)
/dev/mtdblock3 on /overlay type jffs2 (rw,noatime)
overlayfs:/overlay on / type overlayfs (rw,relatime,lowerdir=/,upperdir=/overlay)
debugfs on /sys/kernel/debug type debugfs (rw,relatime)
none on /proc/bus/usb type usbfs (rw,relatime)
/dev/sda1 on /USB type vfat (rw,relatime,fmask=0000,dmask=0000,allow_utime=0022,codepage=cp437,iocharset=iso8859-1,shortname=mixed,errors=remount-ro)

fdisk -l

root@pc:/# fdisk -l

...
...blah blah mtdblock devices
...

Disk /dev/sda: 31.6 GB, 31608274944 bytes
255 heads, 63 sectors/track, 3842 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks  Id System
/dev/sda1               1        3843    30866432   c Win95 FAT32 (LBA)

(Last edited by dabyd64 on 19 Sep 2013, 22:58)

Hello, dabyd64!
Thank You a lot for the advices and sorry for my late response!
So far the USB setup seems to be running nice.
However, I can't get such a good performance like You mentioned:

With fat32 formatted USB flash drive, I got 24MB/s read and 14MB/s write

May I ask under which conditions were these speeds possible? Converting to Mega bits per second this would mean 192Mbps read and 112Mbps write, which is very fast for a 100Mbps router.
The reason I'm asking is because I'd like to get both extroot and USB storage working on my router. However, I don't seem to have found a nicely working USB hub.
I also posted in these threads:
https://forum.openwrt.org/viewtopic.php … 16#p216516
https://forum.openwrt.org/viewtopic.php?id=47045

Thank You in advance!

Best regards,
Nickolay

Hi! Obviously that speed was between the router itself and the USB drive, tested with "dd if=/dev/zero of=/mnt/sda1/test.bin bs=1M count=100" , not through the LAN or Wireless.
It was slower when transferring through network, around 5MB/s over the wireless at 4 meters.
Also samba limits the speed pretty much due the cpu load.

(Last edited by dabyd64 on 2 Nov 2013, 13:36)