Necromancer's notes

Random tech stuff

  • Blog
  • Software
  • About/Contact

Ditching the x86 – moving on to armv7l

Posted by Necromant on 21.05.2013
Posted in: hardware, software. Leave a Comment

My home server has a long story. It all started with a Pentium 4, an old 20GB HDD and FreeBSD 6.2 … hell, I don’t even remember the exact year.
Anyway, after a few years, the hardware was finally put to rest, since it died and got resurrected thrice, I got an Intel Atom D410-based miniATX board, switched to linux, first debian, then agilia, then arch… Anyway, it used to be a nice server for personal needs, that crashed only on occasional HAD-effect, so it was… sufficient.
Now, the time has come to move on, to arm. The benefits were simple and straight:

  • 10W peak power consumption
  • Fully passive cooling
  • eMMC for the root partition
  • 4 cores!
  • Always a serial terminal, starting from uboot phase, so that I don’t have to carry a monitor to the closet where it is stationed.

I picked ODROID-X2 based around Exynos4212 Prime. ODROID-U2 looked worse, since had NAND soldered onboard. eMMC looked easier to replace. And the benchmarks said eMMC was faster.

IMG_20130521_133759

So, here go my adventures with this hardware.
Continue Reading

STLink as a serial terminal

Posted by Necromant on 06.05.2013
Posted in: software. Tagged: st-term, stlink, stm32. 4 comments

A usual rant goes towards ST guys for their mindless design*. I don’t really know anyone, who does some heavy app development with no serial terminal for debugging (Or may be I don’t know many of them?). You know, gdb is good, but a good old ‘dmesg’-like stuff is usually even more helpful.
Anyway, while other people are trying to discover traces of sanity of the ST people by reversing STLinkv2 and discovering only huge holes in security so far, I decided to go a different way that works just fine with STLinkV1 and STLinkV2.
My first idea was to stuff the VCP example into the stlink’s uC (which is an STM32F103C8T6) and throw a little wires, but in the end – I didn’t want to ditch STLink completely (It helped me out a few times). Ideas? Sure!

IMG_20130506_100917

First step. What does STLink do? Right, apart from that breakpoint/step voodoo it writes and reads memory. Sounds good? Good! Enough to do pretty much anything.
Continue Reading

solidoodle: pushing the thing to the limits. 0.050 mm layers.

Posted by Necromant on 29.04.2013
Posted in: hardware. Tagged: extreme engineering, solidoodle. Leave a Comment

It’s been a while, since I’ve posted a anything  about this shiny toy of mine. This doesn’t mean I’m doing nothing about it. And I’m adding a hack every weekend or two. Unfortunately, this is definitely NOT the thing you can grab and start printing happily, as are most of the sub – 5k$ printers. ( Don’t believe the marketing BS!)

So far, I’ve added a better filament feed, a usb camera mount, a cooling fan, fixed the Z axis wobble… partly…

Well, last time I replaced the lead nut with a custom higher one, I had a very slight wobble remaining. This one was due to the fact that the centers of the Z axis rod and the motor shaft were not perfectly aligned. That was still a little bit too annoying, when it came to 0.1mm prints. lawsy recently made a fix in the firmware but adding another variable that needs experimental calibration certainly doesn’t fit what I wanted. Anyway, 5/16 rod also annoyed the hell out of me (I prefer metric stuff, that’s my religion, bear with it!), so I decided to make a mechanical fix first. And the idea was to throw away that crap, and place something better.
Continue Reading

Some black magic: bash, cgi and file uploads

Posted by Necromant on 18.04.2013
Posted in: software. Tagged: bash, cgi, voodoo. Leave a Comment

Before you declare me an insane old man, I have to say, that I needed it for an embedded board with only 64MiBs of RAM. And (mostly due to the specifics of the tasks), I ended up using bash hooked to lighttpd via cgi. Bringing on heavy artillery (php or python), really complicated the task, since I mostly needed the outputs of different shell utils.
Anyway, I quickly got to the part where I needed to handle POST requests to upload binary files. First, I googled for a solution, and one of them eventually did what I needed. But alas, it had a drawback.
Continue Reading

android and dnsmasq: making a better dnsmasq wrapper

Posted by Necromant on 10.04.2013
Posted in: software. Tagged: android, dnsmasq, wrapper. Leave a Comment

A few posts ago, I wrote about making android’s dnsmasq more usable by turning on local hostname resolution. Since I use my android phone as a pocket server, dnsmasq plays a vital role here.
However, one thing was bad – whenever I used usb tether connection to my PC, the whole dns thingie did not work. Why?

So, a little theory. When I enable the wifi ap mode, an interface called ap0 is brought up with a static ip 192.168.43.1.
Whenever I turn on usb tethering, usb0 pops into the existence with ip 192.168.42.129.
(On other mobile phones these settings can differ)
Fine, so when we resolve our pocket server from within the usb0 network, we want to get 192.168.42.129, and when via a wireless network – 192.168.43.1
I started by adding two distinct entries in /etc/hosts

192.168.43.1 anomalia anomalia.portable git.anomalia p.anomalia
192.168.42.129 anomalia anomalia.portable git.anomalia p.anomalia

Did it work? No! Why?
Continue Reading

Getting newer 2g/3g/4g dongles to work in debian.

Posted by Necromant on 30.03.2013
Posted in: software. Tagged: 3g, debian. Leave a Comment

