1 (edited by dktn 2017-02-23 02:45:15)

Topic: [SOLVE] USB Mod on TLWR941v5 (TL-WR940v2)

I mod usb on TLWR940v2(like TLWR941v5) by connect D+ and D- to USB hub.
Pin B42 and B50 like
http://static.oschina.net/uploads/space … _82631.jpg
http://static.oschina.net/uploads/space … _82631.jpg
so I do not know how to build firmware for USB mod for it.
then i flash TLWR940v2 by firmware for TLMR3420v2 and my USB works OKay( maybe same CPU) but Led on router work unnorman.
Please help me the way to build firmware CC15.05.1 for TLWR941v5 with USB mod.
sorry for my english so bad.
i follow this website but can not find files like that
http://www.lai18.com/content/2334675.html?from=cancel

Re: [SOLVE] USB Mod on TLWR941v5 (TL-WR940v2)

It should just be changes to the following two files and then compile.
In /target/linux/ar71xx/generic/profiles/tp-link.mk look for that section:

define Profile/TLWR941
    NAME:=TP-LINK TL-WR941N/ND
    PACKAGES:=
endef

and change the PACKAGES line to look like this:

    PACKAGES:=kmod-usb-core kmod-usb2

Then, in /target/linux/ar71xx/files/arch/mips/ath79/mach-tl-wr941nd.c:

#include "dev-m25p80.h"
#include "dev-wmac.h"

insert the following line:

#include "dev-usb.h"

And further down in this section:

    ath79_register_gpio_keys_polled(-1, TL_WR941ND_KEYS_POLL_INTERVAL,
                    ARRAY_SIZE(tl_wr941nd_gpio_keys),
                    tl_wr941nd_gpio_keys);
    ath79_register_wmac(eeprom, mac);

insert the following line:

    ath79_register_usb();

3 (edited by dktn 2017-02-16 03:54:07)

Re: [SOLVE] USB Mod on TLWR941v5 (TL-WR940v2)

Thank you for reply
I dowloaded file "OpenWrt-ImageBuilder-15.05.1-ar71xx-generic.Linux-x86_64.tar.bz2" then Unpack to "OpenWrt-ImageBuilder-15.05.1-ar71xx-generic.Linux-x86_64"
the I changed file "tp-link.mk " but i can not find file "mach-tl-wr941nd.c" or directory "ath79".
In /target/linux/ar71xx. these are some files as picture:
https://drive.google.com/file/d/0BzGuJz … sp=sharing.
please tell me how to do.

Re: [SOLVE] USB Mod on TLWR941v5 (TL-WR940v2)

You need the full source code, as can be obtained here.

5 (edited by dktn 2017-02-17 02:54:14)

Re: [SOLVE] USB Mod on TLWR941v5 (TL-WR940v2)

