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

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!

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

(more…)

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

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

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

(more…)

Solidoodle: A proper fix Z axis wobble

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
(more…)

openwrt-sunxi: progress report

I finally managed to find a few spare minutes and make some serious progress on this port.

So, what’s new:

  • Rebased against the current openwrt trunk
  • Initial router name/model  stuff support via uboot env.
  • Now with stable 3.4 kernel from sunxi-3.4 branch. OpenWRT compiles kernel and working module packages
  • sun4i-specific modules like ahci, ir, i2c, etc. are now compiled and loaded by OpenWRT.
  • Instructions for building can be found at the github repo

wrt

 

Solidoodle & Arch linux

Okay, it’s been a while since I got my nice & shiny 3d printer from solidoodle. A few people have asked, so there go a few tips, to make the software up running on Arch Linux. I’ll be posting a detailed review sometime later, since I’m kind if buried under the ongoing projects.


(more…)

Simple things that look complex: ping from android

Coding for a mobile platform has always been a frustrating experience ever since J2ME. Right now I really hope, that Jolla Mobile will succeed and roll their thingie to the market, since both iOS and android are smoking crap. But for now – I choose droid as a lesser evil.
So, a few days ago I needed to ping the internets from my app, to check if the connection is live. It’s been less than a week since a friend told me of all the ‘fun’ he had with SCNetworkCheckReachabilityByName on iOS for that purpose.

(more…)