Okay, this is just a small tip. All newer dongles, instead of having you to undergo some nasty sex with pppd over serial to make them work, have an ethernet interface, like cdc-ncm, sierra_net and etc. So, once you plug those, you usually see an extra interface when doing ifconfig -a.
So, how should we bring up the interface?
It is done via sending

AT^NDISDUP=1,1,"apn"

command via the serial interface (it shouldn’t be locked via any pin number whatsoever, if it is – we need to issue AT+CPIN before that).
Newer network-manager takes care of them, but on a headless box or some singleboard embedded device this is a no-go. In my case I use debian on my embedded box, so I threw up this very snipplet to /etc/network/interfaces:

iface wwan0 inet dhcp
        pre-up echo -ne '\r\nAT^NDISDUP=1,1,"internet"\r\n' > /dev/ttyUSB0 && sleep 15
        dns-nameservers 127.0.0.1 8.8.8.8

It gives a 15 second delay, so that the modem can bring up the interface, and adds 127.0.0.1 as a nameserver, since I’m using dnsmasq for local dns stuff. Replace /dev/ttyUSB0 with whatever port you need. Once done – use

ifup wwan0

or

ifdown wwan0

To get this interface up and down.
It’s also a good idea to ping google or something once every 5 to 10 seconds, because after a few hours of inactivity the modem drops the connection, and while now there is no mechanism in cdc_ncm except for a note in dmesg that the connection has been dropped.

There’s a server in my pocket!

Posted by Necromant on 19.03.2013
Posted in: hardware, software. Tagged: android, chroot, debian, java. 10 comments

I’m not a psychopath, I’m just very creative.
(c) Harry Potter and the Methods of Rationality

Taking part in competitions like “eurobot”, where you have to do some coding in extreme conditions, on/under a table, on the floor, etc. and a few other trips like that convinced me that I should definitely make something more of my cell phone. Something, that will help me out in this case.

So, we have:

  • A dumb brick called ‘HD7 Pro’ from china, with android 2.3.5. One and a half years old.
  • /dev/brains
  • A few hours of free time

What we want to get:

  • A portable server with lighttpd, ssh, git, etc
  • WiFi AP with local dns, internet tethering (if we’re not roaming!)

2013-03-18-00-19-06

Continue Reading

Работаем с мегафоном через PhantomJS (часть 1)

Posted by Necromant on 25.02.2013
Posted in: software. Tagged: phantomjs, въеб-2.0, мегафон. 2 comments

Итак, валяется у меня на даче на чердаке модем, который подцеплен к серверу, и через который ко мне идут интернеты. И через интернеты я иногда заглядываю как там и что без меня происходит. И все бы хорошо, но иногда хочется узнать, сколько осталось там траффика.
Вариантов тут было несколько.

  • USSD запрос до провайдера.
    Чревато занятиями любовью с /dev/ttyUSB* для отправки USSD и парсингом ответа с последующим вырезанием рекламы. Но так как один такой порт у меня оккупировал gammu-smsd, а на другом висит самописная приблуда для мониторинга качества соединения и переключения на 2g, в случае если вышка 3g “упадет”… (почему не доверяю переключаться самостоятельно модему – это отдельная история). В обещем, вкрячивать в эту штуку что-то еще мне ой как не хочется.
    Да и, как выяснилось, во время отправки USSD иногда мой хуавей рвет соединение. Отпадает.
  • Отправлять SMS и парсить ответ.
    C gammu-smsd это можно было бы сделать досточно быстро, да вот в силу неизбежной необходимости работать со страницей мегафона, этот вариант отпал.
  • Доступ для автоматизированных систем (который проскакивал в некоторых софтинах, типа BalanceRobot под андройд). Да вот только после 10 минут гуглежа документации по нему так и не нашлось.
  • Забирать http://user.moscow.megafon.ru и парсить содержимое.

Continue Reading

bash + javascript + html + css = gpiohttpd

Posted by Necromant on 03.02.2013
Posted in: hardware, software. Tagged: bash, gpio, http, openwrt, proof-of-concept. Leave a Comment

magic people, voodoo people

(с) Prodigy

I recently saw a post on HaD  where a guy on (sic!) Raspberry Pi, blinks leds using apache2 + php + mysql.
I didn’t even want to find out what the heck did he need mysql for, since a more insane idea immediately came to my mind…

shot
Continue Reading

Solidoodle: A proper fix Z axis wobble

Posted by Necromant on 13.01.2013
Posted in: hardware. Tagged: solidoodle, wobble, z axis. 1 comment

5/16 screw tap?
Just take this heresy to Mordor and drown in the lava of mount Doom!
And use only metric stuff we have a plenty right here.
(c) A salesman at the local hardware store

 

Okay, fixing Z axis wobble, take 2, the proper fix.These instructions are quite complex, so make sure you have all the instrument and skills required. Otherwise, go for simpler lawsy’s fix.
And take care not to kill yourself trying to do it.
It all took about 12 hours of experimenting to get it working properly + a week or so seeking out the 5/16 screw taps throughout the city hardware marketplaces.

IMG_20130112_210544
Continue Reading

Posts navigation

← Older Entries
    • English
      • Русский (Russian)
  • Friends

    • Crafting.be
    • Хорошая музыка
  • Meta

    • Log in
    • Entries RSS
    • Comments RSS
    • WordPress.org
Proudly powered by WordPress Theme: Parament by Automattic.