Wednesday, 12 September 2012

Gadgets: tl-wr703n

I bought one of these : totocity Chinese Handy Wi-Fi Wireless Router 150M Wifi Wi-Fi for USB 3G LAN WAN Converter with the idea of creating a MIFI wireless network to use with my tablet.
To be honest I thought it had a 3G modem, but in fact it can only make use of one via USB - never mind I have a ZTE modem and it looks like a fun device.
£21 for a tiny UNIX server with LAN + WIFI. More information here. Hardware hacks here

 

 Step 1 

"I wouldn't call this a router for the average home user."
I replaced the Chinese interface with open-wrt see instructions at Installing OpenWrt on the TL-WR703N not too hard really.

http://wiki.openwrt.org/toh/tp-link/tl-wr703n

Step 2

Getting the modem to work..

install packages :

  • kmod-usb2, 
  • kmod-usb-option, 
  • comgt, 
  • usb-modeswitch, 
  • usb-modeswitch-data  

to be continued...the boot log

Sep 12 21:04:03 OpenWrt syslog.info syslogd started: BusyBox v1.19.4
Sep 12 21:04:03 OpenWrt kern.notice kernel: klogd started: BusyBox v1.19.4 (2012-08-28 23:48:59 EDT)
Sep 12 21:04:03 OpenWrt kern.notice kernel: [ 0.000000] Linux version 3.3.8 (openwrt@callisto.lab.bufferbloat.net) (gcc version 4.6.3 20120201 (prerelease) (Linaro GCC 4.6-2012.02) ) #1 Thu Aug 30 06:36:56 EDT 2012
Sep 12 21:04:03 OpenWrt kern.debug kernel: [ 0.000000] MyLoader: sysp=3dd7cb87, boardp=f0717c55, parts=4852ecbe
Sep 12 21:04:03 OpenWrt kern.info kernel: [ 0.000000] bootconsole [early0] enabled
Sep 12 21:04:03 OpenWrt kern.info kernel: [ 0.000000] CPU revision is: 00019374 (MIPS 24Kc)
Sep 12 21:04:03 OpenWrt kern.info kernel: [ 0.000000] SoC: Atheros AR9330 rev 1
Sep 12 21:04:03 OpenWrt kern.info kernel: [ 0.000000] Clocks: CPU:400.000MHz, DDR:400.000MHz, AHB:200.000MHz, Ref:25.000MHz
Sep 12 21:04:03 OpenWrt kern.info kernel: [ 0.000000] Determined physical RAM map:
Sep 12 21:04:03 OpenWrt kern.info kernel: [ 0.000000] memory: 02000000 @ 00000000 (usable)
Sep 12 21:04:03 OpenWrt kern.info kernel: [ 0.000000] Initrd not found or empty - disabling initrd
Sep 12 21:04:03 OpenWrt kern.warn kernel: [ 0.000000] Zone PFN ranges:
Sep 12 21:04:03 OpenWrt kern.warn kernel: [ 0.000000] Normal 0x00000000 -> 0x00002000
Sep 12 21:04:03 OpenWrt kern.warn kernel: [ 0.000000] Movable zone start PFN for each node
Sep 12 21:04:03 OpenWrt kern.warn kernel: [ 0.000000] Early memory PFN ranges
Sep 12 21:04:03 OpenWrt kern.warn kernel: [ 0.000000] 0: 0x00000000 -> 0x00002000
Sep 12 21:04:03 OpenWrt kern.debug kernel: [ 0.000000] On node 0 totalpages: 8192
Sep 12 21:04:03 OpenWrt kern.debug kernel: [ 0.000000] free_area_init_node: node 0, pgdat 8031a620, node_mem_map 81000000
Sep 12 21:04:03 OpenWrt kern.debug kernel: [ 0.000000] Normal zone: 64 pages used for memmap
Sep 12 21:04:03 OpenWrt kern.debug kernel: [ 0.000000] Normal zone: 0 pages reserved
Sep 12 21:04:03 OpenWrt kern.debug kernel: [ 0.000000] Normal zone: 8128 pages, LIFO batch:0
Sep 12 21:04:03 OpenWrt kern.debug kernel: [ 0.000000] pcpu-alloc: s0 r0 d32768 u32768 alloc=1*32768
Sep 12 21:04:03 OpenWrt kern.debug kernel: [ 0.000000] pcpu-alloc: [0] 0
Sep 12 21:04:03 OpenWrt kern.warn kernel: [ 0.000000] Built 1 zonelists in Zone order, mobility grouping on. Total pages: 8128
Sep 12 21:04:03 OpenWrt kern.notice kernel: [ 0.000000] Kernel command line: board=TL-WR703N console=ttyATH0,115200 rootfstype=squashfs,jffs2 noinitrd
Sep 12 21:04:03 OpenWrt kern.info kernel: [ 0.000000] PID hash table entries: 128 (order: -3, 512 bytes)
Sep 12 21:04:03 OpenWrt kern.info kernel: [ 0.000000] Dentry cache hash table entries: 4096 (order: 2, 16384 bytes)
Sep 12 21:04:03 OpenWrt kern.info kernel: [ 0.000000] Inode-cache hash table entries: 2048 (order: 1, 8192 bytes)
Sep 12 21:04:03 OpenWrt kern.warn kernel: [ 0.000000] Primary instruction cache 64kB, VIPT, 4-way, linesize 32 bytes.
Sep 12 21:04:03 OpenWrt kern.warn kernel: [ 0.000000] Primary data cache 32kB, 4-way, VIPT, cache aliases, linesize 32 bytes
Sep 12 21:04:03 OpenWrt kern.info kernel: [ 0.000000] Writing ErrCtl register=00000000
Sep 12 21:04:03 OpenWrt kern.info kernel: [ 0.000000] Readback ErrCtl register=00000000
Sep 12 21:04:03 OpenWrt kern.info kernel: [ 0.000000] Memory: 28952k/32768k available (2215k kernel code, 3816k reserved, 579k data, 208k init, 0k highmem)
Sep 12 21:04:03 OpenWrt kern.info kernel: [ 0.000000] SLUB: Genslabs=9, HWalign=32, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
Sep 12 21:04:03 OpenWrt kern.info kernel: [ 0.000000] NR_IRQS:51
Sep 12 21:04:03 OpenWrt kern.info kernel: [ 0.000000] Calibrating delay loop... 265.42 BogoMIPS (lpj=1327104)
Sep 12 21:04:03 OpenWrt kern.info kernel: [ 0.080000] pid_max: default: 32768 minimum: 301
Sep 12 21:04:03 OpenWrt kern.info kernel: [ 0.080000] Mount-cache hash table entries: 512
Sep 12 21:04:03 OpenWrt kern.info kernel: [ 0.090000] NET: Registered protocol family 16
Sep 12 21:04:03 OpenWrt kern.info kernel: [ 0.090000] gpiochip_add: registered GPIOs 0 to 29 on device: ath79
Sep 12 21:04:03 OpenWrt kern.info kernel: [ 0.100000] MIPS: machine is TP-LINK TL-WR703N v1
Sep 12 21:04:03 OpenWrt kern.info kernel: [ 0.340000] bio: create slab <bio-0> at 0
Sep 12 21:04:03 OpenWrt kern.info kernel: [ 0.350000] Switching to clocksource MIPS
Sep 12 21:04:03 OpenWrt kern.info kernel: [ 0.350000] NET: Registered protocol family 2
Sep 12 21:04:03 OpenWrt kern.info kernel: [ 0.360000] IP route cache hash table entries: 1024 (order: 0, 4096 bytes)
Sep 12 21:04:03 OpenWrt kern.info kernel: [ 0.360000] TCP established hash table entries: 1024 (order: 1, 8192 bytes)
Sep 12 21:04:03 OpenWrt kern.info kernel: [ 0.360000] TCP bind hash table entries: 1024 (order: 0, 4096 bytes)
Sep 12 21:04:03 OpenWrt kern.info kernel: [ 8.540000] usbcore: registered new device driver usb
Sep 12 21:04:03 OpenWrt kern.debug kernel: [ 9.020000] ath: EEPROM regdomain: 0x0
Sep 12 21:04:03 OpenWrt kern.debug kernel: [ 9.020000] ath: EEPROM indicates default country code should be used
Sep 12 21:04:03 OpenWrt kern.debug kernel: [ 9.020000] ath: doing EEPROM country->regdmn map search
Sep 12 21:04:03 OpenWrt kern.debug kernel: [ 9.020000] ath: country maps to regdmn code: 0x3a
Sep 12 21:04:03 OpenWrt kern.debug kernel: [ 9.020000] ath: Country alpha2 being used: US
Sep 12 21:04:03 OpenWrt kern.debug kernel: [ 9.020000] ath: Regpair used: 0x3a
Sep 12 21:04:03 OpenWrt kern.debug kernel: [ 9.030000] ieee80211 phy0: Selected rate control algorithm 'minstrel_ht'
Sep 12 21:04:03 OpenWrt kern.debug kernel: [ 9.030000] Registered led device: ath9k-phy0
Sep 12 21:04:03 OpenWrt kern.info kernel: [ 9.030000] ieee80211 phy0: Atheros AR9330 Rev:1 mem=0xb8100000, irq=2
Sep 12 21:04:03 OpenWrt kern.info kernel: [ 9.040000] cfg80211: Calling CRDA for country: US
Sep 12 21:04:03 OpenWrt kern.info kernel: [ 9.040000] cfg80211: Regulatory domain changed to country: US
Sep 12 21:04:03 OpenWrt kern.info kernel: [ 9.050000] cfg80211: (start_freq - end_freq @ bandwidth), (max_antenna_gain, max_eirp)
Sep 12 21:04:03 OpenWrt kern.info kernel: [ 9.060000] cfg80211: (2402000 KHz - 2472000 KHz @ 40000 KHz), (300 mBi, 2700 mBm)
Sep 12 21:04:03 OpenWrt kern.info kernel: [ 9.060000] cfg80211: (5170000 KHz - 5250000 KHz @ 40000 KHz), (300 mBi, 1700 mBm)
Sep 12 21:04:03 OpenWrt kern.info kernel: [ 9.070000] cfg80211: (5250000 KHz - 5330000 KHz @ 40000 KHz), (300 mBi, 2000 mBm)
Sep 12 21:04:03 OpenWrt kern.info kernel: [ 9.080000] cfg80211: (5490000 KHz - 5600000 KHz @ 40000 KHz), (300 mBi, 2000 mBm)
Sep 12 21:04:03 OpenWrt kern.info kernel: [ 9.090000] cfg80211: (5650000 KHz - 5710000 KHz @ 40000 KHz), (300 mBi, 2000 mBm)
Sep 12 21:04:03 OpenWrt kern.info kernel: [ 9.090000] cfg80211: (5735000 KHz - 5835000 KHz @ 40000 KHz), (300 mBi, 3000 mBm)
Sep 12 21:04:03 OpenWrt kern.info kernel: [ 9.160000] PPP generic driver version 2.4.2
Sep 12 21:04:03 OpenWrt kern.info kernel: [ 9.300000] ip_tables: (C) 2000-2006 Netfilter Core Team
Sep 12 21:04:03 OpenWrt kern.info kernel: [ 9.420000] NET: Registered protocol family 24
Sep 12 21:04:03 OpenWrt kern.info kernel: [ 9.440000] ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
Sep 12 21:04:03 OpenWrt kern.info kernel: [ 9.440000] ehci-platform ehci-platform: Generic Platform EHCI Controller
Sep 12 21:04:03 OpenWrt kern.info kernel: [ 9.450000] ehci-platform ehci-platform: new USB bus registered, assigned bus number 1
Sep 12 21:04:03 OpenWrt kern.info kernel: [ 9.490000] ehci-platform ehci-platform: irq 3, io mem 0x1b000000
Sep 12 21:04:03 OpenWrt kern.info kernel: [ 9.510000] ehci-platform ehci-platform: USB 2.0 started, EHCI 1.00
Sep 12 21:04:03 OpenWrt kern.info kernel: [ 9.510000] hub 1-0:1.0: USB hub found
Sep 12 21:04:03 OpenWrt kern.info kernel: [ 9.510000] hub 1-0:1.0: 1 port detected
Sep 12 21:04:03 OpenWrt kern.info kernel: [ 9.540000] nf_conntrack version 0.5.0 (455 buckets, 1820 max)
Sep 12 21:04:03 OpenWrt kern.info kernel: [ 9.790000] ohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driver
Sep 12 21:04:03 OpenWrt kern.info kernel: [ 9.900000] usb 1-1: new high-speed USB device number 2 using ehci-platform
Sep 12 21:04:05 OpenWrt kern.info kernel: [ 13.050000] device eth0 entered promiscuous mode
Sep 12 21:04:05 OpenWrt daemon.notice netifd: Interface 'lan' is now up
Sep 12 21:04:05 OpenWrt daemon.notice netifd: Interface 'loopback' is now up
Sep 12 21:04:05 OpenWrt kern.info kernel: [ 13.360000] eth0: link up (100Mbps/Full duplex)
Sep 12 21:04:05 OpenWrt kern.info kernel: [ 13.360000] br-lan: port 1(eth0) entered forwarding state
Sep 12 21:04:05 OpenWrt kern.info kernel: [ 13.370000] br-lan: port 1(eth0) entered forwarding state
Sep 12 21:04:06 OpenWrt user.notice usb-modeswitch: 1-0:1.0: Manufacturer=Linux_3.3.8_ehci_hcd Product=Generic_Platform_EHCI_Controller Serial=ehci-platform
Sep 12 21:04:06 OpenWrt user.notice ifup: Enabling Router Solicitations on lan (br-lan)
Sep 12 21:04:06 OpenWrt user.notice usb-modeswitch: 1-1:1.0: Manufacturer=ZTE,Incorporated Product=ZTE_CDMA_Technologies_MSM Serial=1234567890ABCDEF
Sep 12 21:04:06 OpenWrt user.notice usb-modeswitch: 1-1:1.0: Selecting /etc/usb_modeswitch.d/19d2:2000 for mode switching
Sep 12 21:04:06 OpenWrt syslog.notice usb_modeswitch: switching device 19d2:2000 on 001/002
Sep 12 21:04:07 OpenWrt kern.info kernel: [ 15.370000] br-lan: port 1(eth0) entered forwarding state
Sep 12 21:04:08 OpenWrt user.notice ifup: Enabling Router Solicitations on loopback (lo)
Sep 12 21:04:08 OpenWrt kern.info kernel: [ 16.570000] usb 1-1: USB disconnect, device number 2
Sep 12 21:04:09 OpenWrt kern.info kernel: [ 16.850000] usb 1-1: new high-speed USB device number 3 using ehci-platform
Sep 12 21:04:11 OpenWrt user.info sysinit: Loading defaults
Sep 12 21:04:12 OpenWrt user.info sysinit: Loading synflood protection
Sep 12 21:04:12 OpenWrt user.info sysinit: Adding custom chains
Sep 12 21:04:12 OpenWrt user.info sysinit: Loading zones
Sep 12 21:04:13 OpenWrt user.info sysinit: Loading forwardings
Sep 12 21:04:13 OpenWrt user.info sysinit: Loading rules
Sep 12 21:04:13 OpenWrt user.info sysinit: Loading redirects
Sep 12 21:04:13 OpenWrt user.info sysinit: Loading includes
Sep 12 21:04:13 OpenWrt user.info sysinit: Optimizing conntrack
Sep 12 21:04:13 OpenWrt user.info sysinit: Loading interfaces
Sep 12 21:04:14 OpenWrt user.info firewall: adding lan (br-lan) to zone lan
Sep 12 21:04:14 OpenWrt authpriv.info dropbear[1074]: Running in background
Sep 12 21:04:16 OpenWrt user.notice dnsmasq: DNS rebinding protection is active, will discard upstream RFC1918 responses!
Sep 12 21:04:16 OpenWrt user.notice dnsmasq: Allowing 127.0.0.0/8 responses
Sep 12 21:04:16 OpenWrt user.notice dnsmasq: found already running DHCP-server on interface 'br-lan' refusing to start, use 'option force 1' to override
Sep 12 21:04:16 OpenWrt daemon.info dnsmasq[1121]: started, version 2.62 cachesize 150
Sep 12 21:04:16 OpenWrt daemon.info dnsmasq[1121]: compile time options: IPv6 GNU-getopt no-DBus no-i18n no-IDN DHCP no-DHCPv6 no-Lua TFTP no-conntrack
Sep 12 21:04:16 OpenWrt daemon.info dnsmasq[1121]: using local addresses only for domain lan
Sep 12 21:04:16 OpenWrt daemon.info dnsmasq[1121]: reading /tmp/resolv.conf.auto
Sep 12 21:04:16 OpenWrt daemon.info dnsmasq[1121]: using nameserver 192.168.1.1#53
Sep 12 21:04:16 OpenWrt daemon.info dnsmasq[1121]: using local addresses only for domain lan
Sep 12 21:04:16 OpenWrt daemon.info dnsmasq[1121]: read /etc/hosts - 1 addresses
Sep 12 21:04:58 OpenWrt user.notice usb-modeswitch: 1-1:1.0: Manufacturer=ZTE,Incorporated Product=ZTE_CDMA_Technologies_MSM Serial=1234567890ABCDEF
Sep 12 21:04:59 OpenWrt user.notice usb-modeswitch: 1-1:1.1: Manufacturer=ZTE,Incorporated Product=ZTE_CDMA_Technologies_MSM Serial=1234567890ABCDEF
Sep 12 21:04:59 OpenWrt user.notice usb-modeswitch: 1-1:1.2: Manufacturer=ZTE,Incorporated Product=ZTE_CDMA_Technologies_MSM Serial=1234567890ABCDEF
Sep 12 21:04:59 OpenWrt user.notice usb-modeswitch: 1-1:1.3: Manufacturer=ZTE,Incorporated Product=ZTE_CDMA_Technologies_MSM Serial=1234567890ABCDEF
view raw gistfile1.txt hosted with ❤ by GitHub

Monday, 3 September 2012

Drawing trees with XQuery and SVG

Looking for a simple way to draw tree structures, I came across this old xml.com article Automated Tree Drawing: XSLT and SVG  by Jirka Kosek. This uses some EXSLT extensions. I am sure it could have been rewritten in XSLT2 but I thought it would be  interesting to try it in XQuery ( and add a RESTXQ web interface). Demo and  source.