Manually loading USB flashdrive

Post new topic   Reply to topic    DD-WRT Forum Forum Index -> Broadcom SoC based Hardware
Author Message
ZacWolf
DD-WRT Novice


Joined: 15 Apr 2010
Posts: 35

PostPosted: Mon May 29, 2017 3:28    Post subject: Manually loading USB flashdrive Reply with quote
I'm trying to manually add all the necessary USB modules to do my own mounting (vs using the GUI). I seem to be stuck on the last step, that being having the partitions show up in the /dev folder.

Here is output when I had core/storage/automount enabled via the GUI:
Code:
Module                  Size  Used by
nf_nat_pptp             1584  0
nf_conntrack_pptp       3190  1 nf_nat_pptp
nf_nat_proto_gre         929  1 nf_nat_pptp
nf_conntrack_proto_gre     2783  1 nf_conntrack_pptp
ext4                  307071  2
jbd2                   47832  1 ext4
mbcache                 6816  1 ext4
crc16                   1060  1 ext4
jffs2                  90628  0
lzo_decompress          1764  0
lzo_compress            1892  0
lzma_decompress         8144  1 jffs2
lzma_compress          24973  1 jffs2
usb_storage            36685  3
sr_mod                 11004  0
cdrom                  24207  1 sr_mod
sd_mod                 23767  4
scsi_mod               83049  3 usb_storage,sr_mod,sd_mod
xhci_plat_hcd           2116  0
xhci_pci                2504  0
xhci_hcd               82052  2 xhci_plat_hcd,xhci_pci
ohci_pci                2155  0
ohci_hcd               15935  1 ohci_pci
ehci_pci                2826  0
ehci_hcd               32871  1 ehci_pci
usbcore               121470  9 usb_storage,xhci_plat_hcd,xhci_pci,xhci_hcd,ohci_pci,ohci_hcd,ehci_pci,ehci_hcd
usb_common              1589  1 usbcore
wl                   4246143  0
dhd                  2811645  0
igs                    10035  2 wl,dhd
emf                    13287  3 wl,dhd,igs
switch_robo             9452  0
switch_core             4866  1 switch_robo
et                     42478  0


My "startup" script:
Code:
sleep 10
kver = $(uname -r);
logger "installing kernal $kvers modules for USB"
insmod /lib/modules/$kver/usb-common.ko
insmod /lib/modules/$kver/usbcore.ko
insmod /lib/modules/$kver/ehci-hcd.ko
insmod /lib/modules/$kver/ehci-pci.ko
sleep 1
insmod /lib/modules/$kver/ohci-hcd.ko
insmod /lib/modules/$kver/ohci-pci.ko
sleep 1
insmod /lib/modules/$kver/xhci-hcd.ko
insmod /lib/modules/$kver/xhci-pci.ko
insmod /lib/modules/$kver/xhci-plat-hcd.ko
sleep 1
insmod /lib/modules/$kver/scsi_mod.ko
insmod /lib/modules/$kver/sd_mod.ko
insmod /lib/modules/$kver/cdrom.ko
insmod /lib/modules/$kver/sr_mod.ko
insmod /lib/modules/$kver/usb-storage.ko
insmod /lib/modules/$kver/crc16.ko
insmod /lib/modules/$kver/mbcache.ko
insmod /lib/modules/$kver/jbd2.ko
insmod /lib/modules/$kver/ext4.ko
sleep 1
umount /jffs
mount -t ext4 /dev/sda1 /jffs
mount -t ext4 /dev/sda2 /opt
mkswap /dev/sda3
swapon -a


This results in the following lsmod output:
Code:
Module                  Size  Used by
ext4                  307071  0
jbd2                   47832  1 ext4
mbcache                 6816  1 ext4
crc16                   1060  1 ext4
usb_storage            36685  0
sr_mod                 11004  0
cdrom                  24207  1 sr_mod
sd_mod                 23767  0
scsi_mod               83049  3 usb_storage,sr_mod,sd_mod
xhci_plat_hcd           2116  0
xhci_pci                2504  0
xhci_hcd               82052  2 xhci_plat_hcd,xhci_pci
ohci_pci                2155  0
ohci_hcd               15935  1 ohci_pci
ehci_pci                2826  0
ehci_hcd               32871  1 ehci_pci
usbcore               121470  9 usb_storage,xhci_plat_hcd,xhci_pci,xhci_hcd,ohci_pci,ohci_hcd,ehci_pci,ehci_hcd
usb_common              1589  1 usbcore
nf_nat_pptp             1584  0
nf_conntrack_pptp       3190  1 nf_nat_pptp
nf_nat_proto_gre         929  1 nf_nat_pptp
nf_conntrack_proto_gre     2783  1 nf_conntrack_pptp
jffs2                  90628  0
lzo_decompress          1764  0
lzo_compress            1892  0
lzma_decompress         8144  1 jffs2
lzma_compress          24973  1 jffs2
wl                   4246143  0
dhd                  2811645  0
igs                    10035  2 wl,dhd
emf                    13287  3 wl,dhd,igs
switch_robo             9452  0
switch_core             4866  1 switch_robo
et                     42478  0


