lunes, 11 de agosto de 2014

Centralita Asterisk VoIP - VoIPBuster - Google Talk

Esto es un recopilatorio de diversas guías y basado fundamentalmente en un estupendo post, unificando una configuración que haga lo siguiente:


  • Red interna de extensiones con teléfonos IP y teléfonos móviles con cliente Zoiper en la misma red mediante wifi.
  • Salida de llamadas con prefijo 0034 por Voipbuster u otro proveedor de SIP.
  • Salida y recepción de llamadas mediante Gtalk en una una extensión fija.

Configuramos Asterisk 11.X en nuestra raspberry pi o beaglebone por ejemplo, y que ya incluye los módulos necesarios; los ficheros de configuración son como siguen:

extensions.conf
[default]
; definición de cada una de las extensiones fijas 
exten => _1XX,1,answer()
exten => _1XX,n,dial(sip/${EXTEN}) 
exten => _1XX,n,hangup() 
[entrante-gtalk]
include => saliente-gtalk
exten => s,1,NoOp()
 same => n,Wait(1) same => n,Answer() same => n,SendDTMF(1)
; 102 será la extensión que sonará cuando nos llamen por gtalk. 
 same => n,Dial(SIP/102,20)   
 [saliente-gtalk]
exten => 555,1,Dial(Motif/google/contacto@gmail.com,,r) 
[voipbuster]
; los prefijos 0034 se envián por la cuenta de voipbuster 
exten => _0034.,1,Dial(SIP/${EXTEN}@voipbuster) 
motif.conf
[google]
context=entrante-gtalk     ; Las llamadas proceden de o finalizan del contexto entrante-gtalk
disallow=all               ; No se permite ningun codec
allow=ulaw                 ; Permite el codec G.711 ulaw
connection=google          ; La conexion XMPP llamada "google" se usara para realizar la conexion
xmpp.conf
[general]
[google]
type=client                    ; Es tipo cliente ya que Google esta dando un servicio
serverhost=talk.google.com     ; El servidor de gtalk
username=tucuenta@gmail.com     ; El usuario de gtalk que se usara para conectarse
secret=contraseña              ; El password de tu usuario de gtalk
priority=1                     ; La prioridad
port=5222                      ; El puerto por el cual opera gtalk
usetls=yes                     ; La encriptacion TLS requerida por Google
usesasl=yes                    ; SASL usada por Google
status=available               ; Estatus como se mostrara en gtalk
statusmessage="Conectado VoIP"   ; El mensaje que se mostrara en el gtalk
timeout=5                      ; Se establece un tiempo de espera para recibir un mensaje de Google que permite lo suficiente de tiempo en caso de retraso en la red
y finalmente sip.conf
[general]context=default                 allowoverlap=no                 bindport=5060                   bindaddr=0.0.0.0                tcpenable=yes                   tcpbindaddr=0.0.0.0             srvlookup=yes                   
[101]username=101secret=101type=friendcallerid="Ext. <101>"host=dynamiccontext=default

[102]username=102secret=102type=friendcallerid="Ext. <102>"host=dynamiccontext=entrante-gtalk

[voipbuster]type=peerhost=sip.voipbuster.comusername=cuenta_voipbuster   ; aquí va tu cuenta de voipbusterfromuser=cuenta_voipbuster   secret=contraseña_voipbuster   notifyringing=yesmusicclass=defaultnat=yes

Conectamos ahora un terminal o cliente softphone con la extensión 102, y cuando llamemos por gtalk a la cuenta tucuenta@gmail.com debería sonarnos en dicha extensión.
Si marcamos un número cuyo comienzo sea por 0034 deberá salir por Voipbuster, aplicándose las tarifas correspondientes. Si es un fijo y estamos en los 120 días tras una recarga, debería ser gratis.

Por último podremos llamar desde la extensión 101 por ejemplo a la 102; hay que tener en cuenta que hay dos context, default y entrantes-gtalk.


martes, 4 de marzo de 2014

Seguimiento de aviones con ASL26555

Con LCD4Linux, Dump1090, y un sensor BMP085 por I2C tenemos un curioso router para seguir aviones y mostrar datos de temperatura y presión:


lunes, 25 de marzo de 2013

OpenWrt en Belkin Play Max F7D4401 v1

Router de muy interesantes especificaciones:  bandas 2.4 y 5 ghz, y  2 puertos USB 2.0. No hay casi soporte para routers de esta marca en OpenWrt, aunque tienen buenos precios y buenas prestaciones gracias al SoC BRCM4718.

En la Web encontramos ya soportados modelos inferiores como el F7D3301 o el F7D4301 (igual al F7D4401 pero sin módem adsl), en dd-wrt o tomato-usb, pero con parches mantenidos fuera del trunk de OpenWrt.

Este parche que permite arrancar el OpenWrt está basado en el trabajo de Manoj para adaptar los firmwares a la cabecera específica de Belkin y su adaptación al F7D3301 de los parches de George Kashperko para el F7D4301 y Asus RT-N16.

La modificación para que el CFE reconozca el firmware es mínima, y consiste únicamente en cambiar el número mágico de la cabecera TRX del firmware al específico del F7D4401 en el parche de Manoj.

Así se añade, en lugar del TRX_MAGIC estándar,

#define TRX_MAGIC   0x30524448

o de otros modelos Belkin basados en el mismo SoC:


