Monday, June 6, 2011

Linux TFTP

The user's home directory is the root for TFTP file transfers on Debian based distros (at the very least).

put firmware.chk is the same as put /home/brad/firmware.chk

That is so long as your username is brad-- which mine is.

The Netgear WNR-3500L with DD-WRT and Optware

While I was digging around getting my printer connected to my router via USB to work I stumbled on the holy grail.

 Just as a reminder to myself, now the router handles phone calls.


This thing just made itself the smaller business telecommunications answer. It will now handle data and voice with a sufficient connection.

Keywords are Optware and Asterisk in this case.

USB Printing - Netgear WNR3500L

I had previously turned on all of my USB features in Services > USB


Core USB Support                X Enable  0 Disable
USB 1.1 Support (UHCI)          X Enable  0 Disable
USB 1.1 Support (OHCI)          X Enable  0 Disable
USB 2.0 Support                 X Enable  0 Disable
USB Printer Support             X Enable  0 Disable
USB Storage Support             X Enable  0 Disable
ext2 / ext3 File System Support X Enable  0 Disable
FAT File System Support         X Enable  0 Disable
Automatic Drive Mount           X Enable  0 Disable
Run-on-mount Script Name
Disk Mount Point                /mnt

Turn on SSH in your router Services > Services > Secure Shell


SSHd                            X Enable  0 Disable
SSH TCP Forwarding              X Enable  0 Disable
Password Login                  X Enable  0 Disable
Port                            22                      (Default: 22) 

In Administration > Management enable JFFS2 apply and reboot


JFFS2                           X Enable  0 Disable
Clean JFFS2                     X Enable  0 Disable 

Verify the settings are correct upon reboot


JFFS2 under Administration > Management > JFFS2 Support will be different
It needs cleared and formatted only once, and the system changes these settings for you

JFFS2                           X Enable  0 Disable
Clean JFFS2                     0 Enable  X Disable 

Plug the USB cable of your printer into the router


Yeah that's all, you can do it!

Log In to your router via SSH


Your IP will likely be 192.168.1.1
If it isn't it can be found in the web interface at Setup > Basic Setup > Router IP and you should adjust the following instructions accordingly

brad@laptop:~$ ssh root@192.168.1.1
Release: 08/07/10 (SVN revision: 14896)
root@192.168.1.1's password: WEB GUI PASSWORD

Welcome to the Linux command line of DD-WRT courtesy of BusyBox

See if your printer is already hooked up and recognized -- mine wasn't


Bummer, the lsusb command is not available by default

root@DD-WRT:/# lsusb
-sh: lsusb: not found

Supposedly if the /dev/usb directory is empty you have to create the printer object

root@DD-WRT:/# mknod -m 660 /dev/usb/lp0 c 180 0

Verify that the daemon is not running -- mine was not running the daemon


I got this output
root@DD-WRT:~# ps | grep 910
 4964 root      1532 S    grep 910 

Hopefully you will get output like this and you get to skip a few steps.

root@DD-WRT:~# ps | grep 910
  980 root      1108 S    /jffs/usr/sbin/p9100d 
 4964 root      1532 S    grep 910 

Download and install the package for USB printing


root@DD-WRT:/jffs# wget http://downloads.openwrt.org/snapshots/trunk/brcm-2.4/packages/p910nd_0.93-1_brcm-2.4.ipk
No longer available, 'boo' to openwrt.org for breaking their resource links... *Note to self* the new file is on my file server here for me. --Because you cannot count on things to persist on the web.
root@DD-WRT:/jffs# wget http://downloads.openwrt.org/snapshots/trunk/brcm47xx/packages/p910nd_0.95-2_brcm47xx.ipk
 
root@DD-WRT:/jffs# ipkg p910nd_0.95-2_brcm47xx.ipk
root@DD-WRT:/jffs# ipkg update
 
This is where I encountered my first error as OpenWRT no longer hosts the updates for the packages of my router firmware. 
 
root@DD-WRT:/jffs#wget http://www.bradchesney.net/downloads/p910nd_0.95-1_brcm-2.4.ipk -O - | tr -d '\r' > /tmp/p910nd_0.95-1_brcm-2.4.ipk
root@DD-WRT:/jffs#cp /tmp/p910nd_0.95-1_brcm-2.4.ipk /jffs
root@DD-WRT:/jffs#cd /jffs
root@DD-WRT:/jffs#ipkg install p910nd_0.95-1_brcm-2.4.ipk
 
And this is where the game stopped for me. Sadness. Maybe I will dig into the files and fix the errors, but I am a busy guy lately.

Recommended method to start the daemon-- didn't work for me


root@DD-WRT:/jffs# /jffs/etc/init.d/p910nd start

Alternatively start the daemon this way


root@DD-WRT:/jffs# /jffs/usr/sbin/p910nd

Copy these lines:

/bin/mknod -m 660 /dev/usb/lp0 c 180 0
/bin/mkdir -m 755 -p /dev/usb
/jffs/usr/sbin/p910nd -b -f /dev/usb/lp0 0

into the Administration > Commands > Command Shell then click the Save Startup button and reboot

Accessing the printer from a computer


The IP will likely be 192.168.1.1 on port 9100 according to my instructions

That is 192.168.1.1:9100 depending on how you are entering your settings

Followers