I dowloaded file openwrt-15.05.1.taz.gz then unzip to directory.
- from this directory I run terminal Program
- i add some line(PACKAGES:=kmod-usb-core kmod-usb2; #include "dev-usb.h;   ath79_register_usb();"  as you tell me to some files.
- I run some command : ./scripts/feeds update -a
                                      ./scripts/feeds install -a
                                       make prereq
                                       make menuconfig
 
then i select Block-mount, kmod-usb2, kmod-ext4.
                                        after that I run command: make
I create some firmware for me.
But router not reconige USB by df-h (I check in /etc/config has file: fastab
(sorry because this is the first time i compile by this way, did i make it OK?)
I do not know why it did not reconige USB?

Re: [SOLVE] USB Mod on TLWR941v5 (TL-WR940v2)

Please post the output of the command "dmesg" on the router and also upload the files you changed, so we can have a look.

Re: [SOLVE] USB Mod on TLWR941v5 (TL-WR940v2)

I post files backup of router, some pictures, file dmesg and some files i modified as you tell me .https://drive.google.com/open?id=0BzGuJ … UFITlhjc3c

8 (edited by dktn 2017-04-18 15:25:36)

Re: [SOLVE] USB Mod on TLWR941v5 (TL-WR940v2)

file dmesg

Using username "root".
root@192.168.1.1's password:


BusyBox v1.23.2 (2017-02-17 14:54:29 ICT) built-in shell (ash)

  _______                     ________        __
 |       |.-----.-----.-----.|  |  |  |.----.|  |_
 |   -   ||  _  |  -__|     ||  |  |  ||   _||   _|
 |_______||   __|_____|__|__||________||__|  |____|
          |__| W I R E L E S S   F R E E D O M
 -----------------------------------------------------
 CHAOS CALMER (Chaos Calmer, unknown)
 -----------------------------------------------------
  * 1 1/2 oz Gin            Shake with a glassful
  * 1/4 oz Triple Sec       of broken ice and pour
  * 3/4 oz Lime Juice       unstrained into a goblet.
  * 1 1/2 oz Orange Juice
  * 1 tsp. Grenadine Syrup
 -----------------------------------------------------
root@OpenWrt:~# dmesg
[    0.000000] Linux version 3.18.23 (root@huy-N-A) (gcc version 4.8.3 (OpenWrt/Linaro GCC 4.8-2014.04 unknown) ) #6 Fri Feb 17 21:30:02 ICT 2017
[    0.000000] MyLoader: sysp=d27e3a26, boardp=87017989, parts=bf805f02
[    0.000000] bootconsole [early0] enabled
[    0.000000] CPU0 revision is: 0001974c (MIPS 74Kc)
[    0.000000] SoC: Atheros AR9341 rev 1
[    0.000000] Determined physical RAM map:
[    0.000000]  memory: 04000000 @ 00000000 (usable)
[    0.000000] Initrd not found or empty - disabling initrd
[    0.000000] Zone ranges:
[    0.000000]   Normal   [mem 0x00000000-0x03ffffff]
[    0.000000] Movable zone start for each node
[    0.000000] Early memory node ranges
[    0.000000]   node   0: [mem 0x00000000-0x03ffffff]
[    0.000000] Initmem setup node 0 [mem 0x00000000-0x03ffffff]
[    0.000000] On node 0 totalpages: 16384
[    0.000000] free_area_init_node: node 0, pgdat 803580f0, node_mem_map 81000000
[    0.000000]   Normal zone: 128 pages used for memmap
[    0.000000]   Normal zone: 0 pages reserved
[    0.000000]   Normal zone: 16384 pages, LIFO batch:3
[    0.000000] Primary instruction cache 64kB, VIPT, 4-way, linesize 32 bytes.
[    0.000000] Primary data cache 32kB, 4-way, VIPT, cache aliases, linesize 32 bytes
[    0.000000] pcpu-alloc: s0 r0 d32768 u32768 alloc=1*32768
[    0.000000] pcpu-alloc: [0] 0
[    0.000000] Built 1 zonelists in Zone order, mobility grouping on.  Total pages: 16256
[    0.000000] Kernel command line:  board=TL-WR941ND-v5  console=ttyS0,115200 rootfstype=squashfs,jffs2 noinitrd
[    0.000000] PID hash table entries: 256 (order: -2, 1024 bytes)
[    0.000000] Dentry cache hash table entries: 8192 (order: 3, 32768 bytes)
[    0.000000] Inode-cache hash table entries: 4096 (order: 2, 16384 bytes)
[    0.000000] Writing ErrCtl register=00000000
[    0.000000] Readback ErrCtl register=00000000
[    0.000000] Memory: 60944K/65536K available (2477K kernel code, 126K rwdata, 528K rodata, 252K init, 188K bss, 4592K reserved)
[    0.000000] SLUB: HWalign=32, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
[    0.000000] NR_IRQS:51
[    0.000000] Clocks: CPU:535.000MHz, DDR:400.000MHz, AHB:200.000MHz, Ref:25.000MHz
[    0.000000] Calibrating delay loop... 266.64 BogoMIPS (lpj=1333248)
[    0.080000] pid_max: default: 32768 minimum: 301
[    0.080000] Mount-cache hash table entries: 1024 (order: 0, 4096 bytes)
[    0.090000] Mountpoint-cache hash table entries: 1024 (order: 0, 4096 bytes)
[    0.100000] NET: Registered protocol family 16
[    0.100000] MIPS: machine is TP-LINK TL-WR941N/ND v5
[    0.560000] Switched to clocksource MIPS
[    0.560000] NET: Registered protocol family 2
[    0.570000] TCP established hash table entries: 1024 (order: 0, 4096 bytes)
[    0.570000] TCP bind hash table entries: 1024 (order: 0, 4096 bytes)
[    0.580000] TCP: Hash tables configured (established 1024 bind 1024)
[    0.580000] TCP: reno registered
[    0.590000] UDP hash table entries: 256 (order: 0, 4096 bytes)
[    0.590000] UDP-Lite hash table entries: 256 (order: 0, 4096 bytes)
[    0.600000] NET: Registered protocol family 1
[    0.600000] PCI: CLS 0 bytes, default 32
[    0.600000] futex hash table entries: 256 (order: -1, 3072 bytes)
[    0.620000] squashfs: version 4.0 (2009/01/31) Phillip Lougher
[    0.620000] jffs2: version 2.2 (NAND) (SUMMARY) (LZMA) (RTIME) (CMODE_PRIORITY) (c) 2001-2006 Red Hat, Inc.
[    0.630000] msgmni has been set to 119
[    0.650000] io scheduler noop registered
[    0.650000] io scheduler deadline registered (default)
[    0.660000] Serial: 8250/16550 driver, 1 ports, IRQ sharing disabled
[    0.660000] console [ttyS0] disabled
[    0.690000] serial8250.0: ttyS0 at MMIO 0x18020000 (irq = 11, base_baud = 1562500) is a 16550A
[    0.700000] console [ttyS0] enabled
[    0.700000] bootconsole [early0] disabled
[    0.710000] m25p80 spi0.0: found mx25l3205d, expected m25p80
[    0.720000] m25p80 spi0.0: mx25l3205d (4096 Kbytes)
[    0.730000] 5 tp-link partitions found on MTD device spi0.0
[    0.730000] Creating 5 MTD partitions on "spi0.0":
[    0.740000] 0x000000000000-0x000000020000 : "u-boot"
[    0.740000] 0x000000020000-0x0000001357bc : "kernel"
[    0.750000] 0x0000001357bc-0x0000003f0000 : "rootfs"
[    0.750000] mtd: device 2 (rootfs) set to be root filesystem
[    0.760000] 1 squashfs-split partitions found on MTD device rootfs
[    0.770000] 0x000000360000-0x0000003f0000 : "rootfs_data"
[    0.770000] 0x0000003f0000-0x000000400000 : "art"
[    0.780000] 0x000000020000-0x0000003f0000 : "firmware"
[    0.800000] libphy: ag71xx_mdio: probed
[    1.400000] ag71xx ag71xx.0: connected to PHY at ag71xx-mdio.1:00 [uid=004dd042, driver=Generic PHY]
[    1.410000] eth0: Atheros AG71xx at 0xb9000000, irq 4, mode:MII
[    2.000000] ag71xx-mdio.1: Found an AR934X built-in switch
[    2.040000] eth1: Atheros AG71xx at 0xba000000, irq 5, mode:GMII
[    2.050000] TCP: cubic registered
[    2.050000] NET: Registered protocol family 17
[    2.060000] bridge: automatic filtering via arp/ip/ip6tables has been deprecated. Update your scripts to load br_netfilter if you need this.
[    2.070000] 8021q: 802.1Q VLAN Support v1.8
[    2.080000] VFS: Mounted root (squashfs filesystem) readonly on device 31:2.
[    2.090000] Freeing unused kernel memory: 252K (80371000 - 803b0000)
[    3.150000] init: Console is alive
[    3.160000] init: - watchdog -
[    4.920000] usbcore: registered new interface driver usbfs
[    4.930000] usbcore: registered new interface driver hub
[    4.930000] usbcore: registered new device driver usb
[    4.980000] SCSI subsystem initialized
[    4.990000] ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
[    5.000000] ehci-platform: EHCI generic platform driver
[    5.010000] ohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driver
[    5.020000] ohci-platform: OHCI generic platform driver
[    5.030000] uhci_hcd: USB Universal Host Controller Interface driver
[    5.040000] usbcore: registered new interface driver usb-storage
[    5.190000] init: - preinit -
[    5.800000] random: procd urandom read with 9 bits of entropy available
[    9.020000] mount_root: loading kmods from internal overlay
[    9.270000] jffs2: notice: (364) jffs2_build_xattr_subsystem: complete building xattr subsystem, 0 of xdatum (0 unchecked, 0 orphan) and 0 of xref (0 dead, 0 orphan) found.
[    9.290000] block: attempting to load /tmp/jffs_cfg/upper/etc/config/fstab
[    9.300000] block: extroot: device not present, retrying in 3 seconds
[   12.310000] block: extroot: cannot find device with UUID 2d29c232-b930-4c58-b7ce-72d0dc3e1f95
[   12.350000] jffs2: notice: (360) jffs2_build_xattr_subsystem: complete building xattr subsystem, 0 of xdatum (0 unchecked, 0 orphan) and 0 of xref (0 dead, 0 orphan) found.
[   12.500000] block: attempting to load /tmp/jffs_cfg/upper/etc/config/fstab
[   12.510000] block: extroot: device not present, retrying in 3 seconds
[   15.520000] block: extroot: cannot find device with UUID 2d29c232-b930-4c58-b7ce-72d0dc3e1f95
[   15.530000] mount_root: switching to jffs2 overlay
[   15.580000] procd: - early -
[   15.590000] procd: - watchdog -
[   16.380000] procd: - ubus -
[   17.400000] procd: - init -
[   18.280000] NET: Registered protocol family 10
[   18.300000] ip6_tables: (C) 2000-2006 Netfilter Core Team
[   18.320000] Loading modules backported from Linux version master-2015-03-09-0-g141f155
[   18.330000] Backport generated by backports.git backports-20150129-0-gdd4a670
[   18.340000] ip_tables: (C) 2000-2006 Netfilter Core Team
[   18.360000] nf_conntrack version 0.5.0 (956 buckets, 3824 max)
[   18.400000] xt_time: kernel timezone is -0000
[   18.430000] cfg80211: Calling CRDA to update world regulatory domain
[   18.460000] cfg80211: World regulatory domain updated:
[   18.460000] cfg80211:  DFS Master region: unset
[   18.470000] cfg80211:   (start_freq - end_freq @ bandwidth), (max_antenna_gain, max_eirp), (dfs_cac_time)
[   18.480000] cfg80211:   (2402000 KHz - 2472000 KHz @ 40000 KHz), (N/A, 2000 mBm), (N/A)
[   18.480000] cfg80211:   (2457000 KHz - 2482000 KHz @ 20000 KHz, 92000 KHz AUTO), (N/A, 2000 mBm), (N/A)
[   18.490000] cfg80211:   (2474000 KHz - 2494000 KHz @ 20000 KHz), (N/A, 2000 mBm), (N/A)
[   18.500000] cfg80211:   (5170000 KHz - 5250000 KHz @ 80000 KHz, 160000 KHz AUTO), (N/A, 2000 mBm), (N/A)
[   18.510000] cfg80211:   (5250000 KHz - 5330000 KHz @ 80000 KHz, 160000 KHz AUTO), (N/A, 2000 mBm), (0 s)
[   18.520000] cfg80211:   (5490000 KHz - 5730000 KHz @ 160000 KHz), (N/A, 2000 mBm), (0 s)
[   18.530000] cfg80211:   (5735000 KHz - 5835000 KHz @ 80000 KHz), (N/A, 2000 mBm), (N/A)
[   18.540000] cfg80211:   (57240000 KHz - 63720000 KHz @ 2160000 KHz), (N/A, 0 mBm), (N/A)
[   18.610000] PPP generic driver version 2.4.2
[   18.620000] NET: Registered protocol family 24
[   18.680000] ath: EEPROM regdomain: 0x0
[   18.680000] ath: EEPROM indicates default country code should be used
[   18.680000] ath: doing EEPROM country->regdmn map search
[   18.680000] ath: country maps to regdmn code: 0x3a
[   18.680000] ath: Country alpha2 being used: US
[   18.680000] ath: Regpair used: 0x3a
[   18.690000] ieee80211 phy0: Selected rate control algorithm 'minstrel_ht'
[   18.700000] ieee80211 phy0: Atheros AR9340 Rev:1 mem=0xb8100000, irq=47
[   18.710000] cfg80211: Calling CRDA for country: US
[   18.720000] cfg80211: Regulatory domain changed to country: US
[   18.720000] cfg80211:  DFS Master region: FCC
[   18.730000] cfg80211:   (start_freq - end_freq @ bandwidth), (max_antenna_gain, max_eirp), (dfs_cac_time)
[   18.740000] cfg80211:   (2402000 KHz - 2472000 KHz @ 40000 KHz), (N/A, 3000 mBm), (N/A)
[   18.750000] cfg80211:   (5170000 KHz - 5250000 KHz @ 80000 KHz, 160000 KHz AUTO), (N/A, 2300 mBm), (N/A)
[   18.760000] cfg80211:   (5250000 KHz - 5330000 KHz @ 80000 KHz, 160000 KHz AUTO), (N/A, 2300 mBm), (0 s)
[   18.770000] cfg80211:   (5490000 KHz - 5730000 KHz @ 160000 KHz), (N/A, 2300 mBm), (0 s)
[   18.780000] cfg80211:   (5735000 KHz - 5835000 KHz @ 80000 KHz), (N/A, 3000 mBm), (N/A)
[   18.780000] cfg80211:   (57240000 KHz - 63720000 KHz @ 2160000 KHz), (N/A, 4000 mBm), (N/A)
[   26.750000] device eth1 entered promiscuous mode
[   26.770000] br-lan: port 1(eth1) entered forwarding state
[   26.780000] br-lan: port 1(eth1) entered forwarding state
[   26.830000] IPv6: ADDRCONF(NETDEV_UP): eth0: link is not ready
[   27.800000] br-lan: port 1(eth1) entered disabled state
[   28.900000] eth1: link up (1000Mbps/Full duplex)
[   28.900000] br-lan: port 1(eth1) entered forwarding state
[   28.910000] br-lan: port 1(eth1) entered forwarding state
[   30.910000] br-lan: port 1(eth1) entered forwarding state
[   77.980000] random: nonblocking pool is initialized

root@OpenWrt:~# df -h

Filesystem                Size      Used Available Use% Mounted on
rootfs                  576.0K    212.0K    364.0K  37% /
/dev/root                 2.3M      2.3M         0 100% /rom
tmpfs                    29.9M     68.0K     29.8M   0% /tmp
/dev/mtdblock3          576.0K    212.0K    364.0K  37% /overlay
overlayfs:/overlay      576.0K    212.0K    364.0K  37% /
tmpfs                   512.0K         0    512.0K   0% /dev

9 (edited by dktn 2017-04-18 15:20:57)

Re: [SOLVE] USB Mod on TLWR941v5 (TL-WR940v2)

/*
 *  TP-LINK TL-WR941ND board support
 *
 *  Copyright (C) 2009-2012 Gabor Juhos <juhosg@openwrt.org>
 *
 *  This program is free software; you can redistribute it and/or modify it
 *  under the terms of the GNU General Public License version 2 as published
 *  by the Free Software Foundation.
 */

#include <linux/platform_device.h>

#include <asm/mach-ath79/ath79.h>

#include "dev-dsa.h"
#include "dev-eth.h"
#include "dev-gpio-buttons.h"
#include "dev-leds-gpio.h"
#include "dev-m25p80.h"
#include "dev-wmac.h"
[b]#include "dev-usb.h"[/b]
#include "machtypes.h"

#define TL_WR941ND_GPIO_LED_SYSTEM    2
#define TL_WR941ND_GPIO_LED_QSS_RED    4
#define TL_WR941ND_GPIO_LED_QSS_GREEN    5
#define TL_WR941ND_GPIO_LED_WLAN    9

#define TL_WR941ND_GPIO_BTN_RESET    3
#define TL_WR941ND_GPIO_BTN_QSS        7

#define TL_WR941ND_KEYS_POLL_INTERVAL    20    /* msecs */
#define TL_WR941ND_KEYS_DEBOUNCE_INTERVAL (3 * TL_WR941ND_KEYS_POLL_INTERVAL)

static const char *tl_wr941nd_part_probes[] = {
    "tp-link",
    NULL,
};

static struct flash_platform_data tl_wr941nd_flash_data = {
    .part_probes    = tl_wr941nd_part_probes,
};

static struct gpio_led tl_wr941nd_leds_gpio[] __initdata = {
    {
        .name        = "tp-link:green:system",
        .gpio        = TL_WR941ND_GPIO_LED_SYSTEM,
        .active_low    = 1,
    }, {
        .name        = "tp-link:red:qss",
        .gpio        = TL_WR941ND_GPIO_LED_QSS_RED,
    }, {
        .name        = "tp-link:green:qss",
        .gpio        = TL_WR941ND_GPIO_LED_QSS_GREEN,
    }, {
        .name        = "tp-link:green:wlan",
        .gpio        = TL_WR941ND_GPIO_LED_WLAN,
        .active_low    = 1,
    }
};

static struct gpio_keys_button tl_wr941nd_gpio_keys[] __initdata = {
    {
        .desc        = "reset",
        .type        = EV_KEY,
        .code        = KEY_RESTART,
        .debounce_interval = TL_WR941ND_KEYS_DEBOUNCE_INTERVAL,
        .gpio        = TL_WR941ND_GPIO_BTN_RESET,
        .active_low    = 1,
    }, {
        .desc        = "qss",
        .type        = EV_KEY,
        .code        = KEY_WPS_BUTTON,
        .debounce_interval = TL_WR941ND_KEYS_DEBOUNCE_INTERVAL,
        .gpio        = TL_WR941ND_GPIO_BTN_QSS,
        .active_low    = 1,
    }
};

static struct dsa_chip_data tl_wr941nd_dsa_chip = {
    .port_names[0]  = "wan",
    .port_names[1]  = "lan1",
    .port_names[2]  = "lan2",
    .port_names[3]  = "lan3",
    .port_names[4]  = "lan4",
    .port_names[5]  = "cpu",
};

static struct dsa_platform_data tl_wr941nd_dsa_data = {
    .nr_chips    = 1,
    .chip        = &tl_wr941nd_dsa_chip,
};

static void __init tl_wr941nd_setup(void)
{
    u8 *mac = (u8 *) KSEG1ADDR(0x1f01fc00);
    u8 *eeprom = (u8 *) KSEG1ADDR(0x1fff1000);

    ath79_register_mdio(0, 0x0);

    ath79_init_mac(ath79_eth0_data.mac_addr, mac, 0);
    ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_RMII;
    ath79_eth0_data.speed = SPEED_100;
    ath79_eth0_data.duplex = DUPLEX_FULL;

    ath79_register_eth(0);
    ath79_register_dsa(&ath79_eth0_device.dev, &ath79_mdio0_device.dev,
               &tl_wr941nd_dsa_data);

    ath79_register_m25p80(&tl_wr941nd_flash_data);

    ath79_register_leds_gpio(-1, ARRAY_SIZE(tl_wr941nd_leds_gpio),
                 tl_wr941nd_leds_gpio);

    ath79_register_gpio_keys_polled(-1, TL_WR941ND_KEYS_POLL_INTERVAL,
                    ARRAY_SIZE(tl_wr941nd_gpio_keys),
                    tl_wr941nd_gpio_keys);
    ath79_register_wmac(eeprom, mac);
       [b] ath79_register_usb();[/b]
}

MIPS_MACHINE(ATH79_MACH_TL_WR941ND, "TL-WR941ND", "TP-LINK TL-WR941ND",
         tl_wr941nd_setup);

10 (edited by dktn 2017-02-20 03:08:43)

Re: [SOLVE] USB Mod on TLWR941v5 (TL-WR940v2)

sorry repeat post

11 (edited by dktn 2017-02-20 03:11:39)

Re: [SOLVE] USB Mod on TLWR941v5 (TL-WR940v2)

File TP-LINK.mk



#
# Copyright (C) 2009 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#

................................

define Profile/TLWR941
    NAME:=TP-LINK TL-WR941N/ND
    PACKAGES:=kmod-usb-core kmod-usb2
endef

define Profile/TLWR941/Description
    Package set optimized for the TP-LINK TL-WR941N/ND.
.................................

Re: [SOLVE] USB Mod on TLWR941v5 (TL-WR940v2)

I run command
Make V=s
Or
Make V=99
But not okay

Re: [SOLVE] USB Mod on TLWR941v5 (TL-WR940v2)

I try follow this post https://forum.openwrt.org/viewtopic.php?id=37368 but USB not work.
If i use firmware for TLMR3420 or firmware TLWR841V8 mod USB are work on my router TLWR941V5 but some led of router not work.
Please tell me the way mod usb on TLWR941V5.

14

Re: [SOLVE] USB Mod on TLWR941v5 (TL-WR940v2)

I think I missed another position, please put this file into /target/linux/ar71xx/patches-3.18
For a quick test, you may also test this firmware image, which has the patch already applied, but doesn't contain other modules (like usb-storage, filesystems, etc.). Yet it should show more information, even on plugging and unplugging USB devices.

Also, please edit your previous posts and put the contents of the files in code-tags and also mention, which file you are quoting - this makes it easier to scroll through this page and lets other people easier know, what you are refering to.

15 (edited by dktn 2017-04-18 15:21:36)

Re: [SOLVE] USB Mod on TLWR941v5 (TL-WR940v2)

this is file dmesg of your firmware:

root@OpenWrt:/# dmesg
[    0.000000] Linux version 3.18.23 (mbs@openwrt-devel) (gcc version 4.8.3 (OpenWrt/Linaro GCC 4.8-2014.04 unknown) ) #1 Sun Feb 19 15:22:42 CET 2017
[    0.000000] MyLoader: sysp=d27e3a26, boardp=87017989, parts=bf805f02
[    0.000000] bootconsole [early0] enabled
[    0.000000] CPU0 revision is: 0001974c (MIPS 74Kc)
[    0.000000] SoC: Atheros AR9341 rev 1
[    0.000000] Determined physical RAM map:
[    0.000000]  memory: 04000000 @ 00000000 (usable)
[    0.000000] Initrd not found or empty - disabling initrd
[    0.000000] Zone ranges:
[    0.000000]   Normal   [mem 0x00000000-0x03ffffff]
[    0.000000] Movable zone start for each node
[    0.000000] Early memory node ranges
[    0.000000]   node   0: [mem 0x00000000-0x03ffffff]
[    0.000000] Initmem setup node 0 [mem 0x00000000-0x03ffffff]
[    0.000000] On node 0 totalpages: 16384
[    0.000000] free_area_init_node: node 0, pgdat 803580f0, node_mem_map 81000000
[    0.000000]   Normal zone: 128 pages used for memmap
[    0.000000]   Normal zone: 0 pages reserved
[    0.000000]   Normal zone: 16384 pages, LIFO batch:3
[    0.000000] Primary instruction cache 64kB, VIPT, 4-way, linesize 32 bytes.
[    0.000000] Primary data cache 32kB, 4-way, VIPT, cache aliases, linesize 32 bytes
[    0.000000] pcpu-alloc: s0 r0 d32768 u32768 alloc=1*32768
[    0.000000] pcpu-alloc: [0] 0
[    0.000000] Built 1 zonelists in Zone order, mobility grouping on.  Total pages: 16256
[    0.000000] Kernel command line:  board=TL-WR941ND-v5  console=ttyS0,115200 rootfstype=squashfs,jffs2 noinitrd
[    0.000000] PID hash table entries: 256 (order: -2, 1024 bytes)
[    0.000000] Dentry cache hash table entries: 8192 (order: 3, 32768 bytes)
[    0.000000] Inode-cache hash table entries: 4096 (order: 2, 16384 bytes)
[    0.000000] Writing ErrCtl register=00000000
[    0.000000] Readback ErrCtl register=00000000
[    0.000000] Memory: 60944K/65536K available (2477K kernel code, 126K rwdata, 528K rodata, 252K init, 188K bss, 4592K reserved)
[    0.000000] SLUB: HWalign=32, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
[    0.000000] NR_IRQS:51
[    0.000000] Clocks: CPU:535.000MHz, DDR:400.000MHz, AHB:200.000MHz, Ref:25.000MHz
[    0.000000] Calibrating delay loop... 266.64 BogoMIPS (lpj=1333248)
[    0.080000] pid_max: default: 32768 minimum: 301
[    0.080000] Mount-cache hash table entries: 1024 (order: 0, 4096 bytes)
[    0.090000] Mountpoint-cache hash table entries: 1024 (order: 0, 4096 bytes)
[    0.100000] NET: Registered protocol family 16
[    0.100000] MIPS: machine is TP-LINK TL-WR941N/ND v5
[    0.560000] Switched to clocksource MIPS
[    0.560000] NET: Registered protocol family 2
[    0.570000] TCP established hash table entries: 1024 (order: 0, 4096 bytes)
[    0.570000] TCP bind hash table entries: 1024 (order: 0, 4096 bytes)
[    0.580000] TCP: Hash tables configured (established 1024 bind 1024)
[    0.580000] TCP: reno registered
[    0.590000] UDP hash table entries: 256 (order: 0, 4096 bytes)
[    0.590000] UDP-Lite hash table entries: 256 (order: 0, 4096 bytes)
[    0.600000] NET: Registered protocol family 1
[    0.600000] PCI: CLS 0 bytes, default 32
[    0.600000] futex hash table entries: 256 (order: -1, 3072 bytes)
[    0.620000] squashfs: version 4.0 (2009/01/31) Phillip Lougher
[    0.620000] jffs2: version 2.2 (NAND) (SUMMARY) (LZMA) (RTIME) (CMODE_PRIORITY) (c) 2001-2006 Red Hat, Inc.
[    0.630000] msgmni has been set to 119
[    0.650000] io scheduler noop registered
[    0.650000] io scheduler deadline registered (default)
[    0.660000] Serial: 8250/16550 driver, 1 ports, IRQ sharing disabled
[    0.660000] console [ttyS0] disabled
[    0.690000] serial8250.0: ttyS0 at MMIO 0x18020000 (irq = 11, base_baud = 1562500) is a 16550A
[    0.700000] console [ttyS0] enabled
[    0.700000] bootconsole [early0] disabled
[    0.710000] m25p80 spi0.0: found mx25l3205d, expected m25p80
[    0.720000] m25p80 spi0.0: mx25l3205d (4096 Kbytes)
[    0.730000] 5 tp-link partitions found on MTD device spi0.0
[    0.730000] Creating 5 MTD partitions on "spi0.0":
[    0.740000] 0x000000000000-0x000000020000 : "u-boot"
[    0.740000] 0x000000020000-0x0000001356e4 : "kernel"
[    0.750000] 0x0000001356e4-0x0000003f0000 : "rootfs"
[    0.750000] mtd: device 2 (rootfs) set to be root filesystem
[    0.760000] 1 squashfs-split partitions found on MTD device rootfs
[    0.770000] 0x000000310000-0x0000003f0000 : "rootfs_data"
[    0.770000] 0x0000003f0000-0x000000400000 : "art"
[    0.780000] 0x000000020000-0x0000003f0000 : "firmware"
[    0.800000] libphy: ag71xx_mdio: probed
[    1.400000] ag71xx ag71xx.0: connected to PHY at ag71xx-mdio.1:00 [uid=004dd042, driver=Generic PHY]
[    1.410000] eth0: Atheros AG71xx at 0xb9000000, irq 4, mode:MII
[    2.000000] ag71xx-mdio.1: Found an AR934X built-in switch
[    2.040000] eth1: Atheros AG71xx at 0xba000000, irq 5, mode:GMII
[    2.050000] TCP: cubic registered
[    2.050000] NET: Registered protocol family 17
[    2.060000] bridge: automatic filtering via arp/ip/ip6tables has been deprecated. Update your scripts to load br_netfilter if you need this.
[    2.070000] 8021q: 802.1Q VLAN Support v1.8
[    2.080000] VFS: Mounted root (squashfs filesystem) readonly on device 31:2.
[    2.090000] Freeing unused kernel memory: 252K (80371000 - 803b0000)
[    3.140000] init: Console is alive
[    3.140000] init: - watchdog -
[    4.370000] usbcore: registered new interface driver usbfs
[    4.370000] usbcore: registered new interface driver hub
[    4.380000] usbcore: registered new device driver usb
[    4.390000] ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
[    4.400000] ehci-platform: EHCI generic platform driver
[    5.200000] init: - preinit -
[    5.860000] random: procd urandom read with 9 bits of entropy available
[    8.990000] mount_root: jffs2 not ready yet, using temporary tmpfs overlay
[    9.040000] procd: - early -
[    9.050000] procd: - watchdog -
[    9.700000] procd: - ubus -
[   10.720000] procd: - init -
[   11.560000] NET: Registered protocol family 10
[   11.580000] ip6_tables: (C) 2000-2006 Netfilter Core Team
[   11.590000] Loading modules backported from Linux version master-2015-03-09-0-g141f155
[   11.600000] Backport generated by backports.git backports-20150129-0-gdd4a670
[   11.610000] ip_tables: (C) 2000-2006 Netfilter Core Team
[   11.630000] nf_conntrack version 0.5.0 (956 buckets, 3824 max)
[   11.670000] xt_time: kernel timezone is -0000
[   11.710000] cfg80211: Calling CRDA to update world regulatory domain
[   11.710000] cfg80211: World regulatory domain updated:
[   11.720000] cfg80211:  DFS Master region: unset
[   11.720000] cfg80211:   (start_freq - end_freq @ bandwidth), (max_antenna_gain, max_eirp), (dfs_cac_time)
[   11.730000] cfg80211:   (2402000 KHz - 2472000 KHz @ 40000 KHz), (N/A, 2000 mBm), (N/A)
[   11.740000] cfg80211:   (2457000 KHz - 2482000 KHz @ 20000 KHz, 92000 KHz AUTO), (N/A, 2000 mBm), (N/A)
[   11.750000] cfg80211:   (2474000 KHz - 2494000 KHz @ 20000 KHz), (N/A, 2000 mBm), (N/A)
[   11.760000] cfg80211:   (5170000 KHz - 5250000 KHz @ 80000 KHz, 160000 KHz AUTO), (N/A, 2000 mBm), (N/A)
[   11.770000] cfg80211:   (5250000 KHz - 5330000 KHz @ 80000 KHz, 160000 KHz AUTO), (N/A, 2000 mBm), (0 s)
[   11.780000] cfg80211:   (5490000 KHz - 5730000 KHz @ 160000 KHz), (N/A, 2000 mBm), (0 s)
[   11.790000] cfg80211:   (5735000 KHz - 5835000 KHz @ 80000 KHz), (N/A, 2000 mBm), (N/A)
[   11.800000] cfg80211:   (57240000 KHz - 63720000 KHz @ 2160000 KHz), (N/A, 0 mBm), (N/A)
[   11.880000] PPP generic driver version 2.4.2
[   11.890000] NET: Registered protocol family 24
[   11.950000] ath: EEPROM regdomain: 0x0
[   11.950000] ath: EEPROM indicates default country code should be used
[   11.950000] ath: doing EEPROM country->regdmn map search
[   11.950000] ath: country maps to regdmn code: 0x3a
[   11.950000] ath: Country alpha2 being used: US
[   11.950000] ath: Regpair used: 0x3a
[   11.970000] ieee80211 phy0: Selected rate control algorithm 'minstrel_ht'
[   11.970000] ieee80211 phy0: Atheros AR9340 Rev:1 mem=0xb8100000, irq=47
[   11.990000] cfg80211: Calling CRDA for country: US
[   11.990000] cfg80211: Regulatory domain changed to country: US
[   12.000000] cfg80211:  DFS Master region: FCC
[   12.000000] cfg80211:   (start_freq - end_freq @ bandwidth), (max_antenna_gain, max_eirp), (dfs_cac_time)
[   12.010000] cfg80211:   (2402000 KHz - 2472000 KHz @ 40000 KHz), (N/A, 3000 mBm), (N/A)
[   12.020000] cfg80211:   (5170000 KHz - 5250000 KHz @ 80000 KHz, 160000 KHz AUTO), (N/A, 2300 mBm), (N/A)
[   12.030000] cfg80211:   (5250000 KHz - 5330000 KHz @ 80000 KHz, 160000 KHz AUTO), (N/A, 2300 mBm), (0 s)
[   12.040000] cfg80211:   (5490000 KHz - 5730000 KHz @ 160000 KHz), (N/A, 2300 mBm), (0 s)
[   12.050000] cfg80211:   (5735000 KHz - 5835000 KHz @ 80000 KHz), (N/A, 3000 mBm), (N/A)
[   12.060000] cfg80211:   (57240000 KHz - 63720000 KHz @ 2160000 KHz), (N/A, 4000 mBm), (N/A)
[   19.130000] jffs2_scan_eraseblock(): End of filesystem marker found at 0x0
[   19.140000] jffs2_build_filesystem(): unlocking the mtd device... done.
[   19.150000] jffs2_build_filesystem(): erasing all blocks after the end marker...
[   22.980000] device eth1 entered promiscuous mode
[[   23.040000] br-lan: port 1(eth1) entered forwarding state
[   23.040000] br-lan: port 1(eth1) entered forwarding state
[   23.090000] IPv6: ADDRCONF(NETDEV_UP): eth0: link is not ready
[   23.910000] br-lan: port 1(eth1) entered disabled state
[   25.150000] eth1: link up (1000Mbps/Full duplex)
[   25.150000] br-lan: port 1(eth1) entered forwarding state
[   25.160000] br-lan: port 1(eth1) entered forwarding state
[   25.210000] done.
[   25.210000] jffs2: notice: (905) jffs2_build_xattr_subsystem: complete building xattr subsystem, 0 of xdatum (0 unchecked, 0 orphan) and 0 of xref (0 dead, 0 orphan) found.
[   27.160000] br-lan: port 1(eth1) entered forwarding state

16

Re: [SOLVE] USB Mod on TLWR941v5 (TL-WR940v2)

OK, I see this now: one simple change is necessary in /target/linux/ar71xx/files/arch/mips/ath79/mach-tl-wr841n-v8.c
in line 283 (after the ath79_register_gpio_keys_polled block), you need to insert the line

ath79_register_usb();

The changes I mentioned earlier for /target/linux/ar71xx/files/arch/mips/ath79/mach-tl-wr941nd.c are unnecessary (you can revert them). The other changes and the patch are however needed.

17 (edited by dktn 2017-02-20 04:19:51)

Re: [SOLVE] USB Mod on TLWR941v5 (TL-WR940v2)

Please tell me step by step compile firmware
- down load soure code 15.01.1: https://github.com/openwrt/openwrt/arch … 5.1.tar.gz
-run command: ./scripts/feeds update -a
                        ./scripts/feeds install -a
-go to In /target/linux/ar71xx/generic/profiles/tp-link.mk find section:

define Profile/TLWR941
    NAME:=TP-LINK TL-WR941N/ND
    PACKAGES:=
endef

and insert line:

    PACKAGES:=kmod-usb-core kmod-usb2

-go  in /target/linux/ar71xx/files/arch/mips/ath79/mach-tl-wr941n-v5.c
insert line ath79_register_usb();
after  ath79_register_gpio_keys_polled block

please tell me path  /target/linux/ar71xx/files/arch/mips/ath79/mach-tl-wr841n-v8.c or  /target/linux/ar71xx/files/arch/mips/ath79/mach-tl-wr941n-v5.c and in  /target/linux/ar71xx/files/arch/mips/ath79/mach-tl-wr941n-v5.c I can not find some words

ath79_register_gpio_keys_polled block

and it has:

ath79_register_gpio_keys_polled(-1, TL_WR941ND_KEYS_POLL_INTERVAL,
                    ARRAY_SIZE(tl_wr941nd_gpio_keys),
                    tl_wr941nd_gpio_keys);

- copy file 801-MIPS-ath79-add-wr941-usb.patch to directoy /target/linux/ar71xx/patches-3.18
- run make menuconfig
and then i select TLWR940, Block-mount, kmod-usb2, kmod-ext4, kmod-usb-storage.
- run command: make

18

Re: [SOLVE] USB Mod on TLWR941v5 (TL-WR940v2)

- download soure code 15.01.1: https://github.com/openwrt/openwrt/arch … 5.1.tar.gz
- go to In /target/linux/ar71xx/generic/profiles/tp-link.mk find section:

define Profile/TLWR941
    NAME:=TP-LINK TL-WR941N/ND
    PACKAGES:=
endef

and change line to:

    PACKAGES:=kmod-usb-core kmod-usb2 

- go  in /target/linux/ar71xx/files/arch/mips/ath79/mach-tl-wr841n-v8.c (yes, I mean WR841, V8)
insert line

ath79_register_usb();

after

ath79_register_gpio_keys_polled(-1, TL_WR941ND_KEYS_POLL_INTERVAL,
                    ARRAY_SIZE(tl_wr941nd_gpio_keys),
                    tl_wr941nd_gpio_keys);

(should be line number 283)
- copy file 801-MIPS-ath79-add-wr941-usb.patch to directory /target/linux/ar71xx/patches-3.18

- run commands:

./scripts/feeds update -a
./scripts/feeds install -a
make menuconfig

- select TLWR941, Block-mount, kmod-usb2, kmod-ext4, kmod-usb-storage.
- run command:

make

I uploaded another image with the latest changes, so it hopefully provides basic USB support.

19 (edited by dktn 2017-04-18 15:23:54)

Re: [SOLVE] USB Mod on TLWR941v5 (TL-WR940v2)

I flashed your firmware to my router TL-WR941v5 and files dmesg

[    1.400000] ag71xx ag71xx.0: connected to PHY at ag71xx-mdio.1:00 [uid=004dd0                         42, driver=Generic PHY]
[    1.410000] eth0: Atheros AG71xx at 0xb9000000, irq 4, mode:MII
[    2.000000] ag71xx-mdio.1: Found an AR934X built-in switch
[    2.040000] eth1: Atheros AG71xx at 0xba000000, irq 5, mode:GMII
[    2.050000] TCP: cubic registered
[    2.050000] NET: Registered protocol family 17
[    2.060000] bridge: automatic filtering via arp/ip/ip6tables has been depreca                         ted. Update your scripts to load br_netfilter if you need this.
[    2.070000] 8021q: 802.1Q VLAN Support v1.8
[    2.080000] VFS: Mounted root (squashfs filesystem) readonly on device 31:2.
[    2.090000] Freeing unused kernel memory: 248K (80382000 - 803c0000)
[    3.190000] init: Console is alive
[    3.200000] init: - watchdog -
[    4.940000] usbcore: registered new interface driver usbfs
[    4.950000] usbcore: registered new interface driver hub
[    4.950000] usbcore: registered new device driver usb
[    5.000000] SCSI subsystem initialized
[    5.010000] ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
[    5.020000] ehci-platform: EHCI generic platform driver
[    5.030000] ehci-platform ehci-platform: EHCI Host Controller
[    5.030000] ehci-platform ehci-platform: new USB bus registered, assigned bus                          number 1
[    5.040000] ehci-platform ehci-platform: irq 3, io mem 0x1b000000
[    5.070000] ehci-platform ehci-platform: USB 2.0 started, EHCI 1.00
[[    5.070000] hub 1-0:1.0: USB hub found
[    5.080000] hub 1-0:1.0: 1 port detected
[    5.080000] ohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driver
[    5.090000] ohci-platform: OHCI generic platform driver
[    5.100000] usbcore: registered new interface driver usb-storage
[    5.200000] init: - preinit -
[    5.610000] usb 1-1: new high-speed USB device number 2 using ehci-platform
[    5.760000] random: procd urandom read with 9 bits of entropy availabe

it means your firmware works with USB port.
After try to "build image" many times(before used UNBUNTU) not ok, yesterday I change to" linuxmint" to rebuild. When follows #18 above change some files when I rebuild it return with error like this

make[3] -C package/kernel/linux compile
make[3] -C package/libs/ocf-crypto-headers compile
make[3] -C package/libs/openssl compile
make -r world: build failed. Please re-run make with -j1 V=s to see what's going on
/home/huy/Downloads/945usb/openwrt-15.05.1/include/toplevel.mk:181: recipe for target 'world' failed
make: *** [world] Error 1
huy-System-Product-Name openwrt-15.05.1 #

if I used original file and not modify file. I buildroot ok then i modify some file and the result not ok.
is there any way to make image in LINUXMINT ? maybe I return UNBUNTU opearating.

I would like to put my file own "ftasb" in /etc/config/fstab in firmware? Is there any way to do?

20

Re: [SOLVE] USB Mod on TLWR941v5 (TL-WR940v2)

As it says, you would have to append parameters "-j1 V=s" to make, to find the reason for the build error. I had some major troubles on my working machine with a very up to date Linux, so I ended up installing a Debian 8.7.1 in a virtual machine, which was building fine.

Re: [SOLVE] USB Mod on TLWR941v5 (TL-WR940v2)

Thank you so much to help me.
I try run command make -j1 V=s but not OK
I am going to install debian to build firmware.
please tell me is there any way to put some file to directory "config" (/etc/config/fstab) of firmware together build firmware?

22

Re: [SOLVE] USB Mod on TLWR941v5 (TL-WR940v2)

You can put your custom files in /target/linux/ar71xx/base-files/ so they will be included in your firmware image.
But it is also quite easy to edit such a file when logged into your router.

23 (edited by dktn 2017-02-22 03:33:19)

Re: [SOLVE] USB Mod on TLWR941v5 (TL-WR940v2)

- Does this patch(801-MIPS-ath79-add-wr941-usb.patch) work for TL-WR841, TL-WR741?
or every router we need another patch?
- In menuconfig there is package luci-app-xupnpd but i only need xupnpd for small memory flash, how to do it?

24

Re: [SOLVE] USB Mod on TLWR941v5 (TL-WR940v2)

dktn wrote:

- Does this patch(801-MIPS-ath79-add-wr941-usb.patch) work for TL-WR841, TL-WR741?
or every router we need another patch?

This is specific to the WR941, for other models, you need similar patches (which add that USB configuration symbol).

dktn wrote:

- In menuconfig there is package luci-app-xupnpd but i only need xupnpd for small memory flash, how to do it?

On a quick look, I just found xupnpd in Multimedia, but not that mentioned luci-app-xupnpd. It seems possible to achieve your intention. But that also goes a bit off topic of this thread and this section of the forum.

25 (edited by dktn 2017-02-23 07:48:15)

Re: [SOLVE] USB Mod on TLWR941v5 (TL-WR940v2)

Thank you very much MBS.
you help me so much.
My TL- WR941v5 mod USB work well now.