#define TRX_MAGIC_F7D3301   0x20100322  
#define TRX_MAGIC_F7D3302   0x20090928
#define TRX_MAGIC_F7D4302   0x20091006


se añade el específico del F7D4401:

#define TRX_MAGIC_F7D4401   0x00018517

Queda por ir añadiendo soporte a la placa, leds, gpio, etc. OpenWrt no soporta el wifi en la banda de 5 ghz y tampoco el módel ADSL.

Código del parche: https://github.com/gmtii/openwrt-f7d4401/blob/master/f7d4401-r36141.patch

El log de arranque en la primera versión funcional es el siguiente:

[    0.000000] Linux version 3.6.11 (ebensan@ubuntu) (gcc version
4.6.4 20121210 (prerelease) (Linaro GCC 4.6-2012.12) ) #13
[    0.000000] CPU revision is: 00019740 (MIPS 74Kc)
[    0.000000] bcm47xx: using bcma bus
[    0.000000] bcma: bus0: Found chip with id 0x4716, rev 0x01 and package 0x0A
[    0.000000] bcma: bus0: Core 0 found: ChipCommon (manuf 0x4BF, id
0x800, rev 0x1F, class 0x0)
[    0.000000] bcma: bus0: Core 3 found: MIPS 74K (manuf 0x4A7, id
0x82C, rev 0x01, class 0x0)
[    0.000000] bcma: bus0: Found rev 5 PMU (capabilities 0x11242C05)
[    0.000000] bcma: bus0: Found parallel flash
[    0.000000] bcma: bus0: Early bus registered
[    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] On node 0 totalpages: 16384
[    0.000000] free_area_init_node: node 0, pgdat 802de970,
node_mem_map 81000000
[    0.000000]   Normal zone: 128 pages used for memmap
[    0.000000]   Normal zone: 0 pages reserved
[    0.000000]   Normal zone: 16256 pages, LIFO batch:3
[    0.000000] Primary instruction cache 32kB, 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:  root=/dev/mtdblock2
rootfstype=squashfs,jffs2 noinitrd console=ttyS0,115200
[    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] __ex_table already sorted, skipping sort
[    0.000000] Writing ErrCtl register=00000000
[    0.000000] Readback ErrCtl register=00000000
[    0.000000] Memory: 61572k/65536k available (2416k kernel code,
3964k reserved, 520k data, 164k init, 0k highmem)
[    0.000000] NR_IRQS:128
[    0.032000] Calibrating delay loop... 225.02 BogoMIPS (lpj=450048)
[    0.036000] pid_max: default: 32768 minimum: 301
[    0.036000] Mount-cache hash table entries: 512
[    0.036000] NET: Registered protocol family 16
[    0.056000] bio: create slab <bio-0> at 0
[    0.060000] Switching to clocksource MIPS
[    0.072000] NET: Registered protocol family 2
[    0.072000] TCP established hash table entries: 2048 (order: 2, 16384 bytes)
[    0.072000] TCP bind hash table entries: 2048 (order: 1, 8192 bytes)
[    0.072000] TCP: Hash tables configured (established 2048 bind 2048)
[    0.072000] TCP: reno registered
[    0.072000] UDP hash table entries: 256 (order: 0, 4096 bytes)
[    0.072000] UDP-Lite hash table entries: 256 (order: 0, 4096 bytes)
[    0.072000] NET: Registered protocol family 1
[    0.072000] PCI: CLS 0 bytes, default 32
[    0.076000] bcma: bus0: Core 1 found: IEEE 802.11 (manuf 0x4BF, id
0x812, rev 0x11, class 0x0)
[    0.076000] bcma: bus0: Core 2 found: GBit MAC (manuf 0x4BF, id
0x82D, rev 0x00, class 0x0)
[    0.076000] bcma: bus0: Core 4 found: USB 2.0 Host (manuf 0x4BF, id
0x819, rev 0x04, class 0x0)
[    0.076000] bcma: bus0: Core 5 found: PCIe (manuf 0x4BF, id 0x820,
rev 0x0E, class 0x0)
[    0.076000] bcma: bus0: Core 6 found: DDR1/DDR2 Memory Controller
(manuf 0x4BF, id 0x82E, rev 0x01, class 0x0)
[    0.076000] bcma: bus0: Core 7 found: Internal Memory (manuf 0x4BF,
id 0x80E, rev 0x07, class 0x0)
[    0.076000] bcma: bus0: Core 8 found: I2S (manuf 0x4BF, id 0x834,
rev 0x00, class 0x0)
[    0.340000] bcma: bus0: Using SPROM revision 8 provided by platform.
[    0.340000] bcma: bus0: PMU resource config unknown or not needed
for device 0x4716
[    0.340000] bcma: bus0: Workarounds unknown or not needed for device 0x4716
[    0.340000] bcma: bus0: Initializing MIPS core...
[    0.340000] bcma: bus0: Moved i2s interrupt to oob line 7 instead of 8
[    0.340000] bcma: bus0: set_irq: core 0x0812, irq 3 => 3
[    0.340000] bcma: bus0: set_irq: core 0x082d, irq 4 => 4
[    0.340000] bcma: bus0: set_irq: core 0x0819, irq 5 => 5
[    0.340000] bcma: bus0: set_irq: core 0x0820, irq 6 => 6
[    0.340000] bcma: bus0: set_irq: core 0x0800, irq 2 => 2
[    0.340000] bcma: bus0: set_irq: core 0x0834, irq 0 => 2
[    0.340000] bcma: bus0: IRQ reconfiguration done
[    0.340000] bcma: core 0x0800, irq : 2(S)* 3  4  5  6  D  I
[    0.340000] bcma: core 0x082c, irq : 2(S)  3  4  5  6  D  I*
[    0.340000] bcma: core 0x0812, irq : 2(S)  3* 4  5  6  D  I
[    0.340000] bcma: core 0x082d, irq : 2(S)  3  4* 5  6  D  I
[    0.344000] bcma: core 0x0819, irq : 2(S)  3  4  5* 6  D  I
[    0.344000] bcma: core 0x0820, irq : 2(S)  3  4  5  6* D  I
[    0.344000] bcma: core 0x082e, irq : 2(S)  3  4  5  6  D* I
[    0.344000] bcma: core 0x080e, irq : 2(S)  3  4  5  6  D  I*
[    0.344000] bcma: core 0x0834, irq : 2(S)* 3  4  5  6  D  I
[    0.344000] bcma: bus0: PCIEcore in host mode found
[    0.520000] PCI host bridge to bus 0000:00
[    0.520000] pci_bus 0000:00: root bus resource [mem 0x08000000-0x0bffffff]
[    0.520000] pci_bus 0000:00: root bus resource [io  0x0100-0x07ff]
[    0.520000] pci_bus 0000:00: No busn resource found for root bus,
will use [bus 00-ff]
[    0.520000] pci_bus 0000:00: busn_res: [bus 00-ff] is inserted
under domain [bus 00-ff]
[    0.520000] pci 0000:00:00.0: [14e4:4716] type 00 class 0x060000
[    0.520000] bcma: PCI: Fixing up bridge 0000:00:00.0
[    0.520000] bcma: PCI: Fixing up device 0000:00:00.0
[    0.520000] pci 0000:00:00.0: reg 10: [mem 0x00000000-0x00003fff 64bit]
[    0.520000] pci 0000:00:00.0: reg 18: [mem 0x00000000-0x07ffffff 64bit]
[    0.520000] pci 0000:00:00.0: supports D1 D2
[    0.520000] pci 0000:00:00.1: [14e4:0000] type 00 class 0x060000
[    0.520000] bcma: PCI: Fixing up bridge 0000:00:00.1
[    0.520000] bcma: PCI: Fixing up device 0000:00:00.1
[    0.520000] pci 0000:00:00.1: reg 10: [mem 0x00000000-0x00003fff 64bit]
[    0.520000] pci 0000:00:00.1: reg 18: [mem 0x00000000-0x07ffffff 64bit]
[    0.520000] pci 0000:00:00.1: supports D1 D2
[    0.520000] pci 0000:00:01.0: [14e4:a8d8] type 00 class 0x028000
[    0.520000] pci 0000:00:01.0: reg 10: [mem 0x00000000-0x00003fff 64bit]
[    0.520000] bcma: PCI: Fixing up addresses 0000:00:01.0
[    0.520000] pci 0000:00:01.0: BAR 0: assigned [mem
0x08000000-0x08003fff 64bit]
[    0.520000] pci 0000:00:01.0: supports D1 D2
[    0.520000] pci_bus 0000:00: busn_res: [bus 00-ff] end is updated to 00
[    0.524000] PCI: Enabling device 0000:00:01.0 (0000 -> 0002)
[    0.524000] bcma: PCI: Fixing up device 0000:00:01.0
[    0.524000] bcma: bus1: Found chip with id 0xA8D8, rev 0x01 and package 0x08
[    0.524000] bcma: bus1: Core 0 found: ChipCommon (manuf 0x4BF, id
0x800, rev 0x22, class 0x0)
[    0.524000] bcma: bus1: Core 1 found: IEEE 802.11 (manuf 0x4BF, id
0x812, rev 0x17, class 0x0)
[    0.524000] bcma: bus1: Core 2 found: PCIe (manuf 0x4BF, id 0x820,
rev 0x0F, class 0x0)
[    0.524000] bcma: bus1: Found rev 6 PMU (capabilities 0x108C2606)
[    0.532000] can not parse nvram name pci/1/1/ledbh1(null) with
value 0xffff got -34
[    0.532000] can not parse nvram name pci/1/1/ledbh2(null) with
value 0xffff got -34
[    0.532000] can not parse nvram name pci/1/1/ledbh3(null) with
value 0xffff got -34
[    0.664000] bcma: bus1: Using SPROM revision 8 provided by platform.
[    0.664000] bcma: bus1: PMU resource config unknown or not needed
for device 0xA8D8
[    0.676000] bcma: bus1: Bus registered
[    0.680000] bcma: bus0: Bus registered
[    0.684000] squashfs: version 4.0 (2009/01/31) Phillip Lougher
[    0.684000] jffs2: version 2.2 (NAND) (SUMMARY) (LZMA) (RTIME)
(CMODE_PRIORITY) (c) 2001-2006 Red Hat, Inc.
[    0.684000] msgmni has been set to 120
[    0.684000] io scheduler noop registered
[    0.684000] io scheduler deadline registered (default)
[    0.684000] Serial: 8250/16550 driver, 2 ports, IRQ sharing enabled
[    0.708000] serial8250.0: ttyS0 at MMIO 0xb8000300 (irq = 2) is a U6_16550A
[    1.196000] console [ttyS0] enabled
[    1.204000] bcm47xx_pflash: flash init: 0x1c000000 0x02000000
[    1.208000] Physically mapped flash: Found 1 x16 devices at 0x0 in
8-bit bank. Manufacturer ID 0x00007f Chip ID 0x0000cb
[    1.220000] Physically mapped flash: Found an alias at 0x800000 for
the chip at 0x0
[    1.220000] Physically mapped flash: Found an alias at 0x1000000
for the chip at 0x0
[    1.220000] Physically mapped flash: Found an alias at 0x1800000
for the chip at 0x0
[    1.220000] Amd/Fujitsu Extended Query Table at 0x0040
[    1.224000]   Amd/Fujitsu Extended Query version 1.1.
[    1.232000] number of CFI chips: 1
[    1.232000] bcm47xx_pflash: Flash device: 0x2000000 at 0x1fc00000
[    1.240000] bcm47xx_part: Found Belkin_F7D4401 header:cfe
[    1.248000] bcm47xx_part: bootloader size: 196608
[    1.256000] bcm47xx_part: Looking for dual image
[    1.264000] bcm47xx_part: Found Belkin_F7D4401 header:root
[    1.268000] bcm47xx_part: TRX offset : 0
[    1.712000] bcm47xx_part: Updating TRX offsets and length:
[    1.716000] bcm47xx_part: old trx = [0x0000001c, 0x00000968,
0x000f7c00], len=0x002b1000 crc32=0x12d3d501
[    1.728000] bcm47xx_part: new trx = [0x0000001c, 0x00000968,
0x000f7c00], len=0x000f7c00 crc32=0x262c72d6
[    3.608000] bcm47xx_part: Done
[    3.608000] 4 bcm47xx partitions found on MTD device Physically mapped flash
[    3.616000] Creating 4 MTD partitions on "Physically mapped flash":
[    3.624000] 0x000000000000-0x000000030000 : "cfe"
[    3.632000] 0x000000030000-0x0000007f0000 : "linux"
[    3.640000] 0x000000127c00-0x0000007f0000 : "rootfs"
[    3.644000] mtd: partition "rootfs" must either start or end on
erase block boundary or be smaller than an erase block -y
[    3.660000] mtd: partition "rootfs" set to be root filesystem
[    3.668000] mtd: partition "rootfs_data" created automatically,
ofs=2A0000, len=550000
[    3.676000] 0x0000002a0000-0x0000007f0000 : "rootfs_data"
[    3.684000] 0x0000007f0000-0x000000800000 : "nvram"
[    3.696000] bcm47xx-wdt bcm47xx-wdt.0: BCM47xx Watchdog Timer
enabled (30 seconds)
[    3.704000] TCP: cubic registered
[    3.708000] NET: Registered protocol family 17
[    3.712000] 8021q: 802.1Q VLAN Support v1.8
[    3.724000] VFS: Mounted root (squashfs filesystem) readonly on device 31:2.
[    3.732000] Freeing unused kernel memory: 164k freed
[    5.424000] manoj: boardnum= 12345 : boardtype : 0xd4cf
[    5.428000] diag: Detected 'Belkin PlayMax F7D4401'
[    5.436000] diag: led:power
[    5.436000] diag: led:warn
[    5.440000] diag: led:wlan
[    5.444000] diag: led:led0
[    5.444000] diag: led:led1
[    5.528000] bgmac bcma0:1: Found PHY addr: 30 (NOREGS)
[    5.536000] bgmac bcma0:1: Support for Roboswitch not implemented
[    5.564000] bgmac: Broadcom 47xx GBit MAC driver loaded
[    5.764000] roboswitch: Probing device 'eth0'
[    5.768000] roboswitch: found a 53115! It's a 5350. at eth0
[   16.360000] wl: module license 'unspecified' taints kernel.
[   16.364000] Disabling lock debugging due to kernel taint
[   16.508000] wl0: Broadcom BCM4329 802.11 Wireless Controller 5.10.56.27
[   16.516000] SSB/BCMA glue driver successfully attached
[   16.552000] PPP generic driver version 2.4.2
[   16.720000] ip_tables: (C) 2000-2006 Netfilter Core Team
[   16.860000] NET: Registered protocol family 24
[   16.888000] nf_conntrack version 0.5.0 (964 buckets, 3856 max)
[   20.924000] device eth0.0 entered promiscuous mode
[   20.928000] device eth0 entered promiscuous mode
[   20.932000] br-lan: port 1(eth0.0) entered forwarding state
[   20.940000] br-lan: port 1(eth0.0) entered forwarding state
[   22.944000] br-lan: port 1(eth0.0) entered forwarding state
[   35.740000] jffs2_scan_eraseblock(): End of filesystem marker found at 0x0
[   35.752000] jffs2_build_filesystem(): unlocking the mtd device... done.
[   69.688000] Found board: "Unknown Board"
[   35.756000] jffs2_build_filesystem(): erasing all blocks after the
end marker... done.
[   81.492000] jffs2: notice: (930) jffs2_build_xattr_subsystem:
complete building xattr subsystem, 0 of xdatum (0 unchecke.
[  574.368000] br-lan: port 1(eth0.0) entered disabled state
[  574.384000] device eth0.0 left promiscuous mode
[  574.388000] device eth0 left promiscuous mode
[  574.392000] br-lan: port 1(eth0.0) entered disabled state
[  577.080000] device eth0.0 entered promiscuous mode
[  577.084000] device eth0 entered promiscuous mode
[  577.092000] br-lan: port 1(eth0.0) entered forwarding state
[  577.096000] br-lan: port 1(eth0.0) entered forwarding state
[  579.100000] br-lan: port 1(eth0.0) entered forwarding state
[  582.408000] nas calls setitimer() with new_value NULL pointer.
Misfeature support will be removed

Saludos.

sábado, 16 de marzo de 2013

ONT I-240G-B MOVISTAR ALCATEL LUCENT

Muy interensante cacharro que monta movistar con fibra óptica... atención al latiguillo y como va cuidadósamente enrrollado ... lleva una cpu dual core bcm6818 aún no soportada en Openwrt, sin wifi y el puerto serie es a 115200 8N1 está invertido de modo que tenemos que pasarlo por un inversor o utilizar algo tipo el piratebus ...


Registro de arranque...


http://pastebin.com/raw.php?i=iVuKVu6F


/proc # cat cpuinfo
system type     : YOOHOO
processor       : 0
cpu model       : BCM6816 V7.0
BogoMIPS        : 358.40
wait instruction   : yes
microsecond timers : yes
tlb_entries     : 32
extra interrupt vector  : no
hardware watchpoint : no
ASEs implemented   :
VCED exceptions    : not available
VCEI exceptions    : not available

unaligned exceptions            : 2381

/proc # cat mtd
dev:    size   erasesize  name
mtd0: 00cdff00 00020000 "ONT-Image0"
mtd1: 00600000 00020000 "jffs2_config_area"
mtd2: 00ce0000 00020000 "ONT-Image1"
mtd3: 00ce0000 00020000 "AllImage0"
mtd4: 00ce0000 00020000 "AllImage1"
mtd5: 00020000 00020000 "CFE"

/etc # cat passwd
root:*:0:0::/var:/bin/sh
bin:*:1:1:bin:/bin:
daemon:*:2:2:daemon:/usr/sbin:
sys:*:3:3:sys:/dev:
adm:*:4:4:adm:/var/adm:
lp:*:5:7:lp:/var/spool/lpd:
sync:*:6:8:sync:/bin:/bin/sync
shutdown:*:7:9:shutdown:/sbin:/sbin/shutdown
halt:*:8:10:halt:/sbin:/sbin/halt
mail:*:9:11:mail:/var/spool/mail:
news:*:10:12:news:/var/spool/news:
uucp:*:11:13:uucp:/var/spool/uucp:
operator:*:12:0:operator:/root:
games:*:13:100:games:/usr/games:
ftp:*:15:14:ftp:/var/ftp:
man:*:16:100:man:/var/cache/man:
nobody:*:65534:65534:nobody:/home:/bin/sh
CRAFTSPERSON:$2$367ffe585fc3070eabc901c03cd561d062ce1b67:0:100::/tmp:/bin/craftsh
restricted:$2$77a44b29010c0e25cd202a7852f02e20077d73a4:0:0::/tmp:/bin/mysh
sshd:*:74:74:Privilege-separated SSH:/tmp:/sbin/nologin
ONTUSER:$2$6003c3d66874a4fd38aecb0b09db563e85a62ad6:0:0::/tmp:/bin/sh





domingo, 13 de enero de 2013

ADS-B en OpenWRT

Esto es un experimento para recibir transmisiones ADS-B de aviones en routers corriendo OpenWrt con un pincho soportado por rtl-sdr (preferiblemente un RTL2832 con tuner R820T).

Esto es posible gracias a la implementacion dump1090 de antirez (https://github.com/antirez/dump1090) y el bajo uso de recursos de cpu que hace comparado con el software rtl_adsb que viene en el paquete de rtl-sdr ordinario.

En  un AR5387un con cpu mips broadcom 6328 BMIPS4350 con apenas 320 bogomips,  emplea alrededor de un 75-80 % de cpu...

Necesitamos además una antena apropiada para la banda de 1090 Mhz teniendo en cuenta que la recepción depende de que no hayan ningún obstáculo entre el emisor y el receptor.

Recomiendo la construcción de una colineal con coaxial de TV/SAT según las instrucciones siguientes: http://www.balarad.net/

Yo uso una de 12 elementos, midiendo unos 1.5 metros y detecciones a 150 km. (mi ubicación es muy mala).

Recompilamos OpenWrt para nuestro router, añadiendo los paquetes rtl-sdr y dump1090 como packages según:

1.- Creando los directorios trunk/packages/rtl-sdr y trunk/packages/dump1090

2.- Ponemos los makefiles siguientes en cada ruta: http://steve-m.de/projects/rtl-sdr/Makefile y https://www.dropbox.com/s/he5hj2rt0kisy20/Makefile

Seleccionamos los nuevos paquetes mediante un make menuconfig, junto al libusb-1.0 (dentro de Libraries) que lo requiere el rtl-usb  y recompilamos OpenWrt.

También podemos descargar los paquetes directamente e instalarlos con opkg:

https://www.dropbox.com/s/zjdad63o09iqmvu/dump1090_0.1.0-1_brcm63xx.ipk
https://www.dropbox.com/s/gxn11kc1c49uyhu/rtl-sdr_0.1.0-1_brcm63xx.ipk

Una vez instalado,arrancamos el dump1090 y tenemos que empezar a ver cosas como



root@OpenWrt:~# dump1090 --net --net-ro-port 47806
Found 1 device(s):
0: Realtek, RTL2838UHIDIR, SN: 00000013 (currently selected)
Found Rafael Micro R820T tuner
Max available gain is: 49.60
Setting gain to: 49.60
Exact sample rate is: 2000000.052982 Hz
Gain reported by device: 49.60


*a00015b8c26800313000004951e2;
CRC: 4abc56 (ok)
DF 20: Comm-B, Altitude Reply.
  Flight Status  : Normal, Airborne
  DR             : 0
  UM             : 0
  Altitude       : 34000 feet
  ICAO Address   : 4951e2

*8d4951e29944f5aee0042e62ee1e;
CRC: 62ee1e (ok)
DF 17: ADS-B message.
  Capability     : 5 (Level 2+3+4 (DF0,4,5,11,20,21,24,code7 - is on airborne))
  ICAO Address   : 4951e2
  Extended Squitter  Type: 19
  Extended Squitter  Sub : 1
  Extended Squitter  Name: Airborne Velocity
    EW direction      : 1
    EW velocity       : 245
    NS direction      : 1
    NS velocity       : 375
    Vertical rate src : 0
    Vertical rate sign: 0
    Vertical rate     : 1



si arrancamos el planeplotter, configurando un receptor AVR TCP/IP a la ip del router con el puerto 47806 por ejemplo tendremos la ubicación de los aviones en tiempo real:

dump1090 --net --net-ro-port 47806 -raw

Podemos simulatear el modo servidor con modo interactivo en consola:

dump1090 --net --net-ro-port 47806 -raw --interactive

Tenemos pues un receptor de ADS-B de coste mínimo y con conexión wifi de tal modo que lo podemos dejar permanentemente lo más cerca posible de la antena y con el planeplotter compartir tráfico con flightradar24 por ejemplo. Esto hace viable además juntar los datos recibidos por varios equipos mediante dump1090 creando una red de receptores ADS-B.





Buena escucha!


PD: el firmware para el router Comtrend AR5387un ya preparado está aquí

FW OpenWrt Trunk ADS-B AR5387un


viernes, 8 de junio de 2012

Versión ASL-26555_CL

Existe una versión de este router distribuida en Chile y otros países de América que difiere del ASL-26555_ES distribuido en España y que emplea un chip flash SPI 25FL064P de 8 MB (0x0800000) en vez del 25FL128P de 16 MB (0x1000000):

El particionado es diferente de modo que el firmware es específico:

[ 4.620000] Creating 8 MTD partitions on "spi0.0":
[ 4.630000] 0x000000000000-0x000000030000 : "uboot"
[ 4.640000] 0x000000030000-0x000000040000 : "devdata"
[ 4.660000] 0x000000040000-0x000000050000 : "rgbd"
[ 4.670000] 0x000000050000-0x000000130000 : "kernel"
[ 4.680000] 0x000000130000-0x0000007e0000 : "rootfs"
[ 4.700000] mtd: partition "rootfs" set to be root filesystem
[ 4.710000] split_squashfs: no squashfs found in "spi0.0"
[ 4.720000] 0x0000007e0000-0x0000007f0000 : "cert"
[ 4.730000] 0x0000007f0000-0x000000800000 : "langpack"
[ 4.750000] 0x000000050000-0x0000007e0000 : "linux"



 Pongo aquí los enlaces del firmware de ramdisk y flasheo adaptados:

Firmware ramdisk ASL 26556_C

Sysupgrade squashfs ASL 26556_C para flashear

(actualizados con extracción de eeprom y MAC de Wifi correcta)

El firmware se escribirá en la partición linux (tamaño 0x790000) una vez que hayamos arrancando con el firmware ramdisk mediante TFTP como explico para el ASL26555_ES con:


mtd -r write <nombre fichero> linux

Sacaremos copia antes de la partición linux desde el firmware RAM a un pendrive formateado en VFAT o EXT3/4 (montado en /mnt/sda1) mirando en /proc/mtd la partición asociada según:

dd if=/dev/mtdX of=/mnt/sda1/copia_linux.bin


lunes, 4 de junio de 2012

Arrancando OpenWrt en ADB D.BG A4001N

Por fin arranca pero por ahora no fucionan el WIFI ni el puerto USB...


[    0.000000] Linux version 3.3.7 (chisco@chisco-aluminio) (gcc version 4.6.3 20120201 (prerelease) (Li2
[    0.000000] Detected Broadcom 0x6328 CPU revision 10b0
[    0.000000] CPU frequency is 320 MHz
[    0.000000] 32MB of RAM installed
[    0.000000] registering 32 GPIOs
[    0.000000] gpiochip_add: registered GPIOs 0 to 31 on device: bcm63xx-gpio
[    0.000000] board_bcm963xx: Boot address 0xb8000000
[    0.000000] board_bcm963xx: CFE version: unknown
[    0.000000] bootconsole [early0] enabled
[    0.000000] CPU revision is: 0002a075 (Broadcom BMIPS4350)
[    0.000000] board_bcm963xx: board name: 963281T_TEF
[    0.000000] Determined physical RAM map:
[    0.000000]  memory: 02000000 @ 00000000 (usable)
[    0.000000] Initrd not found or empty - disabling initrd
[    0.000000] Zone PFN ranges:
[    0.000000]   Normal   0x00000000 -> 0x00002000
[    0.000000] Movable zone start PFN for each node
[    0.000000] Early memory PFN ranges
[    0.000000]     0: 0x00000000 -> 0x00002000
[    0.000000] On node 0 totalpages: 8192
[    0.000000] free_area_init_node: node 0, pgdat 8029d730, node_mem_map 81000000
[    0.000000]   Normal zone: 64 pages used for memmap
[    0.000000]   Normal zone: 0 pages reserved
[    0.000000]   Normal zone: 8128 pages, LIFO batch:0
[    0.000000] Reserving 0MB of memory at 0MB for crashkernel
[    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: 8128
[    0.000000] Kernel command line:  root=/dev/mtdblock2 rootfstype=squashfs,jffs2 noinitrd console=ttyS0
[    0.000000] PID hash table entries: 128 (order: -3, 512 bytes)
[    0.000000] Dentry cache hash table entries: 4096 (order: 2, 16384 bytes)
[    0.000000] Inode-cache hash table entries: 2048 (order: 1, 8192 bytes)
[    0.000000] Primary instruction cache 32kB, VIPT, 4-way, linesize 16 bytes.
[    0.000000] Primary data cache 32kB, 2-way, VIPT, cache aliases, linesize 16 bytes
[    0.000000] Memory: 29416k/32768k available (2219k kernel code, 3352k reserved, 396k data, 196k init,)
[    0.000000] NR_IRQS:128
[    0.000000] Calibrating delay loop... 318.46 BogoMIPS (lpj=636928)
[    0.036000] pid_max: default: 32768 minimum: 301
[    0.040000] Mount-cache hash table entries: 512
[    0.048000] NET: Registered protocol family 16
[    0.276000] registering PCI controller with io_map_base unset
[    0.284000] bio: create slab <bio-0> at 0
[    0.292000] PCI host bridge to bus 0000:00
[    0.296000] pci_bus 0000:00: root bus resource [mem 0x10f00000-0x11efffff]
[    0.300000] pci_bus 0000:00: root bus resource [??? 0x00000000 flags 0x0]
[    0.304000] pci 0000:00:00.0: [14e4:6328] type 1 class 0x000604
[    0.304000] pci 0000:00:00.0: PME# supported from D0 D3hot
[    0.304000] pci 0000:01:00.0: [14e4:a8d8] type 0 class 0x000280
[    0.304000] pci 0000:01:00.0: reg 10: [mem 0x00000000-0x00003fff 64bit]
[    0.304000] pci 0000:01:00.0: supports D1 D2
[    0.304000] pci 0000:00:00.0: BAR 8: assigned [mem 0x10f00000-0x10ffffff]
[    0.308000] pci 0000:01:00.0: BAR 0: assigned [mem 0x10f00000-0x10f03fff 64bit]
[    0.312000] pci 0000:00:00.0: PCI bridge to [bus 01-01]
[    0.316000] pci 0000:00:00.0:   bridge window [mem 0x10f00000-0x10ffffff]
[    0.320000] PCI: Enabling device 0000:00:00.0 (0000 -> 0002)
[    0.324000] Switching to clocksource MIPS
[    0.332000] NET: Registered protocol family 2
[    0.336000] IP route cache hash table entries: 1024 (order: 0, 4096 bytes)
[    0.344000] TCP established hash table entries: 1024 (order: 1, 8192 bytes)
[    0.352000] TCP bind hash table entries: 1024 (order: 0, 4096 bytes)
[    0.360000] TCP: Hash tables configured (established 1024 bind 1024)
[    0.364000] TCP reno registered
[    0.368000] UDP hash table entries: 256 (order: 0, 4096 bytes)
[    0.376000] UDP-Lite hash table entries: 256 (order: 0, 4096 bytes)
[    0.384000] NET: Registered protocol family 1
[    0.388000] PCI: CLS 0 bytes, default 16
[    0.388000] audit: initializing netlink socket (disabled)
[    0.396000] type=2000 audit(0.396:1): initialized
[    0.400000] squashfs: version 4.0 (2009/01/31) Phillip Lougher
[    0.408000] JFFS2 version 2.2 (NAND) (SUMMARY) (LZMA) (RTIME) (CMODE_PRIORITY) (c) 2001-2006 Red Hat,.
[    0.420000] msgmni has been set to 57
[    0.420000] io scheduler noop registered
[    0.424000] io scheduler deadline registered (default)
[    0.432000] bcm63xx_uart.0: ttyS0 at MMIO 0xb0000100 (irq = 36) is a bcm63xx_uart
[    0.440000] console [ttyS0] enabled, bootconsole disabled
[    0.460000] bcm63xx-hsspi bcm63xx-hsspi.0: registered master spi0
[    0.460000] spi spi0.0: setup mode 0, 8 bits/w, 40000000 Hz max --> 0
[    0.460000] m25p80 spi0.0: found mx25l12805d, expected m25p80
[    0.468000] m25p80 spi0.0: mx25l12805d (16384 Kbytes)
[    0.472000] bcm63xxpart: CFE boot tag found with version 6 and board type 963281T_TEF
[    0.480000] bcm63xxpart: Partition 0 is CFE offset 0 and length 10000
[    0.488000] bcm63xxpart: Partition 1 is kernel offset 10100 and length eff00
[    0.492000] bcm63xxpart: Partition 2 is rootfs offset 100000 and length ef0000
[    0.500000] bcm63xxpart: Partition 3 is nvram offset ff0000 and length 10000
[    0.508000] bcm63xxpart: Partition 4 is linux offset 10000 and length fe0000
[    0.516000] bcm63xxpart: Spare partition is offset 2c0004 and length d2fffc
[    0.524000] 5 bcm63xxpart partitions found on MTD device spi0.0
[    0.528000] Creating 5 MTD partitions on "spi0.0":
[    0.532000] 0x000000000000-0x000000010000 : "CFE"
[    0.540000] 0x000000010100-0x000000100000 : "kernel"
[    0.548000] mtd: partition "kernel" must either start or end on erase block boundary or be smaller thy
[    0.564000] 0x000000100000-0x000000ff0000 : "rootfs"
[    0.572000] mtd: partition "rootfs" set to be root filesystem
[    0.576000] mtd: partition "rootfs_data" created automatically, ofs=2C0000, len=D30000
[    0.584000] 0x0000002c0000-0x000000ff0000 : "rootfs_data"
[    0.592000] 0x000000ff0000-0x000001000000 : "nvram"
[    0.600000] 0x000000010000-0x000000ff0000 : "linux"
[    0.608000] bcm63xx-hsspi bcm63xx-hsspi.0: registered child spi0.0
[    0.644000] bcm63xx-wdt bcm63xx-wdt:  started, timer margin: 30 sec
[    0.652000] Registered led device: 963281T_TEF::internet
[    0.652000] Registered led device: 963281T_TEF::power
[    0.652000] Registered led device: 963281T_TEF::internet-fail
[    0.656000] Registered led device: 963281T_TEF::power-fail
[    0.656000] Registered led device: 963281T_TEF::wps
[    0.656000] Registered led device: 963281T_TEF::dsl
[    0.656000] TCP westwood registered
[    0.660000] NET: Registered protocol family 17
[    0.664000] 8021q: 802.1Q VLAN Support v1.8
[    0.680000] VFS: Mounted root (squashfs filesystem) readonly on device 31:2.
[    0.688000] Freeing unused kernel memory: 196k freed
[    3.252000] bcm63xx_enetsw bcm63xx_enetsw.0: link UP on Port 4, 100Mbps, full-duplex
[    3.412000] roboswitch: Probing device eth0:
[    3.416000] bcm63xx_enet: could not find a used port with phy_id 0, assuming phy is external
[    3.424000] No Robo switch in managed mode found, phy_id = 0xffffffff
[    3.432000] roboswitch: Probing device eth1: No such device
[    3.440000] roboswitch: Probing device eth2: No such device
[    3.444000] roboswitch: Probing device eth3: No such device
[   10.880000] Compat-wireless backport release: compat-wireless-2012-05-16-3-gde86a47
[   10.888000] Backport based on wireless-testing.git master-2012-05-29
[   10.896000] compat.git: wireless-testing.git
[   10.952000] cfg80211: Calling CRDA to update world regulatory domain
[   10.956000] cfg80211: World regulatory domain updated:
[   10.964000] cfg80211:   (start_freq - end_freq @ bandwidth), (max_antenna_gain, max_eirp)
[   10.972000] cfg80211:   (2402000 KHz - 2472000 KHz @ 40000 KHz), (300 mBi, 2000 mBm)
[   10.980000] cfg80211:   (2457000 KHz - 2482000 KHz @ 20000 KHz), (300 mBi, 2000 mBm)
[   10.988000] cfg80211:   (2474000 KHz - 2494000 KHz @ 20000 KHz), (300 mBi, 2000 mBm)
[   10.996000] cfg80211:   (5170000 KHz - 5250000 KHz @ 40000 KHz), (300 mBi, 2000 mBm)
[   11.004000] cfg80211:   (5735000 KHz - 5835000 KHz @ 40000 KHz), (300 mBi, 2000 mBm)
[   11.468000] SCSI subsystem initialized
[   11.512000] There is already a switch registered on the device 'eth0'
[   11.520000] roboswitch: Probing device eth1: No such device
[   11.524000] roboswitch: Probing device eth2: No such device
[   11.532000] roboswitch: Probing device eth3: No such device
[   11.836000] usbcore: registered new interface driver usbfs
[   11.840000] usbcore: registered new interface driver hub
[   11.852000] usbcore: registered new device driver usb
[   12.544000] Broadcom 43xx driver loaded [ Features: PNL ]
[   12.572000] Button Hotplug driver version 0.4.1
[   13.376000] PPP generic driver version 2.4.2
[   14.392000] ip_tables: (C) 2000-2006 Netfilter Core Team
[   14.676000] NET: Registered protocol family 24
[   14.896000] ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
[   14.940000] nf_conntrack version 0.5.0 (462 buckets, 1848 max)
[   15.636000] ohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driver
[   15.848000] usbcore: registered new interface driver snd-usb-audio
[   15.972000] Initializing USB Mass Storage driver...
[   15.976000] usbcore: registered new interface driver usb-storage
[   15.984000] USB Mass Storage support registered.
[   21.064000] bcm63xx_enetsw bcm63xx_enetsw.0: link UP on Port 4, 100Mbps, full-duplex
[   21.076000] device eth0 entered promiscuous mode
[   21.080000] br-lan: port 1(eth0) entered forwarding state
[   21.088000] br-lan: port 1(eth0) entered forwarding state
[   23.092000] br-lan: port 1(eth0) entered forwarding state
[   34.676000] jffs2_scan_eraseblock(): End of filesystem marker found at 0x0
[   34.692000] jffs2_build_filesystem(): unlocking the mtd device... done.
[   34.700000] jffs2_build_filesystem(): erasing all blocks after the end marker...