Support for D-Link DIR842 (Rev C3)

No, you still need to flash via the recovery, a PR to introduce the encrypted factory image format to OpenWrt has been open for 1 1/2 years, meanwhile I'm not updating that anymore (might as well close it). But you could use my image from post #93 above, and then flash the latest sysupgrade from there. That should save you from the hassle of flashing via recovery (which does not work well with latest browsers, and may need multiple attempts).

Thanks for the quick reply. So I install first http://sebastianschaper.net/openwrt/openwrt-ath79-generic-dlink_dir-842-c3-squashfs-factory.bin and then https://downloads.openwrt.org/releases/21.02.1/targets/ath79/generic/openwrt-21.02.1-ath79-generic-dlink_dir-842-c3-squashfs-sysupgrade.bin or https://downloads.openwrt.org/snapshots/targets/ath79/generic/openwrt-ath79-generic-dlink_dir-842-c3-squashfs-sysupgrade.bin? The sysupgrade can be installed from the web GUI or it's gonna be through SSH? Sorry for the dumb questions.

Also I've been reading of some issues with 5GHz Wi-fi, has it been fixed on the latest 21.02.1 OpenWRT firmware or it needs some manual intervention?

Thanks again.

Excactly, my image comes with the LuCI Web GUI, so you can flash the sysupgrade conveniently from there. OpenWrt snapshot does not have a Web UI by default (but you can install LuCI via SSH). 5 GHz issue is fixed in snapshots, not sure if it was already in v21.02.1. But this only affects certain (newer) batches of devices, so I'd recommend to go for stable v21 first, and only update to snapshot if 5GHz does not work.

2 Likes

Well, I have got a used DIR 842 C1. After noticing initiation of USB in system log, I was hoping to just solder a USB receptacle. Turns out there are missing components in board for signal line. Any suggestions on adding USB to this? Maybe through serial lines or something...?