...notice that the ext4 and usb_storage "used by" is 0.

The output from the log is:
Code:
May 28 23:11:05 router user.notice root: installing kernel modules for USB
May 28 23:11:05 router kern.info kernel: usbcore: registered new interface driver usbfs
May 28 23:11:05 router kern.info kernel: usbcore: registered new interface driver hub
May 28 23:11:05 router kern.info kernel: usbcore: registered new device driver usb
May 28 23:11:05 router kern.info kernel: ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
May 28 23:11:05 router kern.info kernel: ehci-pci: EHCI PCI platform driver
May 28 23:11:05 router kern.info kernel: ehci-pci 0000:00:0b.1: EHCI Host Controller
May 28 23:11:05 router kern.info kernel: ehci-pci 0000:00:0b.1: new USB bus registered, assigned bus number 1
May 28 23:11:05 router kern.info kernel: ehci-pci 0000:00:0b.1: irq 111, io mem 0x18021000
May 28 23:11:05 router kern.info kernel: ehci-pci 0000:00:0b.1: USB 0.0 started, EHCI 1.00
May 28 23:11:05 router kern.info kernel: hub 1-0:1.0: USB hub found
May 28 23:11:05 router kern.info kernel: hub 1-0:1.0: 2 ports detected
May 28 23:11:06 router kern.info kernel: ohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driver
May 28 23:11:06 router kern.info kernel: ohci-pci: OHCI PCI platform driver
May 28 23:11:06 router kern.info kernel: ohci-pci 0000:00:0b.0: OHCI PCI host controller
May 28 23:11:06 router kern.info kernel: ohci-pci 0000:00:0b.0: irq 111, io mem 0x18022000
May 28 23:11:06 router kern.info kernel: hub 2-0:1.0: USB hub found
May 28 23:11:06 router kern.info kernel: hub 2-0:1.0: 2 ports detected
May 28 23:11:07 router kern.info kernel: xhci_hcd 0000:00:0c.0: xHCI Host Controller
May 28 23:11:07 router kern.info kernel: xhci_hcd 0000:00:0c.0: new USB bus registered, assigned bus number 3
May 28 23:11:07 router kern.info kernel: xhci_hcd 0000:00:0c.0: hcc params 0x02501164 hci version 0x100 quirks 0x00000010
May 28 23:11:07 router kern.info kernel: hub 3-0:1.0: USB hub found
May 28 23:11:07 router kern.err kernel: hub 3-0:1.0: config failed, hub doesn't have any ports! (err -19)
May 28 23:11:07 router kern.info kernel: xhci_hcd 0000:00:0c.0: xHCI Host Controller
May 28 23:11:07 router kern.info kernel: xhci_hcd 0000:00:0c.0: new USB bus registered, assigned bus number 4
May 28 23:11:07 router kern.info kernel: usb usb4: We don't know the algorithms for LPM for this host, disabling LPM.
May 28 23:11:07 router kern.info kernel: hub 4-0:1.0: USB hub found
May 28 23:11:07 router kern.info kernel: hub 4-0:1.0: 1 port detected
May 28 23:11:08 router kern.notice kernel: SCSI subsystem initialized
May 28 23:11:08 router kern.info kernel: usbcore: registered new interface driver usb-storage


It doesn't ever seem to enumerate, i.e. the messages that looks like this when I have core/storage/automount enabled via the GUI:

Code:
May 28 23:33:17 router kern.info kernel: usb 1-2: new high-speed USB device number 2 using ehci-pci
May 28 23:33:17 router kern.info kernel: usb-storage 1-2:1.0: USB Mass Storage device detected
May 28 23:33:17 router kern.info kernel: scsi host0: usb-storage 1-2:1.0
May 28 23:33:18 router kern.notice kernel: scsi 0:0:0:0: Direct-Access Patriot Memory PMAP PQ: 0 ANSI: 0 CCS
May 28 23:33:20 router kern.notice kernel: sd 0:0:0:0: [sda] 62554112 512-byte logical blocks: (32.0 GB/29.8 GiB)
May 28 23:33:20 router kern.notice kernel: sd 0:0:0:0: [sda] Write Protect is off
May 28 23:33:20 router kern.debug kernel: sd 0:0:0:0: [sda] Mode Sense: 23 00 00 00
May 28 23:33:20 router kern.err kernel: sd 0:0:0:0: [sda] No Caching mode page found
May 28 23:33:20 router kern.err kernel: sd 0:0:0:0: [sda] Assuming drive cache: write through
May 28 23:33:20 router kern.info kernel: sda: sda1 sda2 sda3
May 28 23:33:20 router kern.notice kernel: sd 0:0:0:0: [sda] Attached SCSI removable disk
May 28 23:33:21 router kern.info kernel: Adding 2096124k swap on /dev/sda3. Priority:-1 extents:1 across:2096124k
May 28 23:33:21 router kern.info kernel: EXT4-fs (sda1): mounted filesystem with ordered data mode. Opts: (null)
May 28 23:33:21 router kern.info kernel: EXT4-fs (sda2): mounted filesystem with ordered data mode. Opts: (null)