To use USB on ath79, you just need to add two series resistors of 22 Ohms, this would be R111 and R110 on the PCB.
The remaining components are intended for the 12V to 5V step-down converter to generate the USB supply voltage (the router itself only needs 3.3V, so they don't populate it when USB is not used), but it's near to impossible to re-use the PCB for adding a regulator, you would need to find the exact values for all components etc., so your best bet is to just to get a cheap 12V to 5V step-down converter, e.g.

DC DC 3A Buck Step down Power Supply Module MP1584EN 5V 12V 24V zu 5V 3,3 V 9V 12V Feste Ausgangs für Arduino Ersetzen LM2596| | - AliExpress

The 5V output goes to Pin 1 of the USB receptacle, 3 Amps should be enough even for a USB harddisk (I would recommend to add a huge capacitor at C242) :slightly_smiling_face:
But keep in mind you might also need a stronger 12V supply depending on what you plan to attach, the router uses a 3.5 x 1.35 mm plug.

1 Like

Heck how did I miss to realize this! Thanks a ton mate. I should already be having some 7805IC lying around

Also the D-Link OE Power adapter is rated at 12v @ 1.5A, hence it could support 5v DC-DC for additional USB power I guess
Interesting mod to attempt in future. Thanks again!

1 Like

Thats done! USB added to DIR-842 C1
Hope this mod could be added to https://openwrt.org/toh/d-link/dir-842

Sat Dec 31 00:56:32 2022 user.info kernel: [    4.077801] kmodloader: loading kernel modules from /etc/modules-boot.d/*
Sat Dec 31 00:56:32 2022 kern.info kernel: [    4.128345] usbcore: registered new interface driver usbfs
Sat Dec 31 00:56:32 2022 kern.info kernel: [    4.134119] usbcore: registered new interface driver hub
Sat Dec 31 00:56:32 2022 kern.info kernel: [    4.139698] usbcore: registered new device driver usb
Sat Dec 31 00:56:32 2022 kern.info kernel: [    4.152667] ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
Sat Dec 31 00:56:32 2022 kern.info kernel: [    4.162168] ehci-fsl: Freescale EHCI Host controller driver
Sat Dec 31 00:56:32 2022 kern.info kernel: [    4.169504] ehci-platform: EHCI generic platform driver
Sat Dec 31 00:56:32 2022 kern.info kernel: [    4.175300] ehci-platform 1b000000.usb: EHCI Host Controller
Sat Dec 31 00:56:32 2022 kern.info kernel: [    4.181213] ehci-platform 1b000000.usb: new USB bus registered, assigned bus number 1
Sat Dec 31 00:56:32 2022 kern.info kernel: [    4.189431] ehci-platform 1b000000.usb: irq 13, io mem 0x1b000000
Sat Dec 31 00:56:32 2022 kern.info kernel: [    4.220889] ehci-platform 1b000000.usb: USB 2.0 started, EHCI 1.00
Sat Dec 31 00:56:32 2022 kern.info kernel: [    4.228124] hub 1-0:1.0: USB hub found
Sat Dec 31 00:56:32 2022 kern.info kernel: [    4.232787] hub 1-0:1.0: 1 port detected
Sat Dec 31 00:56:32 2022 user.info kernel: [    4.240232] kmodloader: done loading kernel modules from /etc/modules-boot.d/*
Sat Dec 31 00:56:32 2022 user.info kernel: [    4.258685] init: - preinit -
Sat Dec 31 00:56:32 2022 kern.info kernel: [    4.561096] usb 1-1: new high-speed USB device number 2 using ehci-platform
Sat Dec 31 00:56:32 2022 kern.notice kernel: [    5.071363] random: procd: uninitialized urandom read (4 bytes read)
Sat Dec 31 00:56:32 2022 kern.notice kernel: [    5.447736] random: jshn: uninitialized urandom read (4 bytes read)
Sat Dec 31 00:56:32 2022 kern.notice kernel: [    5.686933] random: jshn: uninitialized urandom read (4 bytes read)
Sat Dec 31 00:56:32 2022 kern.notice kernel: [    6.084290] random: jshn: uninitialized urandom read (4 bytes read)
Sat Dec 31 00:56:32 2022 kern.notice kernel: [    6.210250] random: jshn: uninitialized urandom read (4 bytes read)
Sat Dec 31 00:56:32 2022 kern.notice kernel: [    6.270412] random: jshn: uninitialized urandom read (4 bytes read)
Sat Dec 31 00:56:32 2022 kern.info kernel: [    7.433834] eth0: link up (1000Mbps/Full duplex)
Sat Dec 31 00:56:32 2022 kern.info kernel: [    7.438641] IPv6: ADDRCONF(NETDEV_CHANGE): eth0: link becomes ready
Sat Dec 31 00:56:32 2022 kern.info kernel: [    7.457808] IPv6: ADDRCONF(NETDEV_CHANGE): eth0.1: link becomes ready
Sat Dec 31 00:56:32 2022 kern.notice kernel: [   11.902950] jffs2: notice: (560) jffs2_build_xattr_subsystem: complete building xattr subsystem, 130 of xdatum (78 unchecked, 52 orphan) and 178 of xref (30 dead, 28 orphan) found.
Sat Dec 31 00:56:32 2022 user.info kernel: [   11.930434] mount_root: loading kmods from internal overlay
Sat Dec 31 00:56:32 2022 user.info kernel: [   12.303758] kmodloader: loading kernel modules from /tmp/overlay/upper/etc/modules-boot.d/*
Sat Dec 31 00:56:32 2022 kern.notice kernel: [   12.727297] SCSI subsystem initialized
Sat Dec 31 00:56:32 2022 kern.info kernel: [   12.861627] usb-storage 1-1:1.0: USB Mass Storage device detected
Sat Dec 31 00:56:32 2022 kern.info kernel: [   12.868417] usb-storage 1-1:1.0: Quirks match for vid 054c pid 02a5: 80000
Sat Dec 31 00:56:32 2022 kern.info kernel: [   12.876738] scsi host0: usb-storage 1-1:1.0
Sat Dec 31 00:56:32 2022 kern.info kernel: [   12.881663] usbcore: registered new interface driver usb-storage
Sat Dec 31 00:56:32 2022 kern.info kernel: [   12.895177] usbcore: registered new interface driver uas

root@OpenWrt:~# lsusb -t
/: Bus 01.Port 1: Dev 1, Class=root_hub, Driver=ehci-platform/1p, 480M
|__ Port 1: Dev 2, If 0, Class=, Driver=usb-storage, 480M
root@OpenWrt:~# ls -al /dev/sd*
brw------- 1 root root 8, 0 Jan 1 1970 /dev/sda
brw------- 1 root root 8, 1 Jan 1 1970 /dev/sda1

1 Like

Awesome :slightly_smiling_face:

Feel free to document this in the wiki, pictures for specific routers are always appreciated.
I think self-registration in the wiki was disabled due to spambots creating tons of accounts, but you can quickly request a wiki account via the forum, the link is at the bottom of the wiki login page.
Technically the procedure is the same for all ath79 routers, some time ago I even saw a thread on a Chinese forum where someone grinded the black plastic from the SoC to solder thin copper wires for the data lines directly to the pin inside the chip package :innocent: Always wanted to try that on a device someday, at least the microscope is ready...

1 Like


Happy New Year 2023 and it begin like this to me..

Added a LM2596 based DC DC converter which allows output upto 3A. But later found out 2.5" USB HDD Max tales 0.6A @ 5v which could hardly strain the stock power supply..
Now I'm getting some EHCI mounting issue on HDD but for non power hungry flash drives, it works great


[   13.378176] block: extroot: not configured
[   13.364337] block: attempting to load /tmp/jffs_cfg/upper/etc/config/fstab
[   12.988265] kmodloader: done loading kernel modules from /tmp/overlay/upper/etc/modules-boot.d/*
[   12.981435] usbcore: registered new interface driver uas
[   12.968928] usbcore: registered new interface driver usb-storage
[   12.937940] uhci_hcd: USB Universal Host Controller Interface driver
[   12.919013] ohci-platform: OHCI generic platform driver
[   12.911160] ohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driver
[   12.868000] SCSI subsystem initialized
[   12.438697] kmodloader: loading kernel modules from /tmp/overlay/upper/etc/modules-boot.d/*
[   11.922437] mount_root: loading kmods from internaloverlay
[   11.894445] jffs2: notice: (557) jffs2_build_xattr_subsystem: complete building xattr subsystem, 64 of xdatum (48 unchecked, 16 orphan) and 99 of xref (19 dead, 6 orphan) found.
[    7.996953] usb usb1-port1: unable to enumerate USB device
[    7.990866] usb 1-1: device not accepting address 5, error -71
[    7.460967] usb 1-1: new full-speed USB device number 5 using ehci-platform
[    7.300944] usb 1-1: device not accepting address 4, error -71
[    6.800870] usb 1-1: new full-speed USB device number 4 using ehci-platform
[    6.261023] usb usb1-port1: attempt power cycle
[    6.143909] usb 1-1: device descriptor read/64, error -71
[    5.968599] random: jshn: uninitialized urandom read (4 bytes read)
[    5.771145] usb 1-1: device descriptor read/64, error -71
[    5.610215] random: jshn: uninitialized urandom read (4 bytes read)
[    5.521057] usb 1-1: new full-speed USB device number 3 using ehci-platform
[    5.451121] random: jshn: uninitialized urandom read (4 bytes read)
[    5.250964] usb 1-1: device descriptor read/64, error -71
[    4.851058] usb 1-1: device descriptor read/64, error -71
[    4.561084] usb 1-1: new full-speed USB device number 2 using ehci-platform
[    4.258673] init: - preinit -
[    4.240210] kmodloader: done loading kernel modules from /etc/modules-boot.d/*
[    4.232777] hub 1-0:1.0: 1 port detected
[    4.228110] hub 1-0:1.0: USB hub found
[    4.220885] ehci-platform 1b000000.usb: USB 2.0 started, EHCI 1.00
[    4.189331] ehci-platform 1b000000.usb: irq 13, io mem 0x1b000000
[    4.181115] ehci-platform 1b000000.usb: new USB bus registered, assigned bus number 1
[    4.175202] ehci-platform 1b000000.usb: EHCI Host Controller
[    4.169403] ehci-platform: EHCI generic platform driver
[    4.162070] ehci-fsl: Freescale EHCI Host controller driver
[    4.152583] ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
[    4.139617] usbcore: registered new device driver usb

That's curious, most information I could find about the message device not accepting address are mainly reporting hardware issues, e.g. damaged ports of the host controller.

What does your wiring look like exactly, is power + data running through the same cable, which is directly connected to the port on the PCB? e.g. using one half of a USB extension cable, this cable is usually twisted, similar to ethernet, as USB uses differential signalling. Keep in mind you are dealing with hundreds of MHz here, this is almost an RF system, with wires behaving like antennas and stuff :slightly_smiling_face:

Maybe use SMD resistors instead, or put the converter on the other side, closer to the input and the port, if there is still suficient space in the plastic case.

1 Like

Just in time, I should say.
I wanted to study this and got some time yesterday. Turns out, you also right. Having D+ and D- lines through a twisted pair wires seems to mess up with signal
I could not go with SMD (Having no expertise or cost for disposal)
I removed the unnecessary length and now, USB HDD is working great. Added HDD Idle package, However after 6 hours of having this setup left undisturbed, HDD would have been used for only30mins and rest it was on sleep

Filtering USB from kernel log dump:

[    4.128073] usbcore: registered new interface driver usbfs
[    4.133850] usbcore: registered new interface driver hub
[    4.139428] usbcore: registered new device driver usb
[    4.152254] ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
[    4.161753] ehci-fsl: Freescale EHCI Host controller driver
[    4.169083] ehci-platform: EHCI generic platform driver
[    4.174878] ehci-platform 1b000000.usb: EHCI Host Controller
[    4.180751] ehci-platform 1b000000.usb: new USB bus registered, assigned bus number 1
[    4.189004] ehci-platform 1b000000.usb: irq 13, io mem 0x1b000000
[    4.220892] ehci-platform 1b000000.usb: USB 2.0 started, EHCI 1.00
[    4.228118] hub 1-0:1.0: USB hub found
[    4.232792] hub 1-0:1.0: 1 port detected
[   12.853034] SCSI subsystem initialized
[   12.895604] ohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driver
[   12.903536] ohci-platform: OHCI generic platform driver
[   12.922990] uhci_hcd: USB Universal Host Controller Interface driver
[   13.033101] usbcore: registered new interface driver usb-storage
[   13.045740] usbcore: registered new interface driver uas
[   17.934629] ath10k 5.15 driver, optimized for CT firmware, probing pci device: 0x56.
[   17.944114] ath10k_pci 0000:00:00.0: enabling device (0000 -> 0002)
[   17.950938] ath10k_pci 0000:00:00.0: pci irq legacy oper_irq_mode 1 irq_mode 0 reset_mode 0
[   22.271040] usb 1-1: new high-speed USB device number 2 using ehci-platform
[   22.490246] scsi host0: uas
[   22.497240] scsi 0:0:0:0: Direct-Access     Seagate  BUP Slim BK      0302 PQ: 0 ANSI: 6
[   22.526226] sd 0:0:0:0: [sda] Spinning up disk...
[   23.620928] ...ready
[   25.712179] sd 0:0:0:0: [sda] 3907029167 512-byte logical blocks: (2.00 TB/1.82 TiB)
[   25.720214] sd 0:0:0:0: [sda] 2048-byte physical blocks
[   25.750992] usb 1-1: USB disconnect, device number 2
[   25.756367] sd 0:0:0:0: tag#23 uas_zap_pending 0 uas-tag 1 inflight: CMD 
[   25.763382] sd 0:0:0:0: tag#23 CDB: opcode=0x1a 1a 00 3f 00 04 00
[   25.770575] sd 0:0:0:0: [sda] Write Protect is off
[   25.775577] sd 0:0:0:0: [sda] Mode Sense: 00 00 00 00
[   25.775640] sd 0:0:0:0: [sda] Asking for cache data failed
[   25.781334] sd 0:0:0:0: [sda] Assuming drive cache: write through
[   25.787660] sd 0:0:0:0: [sda] Optimal transfer size 33553920 bytes not a multiple of physical block size (2048 bytes)
[   25.799209] sd 0:0:0:0: [sda] Read Capacity(16) failed: Result: hostbyte=0x07 driverbyte=0x00
[   25.808078] sd 0:0:0:0: [sda] Sense not available.
[   25.813086] sd 0:0:0:0: [sda] Read Capacity(10) failed: Result: hostbyte=0x07 driverbyte=0x00
[   25.821916] sd 0:0:0:0: [sda] Sense not available.
[   25.826909] sd 0:0:0:0: [sda] 0 512-byte logical blocks: (0 B/0 B)
[   25.833315] sd 0:0:0:0: [sda] 2048-byte physical blocks
[   25.838769] sd 0:0:0:0: [sda] Attached SCSI disk
[   26.230969] usb 1-1: new high-speed USB device number 3 using ehci-platform
[   26.464043] scsi host0: uas
[   26.470384] scsi 0:0:0:0: Direct-Access     Seagate  BUP Slim BK      0302 PQ: 0 ANSI: 6
[   26.496205] sd 0:0:0:0: [sda] Spinning up disk...
[   27.638489] .ready
[   27.655051] sd 0:0:0:0: [sda] 3907029167 512-byte logical blocks: (2.00 TB/1.82 TiB)
[   27.663111] sd 0:0:0:0: [sda] 4096-byte physical blocks
[   28.113441] ath10k_pci 0000:00:00.0: qca9888 hw2.0 target 0x01000000 chip_id 0x00000000 sub 0000:0000
[   28.123020] ath10k_pci 0000:00:00.0: kconfig debug 0 debugfs 1 tracing 0 dfs 1 testmode 0
[   28.142479] ath10k_pci 0000:00:00.0: firmware ver 10.4b-ct-9888-fW-13-5ae337bb1 api 5 features mfp,peer-flow-ctrl,txstatus-noack,wmi-10.x-CT,ratemask-CT,regdump-CT,txrate-CT,flush-all-CT,pingpong-CT,ch-regs-CT,nop-CT,set-special-CT,tx-rc-CT,cust-stats-CT,txrate2-CT,beacon-cb-CT,wmi-block-ack-CT,wmi-bcn-rc-CT crc32 59e741e7
[   28.359041] sd 0:0:0:0: [sda] Write Protect is off
[   28.364045] sd 0:0:0:0: [sda] Mode Sense: 4f 00 00 00
[   28.366646] sd 0:0:0:0: [sda] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA
[   28.385781] sd 0:0:0:0: [sda] Optimal transfer size 33553920 bytes not a multiple of physical block size (4096 bytes)
[   28.421920]  sda: sda1
[   28.442652] sd 0:0:0:0: [sda] Attached SCSI disk
[   28.476831] ath10k_pci 0000:00:00.0: Loading BDF type 0
[   28.491107] ath10k_pci 0000:00:00.0: board_file api 2 bmi_id 0:18 crc32 f228337a
[   30.459948] ath10k_pci 0000:00:00.0: 10.4 wmi init: vdevs: 16  peers: 48  tid: 96
[   30.467744] ath10k_pci 0000:00:00.0: msdu-desc: 2500  skid: 32
[   30.498305] ath10k_pci 0000:00:00.0: wmi print 'P 48/48 V 16 K 144 PH 176 T 186  msdu-desc: 2500  sw-crypt: 0 ct-sta: 0'
[   30.509863] ath10k_pci 0000:00:00.0: wmi print 'free: 114572 iram: 12644 sram: 29508'
[   30.745133] ath10k_pci 0000:00:00.0: htt-ver 2.2 wmi-op 6 htt-op 4 cal pre-cal-file max-sta 32 raw 0 hwcrypto 1
[   64.670118] ath10k_pci 0000:00:00.0: Firmware lacks feature flag indicating a retry limit of > 2 is OK, requested limit: 4
[   64.732510] br-lan: port 3(wlan0) entered blocking state
[   64.738037] br-lan: port 3(wlan0) entered disabled state
[   64.743875] device wlan0 entered promiscuous mode
[   65.300954] ath10k_pci 0000:00:00.0: NOTE:  Firmware DBGLOG output disabled in debug_mask: 0x10000000
[  340.308699] ath10k_pci 0000:00:00.0: Invalid VHT mcs 15 peer stats
[ 5789.221126] ath10k_pci 0000:00:00.0: htt tx: fixing invalid VHT TX rate code 0xff
[28539.724107] usb 1-1: USB disconnect, device number 3
[28539.996293] sd 0:0:0:0: [sda] Synchronizing SCSI cache
[28540.625693] sd 0:0:0:0: [sda] Synchronize Cache(10) failed: Result: hostbyte=0x07 driverbyte=0x00
[28540.985647] usb 1-1: new high-speed USB device number 4 using ehci-platform
[28541.193382] scsi host0: uas
[28541.201187] scsi 0:0:0:0: Direct-Access     Seagate  BUP Slim BK      0302 PQ: 0 ANSI: 6
[28541.218163] sd 0:0:0:0: [sda] 3907029167 512-byte logical blocks: (2.00 TB/1.82 TiB)
[28541.226268] sd 0:0:0:0: [sda] 4096-byte physical blocks
[28544.635590] sd 0:0:0:0: [sda] Write Protect is off
[28544.640685] sd 0:0:0:0: [sda] Mode Sense: 4f 00 00 00
[28544.647047] sd 0:0:0:0: [sda] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA
[28544.657301] sd 0:0:0:0: [sda] Optimal transfer size 33553920 bytes not a multiple of physical block size (4096 bytes)
[28544.687430]  sda: sda1
[28544.698184] sd 0:0:0:0: [sda] Attached SCSI disk

Now to puzzles - Should I do something about these:

  1. I think USB is reconnecting in these instance?
[   22.271040] usb 1-1: new high-speed USB device number 2 using ehci-platform
[   26.230969] usb 1-1: new high-speed USB device number 3 using ehci-platform
[28540.985647] usb 1-1: new high-speed USB device number 4 using ehci-platform
  1. Is this below thing, something to worry?
[   25.787660] sd 0:0:0:0: [sda] Optimal transfer size 33553920 bytes not a multiple of physical block size (2048 bytes)
[   25.799209] sd 0:0:0:0: [sda] Read Capacity(16) failed: Result: hostbyte=0x07 driverbyte=0x00
[   25.808078] sd 0:0:0:0: [sda] Sense not available.
[   25.813086] sd 0:0:0:0: [sda] Read Capacity(10) failed: Result: hostbyte=0x07 driverbyte=0x00
  1. Is this below thing, something to worry?

[ 64.670118] ath10k_pci 0000:00:00.0: Firmware lacks feature flag indicating a retry limit of > 2 is OK, requested limit: 4

  1. kmod-usb-ledtrig-usbport doesnt seem to work. Is there any way to indicate USB activity via existing LED configuration? (WPS light is idle)

Could you show the output of uci show system | grep wps? In the USB wiki article there is an example for a TP-Link router with USB activity displayed via LED: https://openwrt.org/docs/guide-user/base-system/led_configuration (for more details scroll down to LED triggers -> USB Device)

Regarding the others, no idea, it seems to be common to see various driver messages that are not exactly errors but could help debugging if something does not work ad expected.

What are the transfer rates you achieve with this? The CPU is probably not powerful enough to allow the full USB 2.0 speed for NAS usage (around 50 MBytes/s), but I've always wanted to have an OpenWrt-based NAS for USB drives.

1 Like
root@OpenWrt:/# uci show system | grep wps
root@OpenWrt:/#
root@OpenWrt:/#


Gives no results. Also regarding CPU, that is very true. Initially I remember seeing 15MBps but of some 4k local files I guess that should be sufficientlate 5+ MBps is average realistic speed. For streaming some 4k local files I guess it's sufficient

Could you help me solve my problem that detects the 5 GHz band on my device? I have an Archer C60 v1 and I already created an issue here.

From looking at the patch suggested (and rejected) there, someone should generate the board files for the affected devices.
Is DIR-842 also affected by this? I think it was not fully migrated to NVMEM because in OEM firmware there are different mtd layouts, and there is some script logic for finding the correct caldata (try this offset first, then another if unsuccessful).

But what do I have to do?