Is there a command I'm missing to trigger the SCSI module to enumerate?

Thanks!
Sponsor
ZacWolf
DD-WRT Novice


Joined: 15 Apr 2010
Posts: 35

PostPosted: Mon May 29, 2017 19:55    Post subject: Reply with quote
As an update, I ran everything up to sd_mod.no

Code:
sleep 10
kver = $(uname -r);
logger "installing kernal $kvers modules for USB"
insmod /lib/modules/$kver/usb-common.ko
insmod /lib/modules/$kver/usbcore.ko
insmod /lib/modules/$kver/ehci-hcd.ko
insmod /lib/modules/$kver/ehci-pci.ko
#insmod /lib/modules/$kver/ohci-hcd.ko
#insmod /lib/modules/$kver/ohci-pci.ko
#insmod /lib/modules/$kver/xhci-hcd.ko
#insmod /lib/modules/$kver/xhci-pci.ko
#insmod /lib/modules/$kver/xhci-plat-hcd.ko
insmod /lib/modules/$kver/scsi_mod.ko
#insmod /lib/modules/$kver/cdrom.ko
#insmod /lib/modules/$kver/sr_mod.ko
insmod /lib/modules/$kver/usb-storage.ko


which gives me:

Code:
May 29 15:12:35 router user.notice root: installing kernal modules for USB
May 29 15:12:35 router kern.info kernel: usbcore: registered new interface driver usbfs
May 29 15:12:35 router kern.info kernel: usbcore: registered new interface driver hub
May 29 15:12:35 router kern.info kernel: usbcore: registered new device driver usb
May 29 15:12:35 router kern.info kernel: ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
May 29 15:12:35 router kern.info kernel: ehci-pci: EHCI PCI platform driver
May 29 15:12:35 router kern.info kernel: ehci-pci 0000:00:0b.1: EHCI Host Controller
May 29 15:12:35 router kern.info kernel: ehci-pci 0000:00:0b.1: new USB bus registered, assigned bus number 1
May 29 15:12:35 router kern.info kernel: ehci-pci 0000:00:0b.1: irq 111, io mem 0x18021000
May 29 15:12:35 router kern.info kernel: ehci-pci 0000:00:0b.1: USB 0.0 started, EHCI 1.00
May 29 15:12:35 router kern.info kernel: hub 1-0:1.0: USB hub found
May 29 15:12:35 router kern.info kernel: hub 1-0:1.0: 2 ports detected
May 29 15:12:35 router kern.notice kernel: SCSI subsystem initialized
May 29 15:12:35 router kern.info kernel: usbcore: registered new interface driver usb-storage


Then I login via ssh, and lsmod:
Code:
Module                  Size  Used by
usb_storage            36685  0
scsi_mod               83049  1 usb_storage
ehci_pci                2826  0
ehci_hcd               32871  1 ehci_pci
usbcore               121470  4 usb_storage,ehci_pci,ehci_hcd
usb_common              1589  1 usbcore
nf_nat_pptp             1584  0
nf_conntrack_pptp       3190  1 nf_nat_pptp
nf_nat_proto_gre         929  1 nf_nat_pptp
nf_conntrack_proto_gre     2783  1 nf_conntrack_pptp
jffs2                  90628  1
lzo_decompress          1764  0
lzo_compress            1892  0
lzma_decompress         8144  1 jffs2
lzma_compress          24973  1 jffs2
wl                   4246143  0
dhd                  2811645  0
igs                    10035  2 wl,dhd
emf                    13287  3 wl,dhd,igs
switch_robo             9452  0
switch_core             4866  1 switch_robo
et                     42478  0

Then I run:
Code:
export kver=$(uname -r)
echo $kver
4.4.67
insmod /lib/modules/$kver/sd_mod.ko

and I get nothing in return, and nothing added to syslog.

I even tried unplugging the thumb drive, then re-plug, still nothing in syslog.

This is the Netgear R8000, and at this point, neither of the USB2 or USB3 lights are on either, if that clarifies anything.

Help?
ZacWolf
DD-WRT Novice


Joined: 15 Apr 2010
Posts: 35

PostPosted: Wed May 31, 2017 13:43    Post subject: Reply with quote
I think I've tracked it down to hotplug, but I can't figure out how to run it manually. I've tried hotplug usb after loading all the drivers manually, doesn't seem to do anything.
Display posts from previous:    Page 1 of 1
Post new topic   Reply to topic    DD-WRT Forum Forum Index -> Broadcom SoC based Hardware All times are GMT

Navigation

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum