May 03, 2012

质量差的电源插座

By Xiangfu Liu

这个电源插座接了 41 个 Icarus(1000W),一台PC(200W),三个13口的USB HUB,运行了一个月后就变成下图的样子了。插座烧了后,问题是接在这个插座上的电脑的 USB 口全部不好用了。一点电都没有了。还好 Icarus 都还没问题。推荐 80 块以上的电源插座,并把家里质量不好的插座都扔掉。要不然。。。

在 ngzhang 那里学到了一条中国插座定理:插座不拆不能用,或者只买 贝尔金 的或者 APC 的。

May 02, 2012

Mobile Platform at the Toronto Firefox Work Week

By Chris Lord

For those that aren't already aware, many Mozillians gathered last week in Toronto to Maximise Synergy. Seeing as there have been updates for the UX team and the Firefox/Mobile UI team, I think it'd be worth having a similar update for mobile platform. Some fantastic work is going on in this area, and people deserve kudos :)

  • Kartikaya Gupta (aka kats) continues to do sterling work, fixing an inhuman amount of bugs. Most prominently, kats has been working on our display-port 'strategies', code that allows us to make the most of our rendering time and, thus, reduce checkerboarding. He's also been working on our checkerboard measurement, augmenting and refining our tests and test-method to make sure we're always pushing ourselves. This, alongside much general bug-fixing work.
  • Benoit Girard (aka BenWa) is part of the gfx team, all of whom have been helping us out for the past few months, getting our performance back to a competetive level. Benoit's tiled rendering patches finally landed, which make a huge difference to performance. Benoit has also been working on some useful remote profiling tools, which he blogs about here.
  • James Willcox (aka snorp) continues to battle Flash to get us the best Flash experience in an Android browser (ironic, right?) snorp's work to get more accurate positioning of Flash elements landed, along with his work to replace elements with a snapshot during page movement on Froyo/Gingerbread, completing the experience.
  • Brad Lassey (aka blassey) managed to get enough time to do some coding alongside his usual cat-herding responsibilities, and got us a low-res page cache. This means that in the rare situation that our rendering can't keep up, instead of showing checkerboard, we show a low-resolution rendering of the page. It's possible that this content can go stale, but we find it provides a much better experience than showing either a blank colour or checkerboard. This works much better than any of us expected it to, and for me at least, was the turning point after which I find our browser much easier to recommend.
  • And me? I managed to get my retained tiles patch landed. Currently, we render the page into system-memory tiles, which we then upload to the GPU. My patch keeps a hold of the GPU tiles and metrics for a while after they're invalidated. Again, when our renderer can't keep up, it renders these old tiles into the space instead of rendering nothing. This mostly helps quick changes of direction and zooming out after zooming in. I also spent some time fixing up the low-res cache work, then fixing up my fix-ups, as is my custom :) Hopefully, preliminary fixed-position layer support will also land soon.

Much other work also occured, and sorry for missing anyone out that I surely did. It's worth mentioning that the gfx team have been a huge help and have been working extra-hard for months now, helping us get to where we are today (and hopefully beyond!) I had a great (and hard) time during my stay and am very much looking forward to our upcoming release :)

Upgrading to Precise

By Andrew Cowie

The latest release of Ubuntu, version 12.04 aka Precise, has a lot of updates we’ve been waiting on for a while — GNOME 3.4, Haskell 7.4.1, and a huge stack of bugfixes. On the desktop side, quite a number of Linux kernel vs X video modes vs suspend glitches have gone away. That’s fantastic. During most of Oneiric, my laptop was freezing and needing a hard reset at least once a day. Tedious. So I’m quite pleased to report that running Precise, Linux 3.2, gdm, and GNOME 3.4, things are vastly more stable.

Getting upgraded to Precise, however, has not been a pleasant experience.

First we’ve had unattended-upgrades overwriting any configuration stating “no automatic upgrades”. The number of non-technical friends who were set to “security updates only” calling in wondering why a “big upgrade” happened and now their computers don’t work has been staggering. Needless to say we nuked unattended-upgrades from all of our systems a hurry, but for those people it was already too late.

Several desktop upgrades failed half-way through because dpkg suddenly had unresolved symbol errors. Fortunately I was able to work out the missing library binary and manually copy it in from another machine, which was enough to get package system working. Hardly auspicious.

Server side was fraught with difficulty. You cannot yet upgrade from Lucid to Precise. It breaks horribly.

E: Could not perform immediate configuration on 'python-minimal'. Please
see man 5 apt.conf under APT::Immediate-Configure for details. (2)

Brutal. I tried working around it on one system by manually using dpkg, but that just led me into recursive dependency hell:

# cd /var/cache/apt/archvies
# dpkg -r libc6-i686
# dpkg -i libc6_2.15-0ubuntu10_i386.deb
# dpkg -i libc-bin_2.15-0ubuntu10_i386.deb
# dpkg -i multiarch-support_2.15-0ubuntu10_i386.deb
# dpkg -i xz-utils_5.1.1alpha+20110809-3_i386.deb
# dpkg -i liblzma5_5.1.1alpha+20110809-3_i386.deb
# dpkg -i dpkg_1.16.1.2ubuntu7_i386.deb
# apt-get dist-upgrade

Huh. That actually worked on one system. But not on another. Still slammed into the python-minimal failure. For that machine I couldn’t mess around, so I had to give up and did a re-install from scratch. That’s not always feasible and certainly isn’t desirable; if I wanted to be blowing systems away all the time and re-installing them I’d be running Red Hat.

Anyway, I then located this bug about being unable to upgrade (what the hell kind of QA did these people do before “releasing”?) where, very helpfully, Stefano Rivera suggested a magic incantation that gets you past this:

# apt-get install -o APT::Immediate-Configure=false -f apt python-minimal
# apt-get dist-upgrade

(I had tried something very close to this, but didn’t think of doing both apt and python-minimal. Also, it hadn’t occurred to me to use -f. Ahh. For some reason one always sees apt-get -f install not apt-get -f install whatever-package-name).

Ta-da.

AfC

May 01, 2012

mForce 200 designed base on Icarus (Icarus 衍生板 mForce200)

By Xiangfu Liu

mForce200 designed by lijiangchun base on Icarus. you can buy it at his taobao shop, he release designed source files at google code. it have 2 SPARTAN-6 XC6SLX150-FGG484BIV1027 chips, using a big heat sink instead a noise fan. it’s using a ATX power connecter and a strange USB Standard-A receptacle for USB connect.

May 1st, I received the device, after 12 hours test, it give ~200MHS, Utility: 2.6/m. not as good as Icarus. by talking with the author <lijangchu at gmail dot com>, there are two switches missing in this boards. he will send me a new one. then I will test again and update this page.

May 3rd. I received the new boards. this working one give ~380MHS, Utility: ~5.2/m, same as Icarus, from the power meter, idle it needs ~4.6W, mining needs ~20W, mForce 200 cgminer status page: http://downloads.openmobilefree.net/Icarus/miner.mForce200.php

 First reaction was: I want my money back
 Quality: bad
 Heat sinks placement: bad
 USB cable: bad (2 USB-A plug on both side)
 Power supply/plug: bad (the power cable is already exposed)
 Heat sinks: bad (form factor)
 Hardware errors(Discarded): too high 6% (Icarus only give 0.1% ~ 0.8%)
 

Working One:


Two Switches Missing:

April 30, 2012

By Sean Moss-Pultz

I blocked out a Sunday afternoon and thoroughly enjoyed “reading” Stefan Sagmeister‘s Things I Have Learned In My Life So Far. Maxims are as follows:

  1. Helping other people helps me.
  2. Having guts always works out for me.
  3. Thinking that life will be better in the future is stupid. I have to live now.
  4. Starting a charity group is surprisingly easy.
  5. Being not truthful always works against me.
  6. Everything I do always comes back to me.
  7. Assuming is stifling.
  8. Drugs feel great in the beginning and become a drag later on.
  9. Over time I get used to everything and start taking for granted.
  10. Money does not make me happy.
  11. My dreams have no meaning.
  12. Keeping a diary supports personal development.
  13. Trying to look good limits my life.
  14. Material luxuries are best enjoyed in small doses.
  15. Worrying solves nothing.
  16. Complaining is silly. Either act or forget.
  17. Everybody thinks they are right.
  18. If I want to explore a new direction professionally, it is helpful to try it out for myself first.
  19. Low expectations are a good strategy.
  20. Everybody who is honest is interesting.

Every seven years Sagmeister shuts down his studio and goes on a year-long sabbatical (no client work). I’m fascinated by that – probably because I lack the courage to try it myself.

 

April 18, 2012

Automatic Camera by Using OpenWrt (用 OpenWrt 制作自动相机)

By Xiangfu Liu

 

I setup the TP-Link MR11U with Logitech C270 as a automatic camera. it take picture every one second, TP-LINK_MR11U_C270_OpenWrt_mjpeg-streamer.tar.bz2 is the origin pictures in 30 minutes. brower online at here: http://downloads.openmobilefree.net/OpenWrt/TP-LINK_MR11U_C270_OpenWrt_mjpeg-streamer/

There are three different version of MR11U, Ver1.0/Ver1.1/Ver2.0, Ver1.0/Ver1.1 have power switch and two more buttons QSS and RESET, Ver2.0 have only one power switch. we can flash OpenWrt image from the web interface under Ver1.0/Ver1.1, but for Ver2.0 we have to flash OpenWrt under U-Boot command. which means you have to open the case connect the serial console to your computer. I have updated the OpenWrt MR11U wiki page for reflash detail.

Here is steps how to setup TP-Link MR11U as a automatic camera:

  1. Flash this OpenWrt image to the MR11U 3G Router. this image included uvc driver for Logitech C270. here is more information about this image.
  2. By default. it will stream the video. we needs change the /etc/init.d/mjpg-streamer line: –output “output_http.so –port $port” to “-o “output_file.so -f /tmp/ -d 1000″
  3. Reboot the MR11U or restart mjpg-streamer service, then it will automatic take picture every second.
Those two pictures showed another device that we have removed case and try to make the C210 camera and MR11U on one small PCB, this one is not what I am using, I will upload my device picture tomorrow.
~~~~~~~~
今天早上,在去 Icarus 贴片工厂之前,我把我的 TP-Link MR11U 和 Logitech C270 配置成了一个自动的照相机,配置成第秒自动拍一张照片,TP-LINK_MR11U_C270_OpenWrt_mjpeg-streamer.tar.bz2 是 30 分种过程中拍摄的原始图片,没有经过加工。 在线浏览: http://downloads.openmobilefree.net/OpenWrt/TP-LINK_MR11U_C270_OpenWrt_mjpeg-streamer/
MR11U 有三种不同的硬件版本 Ver1.0/Ver1.1/Ver2.0,Ver1.0/Ver1.1 有三个按键,一个电源,两个按键分别是 QSS 和 RESET,Ver2.0 就只有一个电源键,Ver1.0/Ver1.1可能直接从网页界面直接刷成 OpenWrt, 由于 Ver2.0 的网页界面增加了镜像检查,所以我们有能直接从 U-BOot 进行刷机,我们必须找开外壳找到串口,我已经把所有的刷机信息都更新到 OpenWrt MR11U 的维基页
这里是 TP-Link MR11U 自动相机的配置过程:
  1. 将 MR11U 刷上 OpenWrt 镜像,这个镜像内置了 UVC 的驱动。直接支持 罗技C270, 这里有关于这个镜像的更多信息
  2. 默认我将 mjpg-streamer 配置成视频了。我们需要把安改成一秒存储一个图片。修改 /etc/init.d/mjpg-streamer 将这行 –output “output_http.so –port $port” 改成 “-o “output_file.so -f /tmp/ -d 1000″
  3. 重启路由器或者重启 mjpg-streamer 这个服务。就可以自动拍照了

这两张图片是 MR11U 和 C210 的图片,不是我用的设备。明天我会把我用的设备拍照发到这里。(阳光下拍照,效果会好一点)

 

Icarus SMT factory(Icarus 贴片工厂)

By Xiangfu Liu

~~~~~~~~

今天参观了 Icarus 的贴片工厂凯顺电子,工厂在北京北六环附近,成立有一年左右,目前有大约 40 人在这里工作。这是我第一次走进贴片工厂,几乎所有的东西对我来说都是未知领域,一进门的时候我就注意到了他们的铁制门帘,所有的门上都安装了这种铁制的门帘,从图片上你能注意到这种铁制门帘都是有接地的。每当有人进入操作间的时候都会很自然的碰一下铁门帘来放掉身体上携带的静电。

Icarus 安排在中午 11 点贴片,这里有三台SONY的贴片机(两台130,一台209),一台11区温度的回流焊。整个过程需要 4 个人完成其中 2 个人都是检查 Icarus 将结果/意见反馈给贴片机的操作人员,一但准备工作完成, 90 片 Icarus 会在2~3个小时内完成,其它的就是手工插焊的工作,被安装在明天进行。

整个参观的过程都由生产总监 Steven Lin 给我做介绍。这里要非常感谢 Steven Lin。

北京市凯顺电子技术有限公司,电话:010-89787870,邮箱:steven_lin01@126.com

~~~~~~~~

April 07, 2012

X11 tips and tricks

By Talpadk

Useful commands for X11

Welcome to this short summary of useful commands for X11.
I have written it to avoid having to resort to googling next time I forget Xephyr.
Also it might be interesting for others as well…

Servers inside your X11 server

running xoo

xoo with a ipaq3800 skin

Why would you want to run a X11 server on your X11 display

Well for starters you might want to try out your UI on a device with a lower screen resolution than your development machine.
You might also want to code an application running at a different colour depth than you desktop, maybe a rotozoomer in 16bit ;)
You may also simply want to try out a couple of applications on a low res. screen prior to buying a table with a low res. screen…

Xoo

A wrapper for xnest and Xephyr that allows one to create a skinned X11 display.
You can even have working buttons that you can click.

sudo apt-get install xoo

Xnest

Haven’t used it myself.
As far as I know Xephyr has some advantages in the supported extensions over xnest

sudo apt-get install xnest

Xephyr

Based on the kdrive xserver supporting extensions such as render and composite.
xnest package actually recommends this package over it self…

sudo apt-get install xserver-xephyr

Utilities and tools

Xpra aka. “screen” and turbo for X11 applications

Screen is a wonderful tool for command line tools.
Xpra gives you the same capacity to leave the program running on the remove even if you close/losses the connection.
Also xpra “compresses” the stream of X11 commands by using a different protocol than X11, reducing the problems caused by low latency connections.

sudo apt-get install xpra

April 06, 2012

Device profiles in Qt5

By Holger "zecke" Freyther

OpenGL and Devices

The future of Qt's graphic stack is OpenGL (ES 2.0), but this makes things more complicated in the device space. The library names and low level initialization needed for OpenGL is not standardized. This means that for a given board one needs to link libQtGui to different libraries and one needs to patch the QPA platform plugins to add device specific bits. The GPU vendor might provide DirectFB/eGL integration but one needs to call a special function to bind eGL to DirectFB.

Historic Approach

The historic Qt approach is to keep patches out of tree, custom mkspecs files that need to be copied into Qt before building. I have had two issues with this approach:
  1. Device support should be an essential part of Qt5.
  2. Build testing (and later unit testing) is more complicated.

Device Profile Proposal

The approach we took is a pragmatic one, it should be easy for device manufacturers to do the right thing, it should not be a burden for the maintainability of Qt. After some iterations we ended up with device profile proposal and began to implement to it. Most of it is merged by now.

Key Features

It begins with the ./configure script that now has the -device=DEVICE and -device-option KEY=VALUE to select a device and to pass options, e.g. additional include paths, BSP package, to Qt. The second part is a device to influence the behavior of QPA platform plugins. Right now this applies to the DirectFB and EGLFS plugin. A device can install hooks that are called as part of the initialization of these plugins. The hook is the pragmatic approach to get a mix-in with the existing code base.

Supported Devices

Right now we have completed device support for the RaspberryPi,BCM97425 and AMLogic 8726-M. We do support some more devices but they might still require external patches.

April 04, 2012

复古耳机

By Xiangfu Liu

There are too many people says my phone call is not clear. they cannot hear me clearly. so I try to find some headphone on TaoBao. found this one, designed for iPhone. it needs some convert line for other phones. so I just order this headphone + convert line. after I receive those two interesting things. I know the seller didn’t tested the convert line at all just as the other taobao shop. they are just take information form other placae, no test at all. it’s better without this convert line. this convert line make the sound smaller and make the headphone button not working. but it’s good news that we don’t needs this convert line. after use this headphone, my wife no longer complain that the phone call is not clear. :-) but if you use this headphone outside, people will think you are strange: ‘What the f**k!’

~~~~~~~~

由于有太多的人说的我手机不清楚。就在淘宝网上找了找有趣的耳机。发现了这个,从淘宝介绍上看是专门给 iPhone 设计的。需要一根转接线耳机。于是被坑爹下单买了这个复古听筒式耳机+转接线。两天后收到货。玩了几下。发现没有转接线反而清楚。而且听筒上的按键也可以接/挂电话。接上转接线后声音明显变小。听筒上的按键也失灵。还好转接线只有 5 块钱。打电话给老婆再没有报怨不清楚的情况。就是外出有点过于拉风:’我操’

 

 

Headphone 2

Headphone 1

April 01, 2012

41 Icarus 挖矿

By Xiangfu Liu

Icarus is designed by ngzhang, it’s open source hardware. all design files can found at github, it’s support by Cgminer. more information can be found at this wiki page, 41 Icarus running at 15GH/s, it mine ~8~10BTC per day, every Icarus needs ~25W, there 16 Icarus connect to one ATX 650 W power. other are using the power adapter(12V 2A). the Cgminer status can be found here:  http://downloads.openmobilefree.net/Icarus/  those Icarus information: http://downloads.openmobilefree.net/Icarus/README

It’s not only for bitcoin mining also can be used as FPGA develop/learning board.

~~~~~~~~

41 Icarus 同时可以达到 15GH/s , 一天可以挖出 10BTC,每个 Icarus 需要 ~25W , 41 个 Icarus 当中 16 个接到了 ATX 650W 电源上。其它的用的自带的电源适配器(12V 2A),软件运行的详细信息 见: http://downloads.openmobilefree.net/Icarus/ 硬件信息见:http://downloads.openmobilefree.net/Icarus/README

41 Icarus Mining

41 Icarus

 

41_Icarus_Dark

March 23, 2012

State of Firefox Mobile platform

By Chris Lord

It's been way too long since I last blogged, so here's something to try and get into the mood again. I have a few other things I'd like to write about, but work here at Mozilla is probably the most pressing one at the moment, so the others will have to wait.

Those who have been following Nightly, and/or who attended our talk at FOSDEM would be aware that we're currently rewriting the Android version of Firefox Mobile. The major part of this change is that we're now a 'native' Android app, rather than a XUL app. Consequently, we fit in and behave much better than the older version of Firefox Mobile, and we get a few perks too; namely start-up performance.

Alongside this new version of Firefox Mobile, we've also taken the opportunity to overhaul the platform side of things. Where as the old version was multi-process, we've now switched to a multi-threaded application model, with the input, content processing/rendering and UI rendering all taking separate threads. Just recently, we switched from a Java-based view compositor to a native-code off-main-thread-compositor (or OMTC, for short). While previously we drew the entire page into a buffer (with extra bits around the edges) and composited that, we now directly composite the layers that make up the page.

This gives us the speed and ease of using a single process (to some extent), but with the power afforded to us by an asynchronous rendering process. Most of what I said previously about shadow layers still applies, just replace 'process' with 'thread'. Most of the problems still apply too, but the graphics team has put in some phenomenal work in fixing a lot of it.

So we're now working our figurative nuts off fixing all the bugs that have cropped up, but I do believe we're on the road to success. This rendering model gives us the power to retain a lot more content than before, and any saved drawing tends to translate into massive benefits on mobile - we appear to be mostly memory-bandwidth limited, so every little helps. What this translates to for users is smooth, 60fps updates, excellent interactive performance, excellent web standards support and a polished, 'native' feeling application. You can sample some of this work by downloading a Nightly build, it's *almost* at the point of being a daily driver (not quite, but almost).

Maybe you want to help? Running a nightly build and providing feedback (either via the built-in methods, or by filing bugs) is a great way to start, and all the mobile developers hang out on IRC too, in #mobile. We've also just opened a new office in London, and I do believe we're hiring, so if you think you'd like to get in on some of this, do contact us!

Update: The built-in method for feedback is far less obvious than I thought... You can access it via the 'About' page, (accessible via the settings menu), then following the links 'Support', 'Ask a Question', and finally 'Give us feedback'. I think we should make this better, so I've filed a bug.

March 14, 2012

Cgminer web monitor

By Xiangfu Liu

My Icarus + Cgmienr is here:
http://downloads.openmobilefree.net/Icarus/

For setup miner.php:
1. change the $miner to your hostname or IP address
2. change the $readonly to true for read only.
3. start cgminer with two more parameters: –api-network –api-listen
4. if you want access from public, don’t forget forward the 4028 port from your router

The source code is here, Thanks to kanoi.
https://github.com/kanoi/cgminer/blob/master/miner.php

Alcatel MTK phone UART pinout

By Harald "LaF0rge" Welte

The Alcatel OT-890D is a MT6573 based smartphone. It seems one of the UARTs is available on test pads as seen in this picture:

The voltage level is still 3.3V, so no fancy 1.8V gear is required.

During boot, the UART is first used at 19200 bps, where it prints the strings "MW01" and "MW02". I then switches to 115200 bps where it prints "READY", and finally switches to 921600 bps, where it seems to output some mixed binary/text messages containing AT commands and responses between AP and BP, as well as some debug information:

�Ue� � � T+CREG=2
�Ue�!�!�!T+CSQSQ=1
�Ue�!�!�!AT+CREG=2
�Uew�"w�"w�"SQSQ=1
'Ue"""      AT+EFUN=1
      SML: Load!_Ue""""""
                         SML: Load!hU("("("

I haven't yet investigated if the binary between the text is some standard HDLC framing or a TS 07.10 multiplex.

If anyone knows more about the boot process (MW01/MW02/READY) or the binary protocol, please let me know.

March 10, 2012

HP Proliant N40L Filter

By Talpadk

I recently bought a HP Proliant N40L “server” as an upgrade to my QNAP 409.

And as with my QNAP I would like a filter that prevents most of the dust in my living room from entering the Proliant.
Before I build a filter out of a piece of cardboard and some paper towel for the QNAP I have once had to vacuum it due to a slight build-up of dust.
After the filter the inside remained a lot cleaner and I only had to clean/replace the filter, a lot safer and easier than cleaning the whole thing.

If some paper towel works for a QNAP then why not a Proliant?
Anyway here is a tiny How to “build” a simple and cheap filter for a Proliant N40L

First you need to remove the plastic that covers the door.

In order to do that you need to remove the lock this involves: Removing the screw holding the metal “bar”, then removing the nut that holds the locking mechanism in place.

You can now remove the plastic covering the metal door by carefully releasing the thee plastic hooks at the top of the door.

Next you need to cut a 19×14.5 cm piece of paper towel.

I removed half the layers of paper to keep the pressure drop across the filter low.
Last time around I used paper towel with only two layers which was much easier to separate than the 4 layer stuff I used this time…

Now you need to tape the paper towel onto the outside of the metal door.
If the Proliant is running and the door is closed the paper will be held in place by suction, making it a very easy job indeed.

Cut a hole in the paper towel for the locking mechanism.

Put the plastic covering back on, hiding the filter.

Reinstall the locking mechanism.

Close the door and admire your handy work while drinking your favourite beverage.
(Beer can be used during this step)


March 04, 2012

Using inotify to trigger builds

By Andrew Cowie

Having switched from an Eclipse (which nicely takes care of building your project for you) to working in gVim (which does nothing of the sort), it’s a bit tedious to have to keep switching from the editor’s window to a terminal in the right directory to whack Up then Enter to run make again.

I know about inotify, a capability in the Linux kernel to watch files for changes, but I hadn’t realized there was a way to use it from the command line. Turns out there is! Erik de Castro Lopo pointed me to a program called inotifywatch that he was using in a little shell script to build his Haskell code. Erik had it set up to run make if one of the files he’d listed on the script’s command line changed.

Saving isn’t what you think it is

I wanted to see if I could expand the scope in a few ways. For one thing, if you had inotifywatch running on a defined list of files and you created a new source file, it wouldn’t trigger a build because it wasn’t being watched by inotify. So I had a poke at Erik’s script.

Testing showed that the script was working, but not quite for the reason that we thought. It was watching for the ‘modify’ event, but actually catching a non-zero exit code. That’s strange; I was expecting a normal 0 not error 1. Turns out 1 is the exit code in situations when the file you were watching is deleted. Huh? All that I did was save a file!

Of course, that’s not what many programs do when saving. To avoid the risk of destroying your original file in the event of having an I/O error when overwriting it, most editors do NOT modify your file in place; they write a new copy and then atomically rename it over the original. Other programs move your original to a backup name and write a new file. Either way, you’ve usually got a new inode. Most of the time.

And that makes the exact event(s) to listen for tricky to pin down. At first glance the ‘modify’ one seemed a reasonable choice, but as we’ve just seen that turns out to not be much use, and meanwhile you end up triggering due to changes made to transient garbage like Vim’s swap files — certainly what you don’t want to trigger a build. Given that a new file is being made, I then tried watching for the ‘create’ event, but it’s overblown with noise too. Finally, you want touching a file to result in a rebuild and that doesn’t involve a ‘create’ event.

It turns out that saving (however done) and touching a file have in common that at some point in the sequence your file (or its backup) will be opened and then closed for writing. inotify has a ‘close_write’ event (complimenting ‘close_nowrite’) so that’s the one to watch for.

If you want to experiment with figuring all this yourself, try doing:

$ inotifywait -m .

and then use your editor and build tools as usual. It’s pretty interesting. The inotifywait(1) program is part of the 'inotify-tools' package on Debian-based Linux systems.

Resurrection, Tron style

Triggering a build automatically is brilliant, but only half the equation; inevitably you want to run the program after building it. It gets harder; if the thing you’re hacking on is a service then, having run it, you’ve got to kill it off and restart it to find out if your code change fixed the problem. How many times have you been frustrated that your bugfix hasn’t taken only to realize you’ve forgotten to restart the thing you’re testing? Running the server manually in yet another terminal window and then killing it and restarting it — over and over — is quite a pain. So why not have that triggered as a result of the inotify driven build as well?

Managing concurrent tasks is harder than it should be. Bash has “job control“, of course, and we’re well used to using it in interactive terminals:

$ ./program
^Z
$

$ bg
[1] 13796
$ jobs
[1] Running    ./program
$

$ kill %1
[1] Terminated ./program
$

It’s one thing to run something and then abort it, but it’s another thing entirely to have a script that runs it and then kills it off in reaction to a subsequent event. Job control is lovely when you’re interactive but for various reasons is problematic to use in a shell script (though, if you really want to, see set -m). You can keep it simple, however: assuming for a moment you have just one program that needs running to test whatever-it-is-you’re-working-on, you can simply capture the process id and use that:

    #!/bin/sh

    ./program &
    PID="$!"

Then you can later, in response to whatever stimuli, do:

    kill $PID

Said stimulus is, of course, our blocking call to inotifywait, returning because a file has been saved.

GOTO 10

Do a build. If it succeeds, run the specified program in the background then block waiting for an inotify ‘close_write’ event. When that happens, kill the program and loop back to the beginning. Easy, right? Sure. that’s why it took me all day.

I called it inotifymake. Usage is simple; throw it in ~/bin then:

$ cd ~/src/project/branch/
$ inotifymake ./program

make does its thing, building program as its result
program runs
waiting…

change detected!

kill program make does its thing, build failed :(
waiting…

change detected!

make does its thing, rebuilding program as a result
program runs
waiting…

the nice part being that the server or whatever isn’t running in the middle when the build is borked; http://localhost:8000/ isn’t answering. Yeah.

So yes, that was a lot of effort for not a lot of script, but this is something I’ve wanted for a long time, and seems pretty good so far. I’m sure it could be improved; frankly if it needed to be any more rigorous I’d rewrite it as a proper C program, but in the mean time, this will do. Feedback welcome if you’ve got any ideas; branch is there if you want it.

AfC

March 03, 2012

Taming gVim on a GNOME Desktop

By Andrew Cowie

I love using GEdit to write text documents like blog posts marked up in Markdown. I’ve been using it extensively to write technical documentation for a while now. It’s a lovely text file editor.

Programming with GEdit is a bit more subject to critique. Sure, source code is text files, but as programmers we expect a fair bit of our editor. I’ve been writing my C code in vi for like 25 years. When I returned to Java after a few years in dot-com land I (with great scepticism) began using Eclipse. IDEs are for wimps, after all. Boy was I wrong about that. Once I got the hang of its demented way of doing things, I was blown away at the acceleration that code completion, hierarchy navigation, and most of all context appropriate popups of JavaDoc. Hard to leave that behind.

Lately, however, I’ve been doing a lot of work with Haskell and JavaScript, and that ain’t happening in Eclipse. Since I use GEdit for so much else, I thought I’d give it a whirl for programming in other-than-Java. Didn’t work out so well. I mean, it’s almost there; I tried a bunch of plugins but it seems a bit of a crap shoot. To make development easier I’d certainly need e.g. ctags, but there was nothing packaged.

You’re probably asking why I’m not content to just use Vim from a terminal; after all, been doing so for years. I’ve begun to have a bit of a backlash against running applications in terminal windows; command lines are for doing Linux things, but once you run an editor or email client or whatever in a terminal then suddenly your productivity on the Desktop goes to hell; the whole premise of Alt+Tab (we won’t even talk about the bizarre GNOME Shell Alt+` business) is switching between applications but having both $ and programs in the same type of window blows that up.

Vim, however, has long had a GUI version called gVim, and when running it shows up as an independent application. So, for the hell of it, I gave it a try.

Cut and Paste

Immediately I went bananas becuase copy and paste didn’t work like they should. Yes this is vi; yank-yank, baby. But as gVim it’s also a GUI, and we’ve all pretty much learnt that if you’ve got a white canvas in front of you, Ctrl+C and Ctrl+V are going to work. So much so that I have gnome-terminal rejigged to to make Ctrl+Shift+C result in SIGINT leaving Ctrl+C for copy. Consistency in user interaction is everything.

There’s an entire page on the Vim Tips Wiki devoted to using y, d, and P to yank or delete then put. No kidding. But just as I was about to give up I found, buried at the bottom, advice to add:

    source $VIMRUNTIME/mswin.vim

to your .vimrc. The script affects some behaviour changes which among other things makes selection, cut, copy, and paste work like a normal GtkTextView widget. Hooray!

As for the rest of the GUI, I’ve gone to a lot of trouble to tame it. You need to make quite a number of changes to gVim’s default GUI settings; it’s all a bit cumbersome and the gVim menus (which at first seem like such a great idea!) don’t actually give you much help. Figuring these customizations out took a lot of wading through the wiki and worse the voluminous internal help documentation to figure any of this out; it’s pretty arcane.

Cursor

In particular, I want an unblinking vertical bar as a cursor (to match the desktop wide setting properly picked up by every other GNOME app, here I had to manually force it):

    set guicursor=a:ver1,a:blinkon0

See the documentation for 'guicursor' for other possibilities.

Mouse pointer

Also for consistency, I needed to get standard behaviour for the mouse pointer (in particular, it’s supposed to be an I-beam when over text; the ability to change pointer depending on which mode you’re on is interesting, but it is jarring when compared to, well, everything else on the Desktop):

    set mouseshape=n:beam,ve:beam,sd:updown

The documentation for 'mouseshape' describes enough permutations to keep even the most discerning customization freak happy.

Window dressing

The remaining settings are certainly personal, but you’ll want to pick a default window size that makes decent use of your screen real estate:

    if has("gui_running")
        set lines=45 columns=95
    endif

You need to guard with that if block because otherwise running vim from your command line will resize your terminal (!) and that’s annoying.

You can set the editor font from the menu, but to make it stick across program invocations you need it in .vimrc as shown here; finally, the 'guioptions' at the end disables tearoff menus (t) and turns off the toolbar (T):

    set guifont=DejaVu\ Sans\ Mono\ 11
    set guioptions-=tT

Syntax colouring

I normally use Vim in a terminal with a black background, but for some reason I don’t much like the colour set chosen. Forcing the change to 'light' makes for a nicely different set, but since I run gVim with a white background to be consistent with other GUI programs, I had to do a bit of tweaking to the colours used for syntax highlighting:

    set background=light
    highlight Constant ctermfg=Blue guifg=DarkBlue
    highlight String ctermfg=Blue cterm=bold guifg=DarkBlue gui=bold
    highlight Comment ctermfg=Grey guifg=DarkGrey

Hopefully that does it. As I said, the new Vim wiki is full of an insane amount of information, but since Vim is so powerful it can, ironically, be hard to find what you need to fine tune things just the way you want them. So if you’re a power Vim or gVim user, why don’t you blog about your .vimrc settings?

Still not sure if using gVim is going to be a good idea; the fact that despite all this hackery the editor canvas is still not a GNOME app with behaviour matching the standards of the entire rest of the Desktop is going to make me crazy. Hopefully I can keep things straight in my head; frankly I’d rather be using GEdit but it is nice to have consistency between using Vim to do sysadmin work and using gVim to write code.

AfC

March 01, 2012

More research into the Motorola Horizon macro and Mo-bis

By Harald "LaF0rge" Welte

Once upon a time there was an Americans company called Motorola, and they decided to implement GSM. Unfortunately they decided to deviate significantly from the specification and implement their own proprietary back-haul protocol between BTS and BSC, called Mo-bis. It replaces the standardized A-bis interface.

Today, There are plenty of phased-out Motorola Horizon / Horizon II macro BTSs that have been phased out. Basically you can get them for scrap value, which makes them an ideal target for GSM enthusiasts willing to run a single-cell network with little investment. So while there are actually people who are interested in operating a power-consuming device roughly the size of a washing machine in their home/office - they are normally not interested in running a 19" rack sized Motorola BSC with it. Also, the BSCs are much less frequently to be found compared to the BTS.

So it would be great to support Mo-bis from within OpenBSC. A couple of brave young men have set out to try the seemingly impossible. There's absolutely zero documentation available on that protocol, and no wireshark support either. However, the University of Brno (Czech) has a functional Motorola BTS + BSC setup, and I was able to obtain protocol traces from them and actually experiment with the equipment in their lab.

The entire Motorola GSM architecture seems to be over-engineered without end. Basically you are looking at a distributed computer from the early 1990ies. Lots of processor cards (m68k, ppc) interconnected by HDLC links on top of synchronous 2Mbps links with 64k timeslots. Those links are available e.g. on the backplane of the BTS as a TDM highway. So basically even inside the BTS, the individual processors talk over E1 to each other. In the BSC, there is a token ring based LAN between some of the cards instead. And the MCUF in the BTS even supports to transport those proprietary inter-cpu links via fiber optic (!).

Each processor has a 16bit identifier by which it can be addressed in form of physical addresses. Individual processes on the processors have fixed process identifiers, and they allocate a variety of mailboxes in which they can receive messages from remote processors. There are routing functions at intermediate notes.

So any process on any processor card can send messages to any mailbox of any other process on any other processor, independent of its physical location (locally at the BTS, or at the remote BSC, or even at remote BTSs).

Besides physical addresses, there are also functional addresses. Thos addresses are used particularly to support fail-over. Every board in a BTS and BSC can be fully redundant, and if you use physical addresses, you would address one of the two redundant boards. Using functional addresses, you address the function they both can perform, and some routing magic will make sure it ends up at the current active node in the pair.

There are multiple processors in every TRX, and a couple of processors for each BTS, processors in the E1 line cards, etc. Now speaking of the actual Mo-bis interface: It seems to be a weird mixture between 08.58 (RSL) and 08.08 (BSSAP/BSSMAP). However, after staring at the messages sufficiently long, I have been able to write a more or less complete wireshark dissector for them. Radio Channel Activation (RACH/IMM.ASS) are for example handled directly inside the BTS, they don't exist as transactions on the Mo-bis like they do in A-bis.

So implementing the actual location update / MO+MT voice call and SMS related transactions is actually not all that hard. What makes things really difficult is the way the BTS is initialized at startup. Basically what resembles the OML part of standardized A-bis.

There is a lot of low-level management and bring-up of the individual processes and boards, and the download of a large 500 kByte-sized BLOB simply called database. This binary database contains literally hundreds of configuration parameters for the BTS and its neighbors. It also contains sophisticated configuration of the message routers, the switching/multiplexing of 64k timeslots on the various links, information on redundant paths within the back-haul network, etc.

Interestingly, using the password combination 3beatles and 4stooges on any of the serial consoles of the BTS or BSC, you can enter into a "god-mode" which permits you to enter the executive monitor (EMON). The executive is the operating system they run on both m68k and ppc processors. It provides access to something like a syslog of messages from the various processes, and you can manually generate messages that are to be sent to mailboxes of processes. You can inspect the object table (application programs an databases), read/write to PCMCIA flash cards, read and write to logical and physical memory, inspect CPU and I/O usage and much more. In fact, the integrated Code Object Manager (COM) even allows the processors to synchronize their code versions and remotely boot other CPUS via HDLC channels.

For a communications system geek like myself, it's extremely fascinating to see such a sophisticated and versatile system. I only wonder why on earth somebody would come up with something as complex, only to connect a couple of BTSs to a BSC. Thus, the only logical explanation is that Motorola has developed this distributed proprietary computing system way before they went into GSM, and they probably just recycled it as it already existed.

If anyone knows more about the history of this, I would be excited to hear about it. It literally feels like being an archaeologist. Analyzing ancient technology from our forefathers. But then, it only is 20 odd years old. The only time I had a similar feeling was when I briefly came in touch with IBM mainframes in 2001 and looking at IBMs SNA protocol stack.

February 20, 2012

Bought Archos 80 G9 Turbo tablet

By Marcin "hrw" Juszkiewicz

During last Linaro Connect I bought myself an Android tablet. After checking what is on market decided to buy Archos 80 G9 Turbo. According to Amazon product page it had to have 1.5GHz OMAP4460 cpu and 1GB of memory. But it did not…

Marketing droids from Archos company should be … and … then … and again … — after that … or … and finally … (put any ways of doing deadly harm into … and repeat any amount of times). Why? There is no such thing as “Archos 80 G9 Turbo” — nevermind that I have one of them on my desk. So far there are at least three models with this name:

  • OMAP4430 1.2GHz 512MB ram
  • OMAP4460 1.5GHz 512MB ram
  • OMAP4460 1.5GHz 1GB ram

You can easily buy first model. Best Buy has it, Adorama has it, J&R has it, Amazon sells it. Second model was expected to land on shelves in December 2011. According to XDA developers forum few of them were even sold as people have them. Last model is listed on Amazon (but first one is what you get) and according to one sources it will be released in March 2012, other says that there will not be such thing. Marketing mess is lightest description which I can write without swearing.

So I got first one. First though was “WTF?!?!!?!?!?!!!” as I got slowest option. Even started returning procedure but as all US shops had only this version I gave up and decided that even with this technical specification it is better tablet then I had before (which was Hannspad SN10T1). Fast cpu, 4:3 screen with 1024×768 resolution, quite good build quality, video output.

Tablet runs Android 3.2 ‘honeycomb’ and does it nicely. Upgrade to 4.0 ‘ice cream sandwich’ was announced to be done in this month. So from software perspective it is done properly. I had some problems with rooting procedure from XDA developers but once you do it in order (and take files from other thread to get 3.2.80 firmware) device will work just fine. Have to admit that system layout on device looks overcomplicated (175MB squashfs as / for example) but it works. Anyway I am waiting for developer firmware (I was told that they will be available ‘soon’ (for any definition of ‘soon’)).

During first days of using I noticed that some applications refuse to work properly on XGA screen, some are resized/rescaled but problems usually are with games or poorly written apps (like Facebook one). But it is visible that keeping Honeycomb under stone (aka ‘closed source’) resulted in many applications not ready to be used on tablets. Even Google+ looks like it does on a phone…

I am slowly moving to use Archos as a morning news device (Twitter, Facebook, Google+ and Google Reader) — it is perfect for it. Reading webpages in landscape or portrait modes is pleasure as device is easy to hold and screen is wide enough in any of them (which was my main complain with Hannspad).

Had to order miniHDMI -> HDMI adapter (normal size connector would even fit but it is too big for this form factor) cause they do not add it in a box. When it will arrive I will check how good movies are played after connecting to 42″ plasma capable of 1080p. OMAP4 cpu should decode any video at this resolution without problems but I wonder how device deals with 4:3 internal screen and 16:9 external one. Would be nice to watch Youtube videos fullscreen.

Playing games is fun. Fieldrunners finally does not need scrolling, Great Little War Game is also better than on my Nexus S. From “racing” games so far I tried Asphalt6 (available at XDA developers forum), Shine Runner and Reckless Getaway — all run and look cute but accelerometr based steering is not comfortable with tablet size. Also games like Mahjongg or Solitaire are possible (I consider such games unplayable on phone).

Battery life is better than on my Nexus S. Partially because lack of GSM and bigger battery, but I think that due to power management done better.

I will not tell how good it is when it comes to read e-books because I have Kindle for it already.

Back to hardware. There is USB socket for optional 3G stick. Plugged dongle from wireless keyboard/trackball combo there — not recognized due to not be USB 2.0 device. Plugged thumbdrive and got it recognized (first time I got some kernel oops and no access to storage, had to reboot tablet). Did not tried other devices.

There is just one speaker at back of device. Definitelly too small and lonely. Nokia N800 which was released 5 years ago had stereo speakers… So for gaming I strongly suggest headphones.

Ugly thing is that when you push back of case with left hand fingers screen will react to it — looks like something is pushing screen. It does not look professional…

Ending summary: so far I am satisfied. Maybe one day will try one of those crazy builds like Ubuntu ;D


All rights reserved © Marcin Juszkiewicz
Bought Archos 80 G9 Turbo tablet was originally posted on Marcin Juszkiewicz website

February 17, 2012

Icarus mining software compare(miner.py VS cgminer)

By Xiangfu Liu

Bug fixed Cgminer: (655 shares in 2 hours):
cgminer version 2.2.5 – Started: [2012-02-19 18:40:12]
(5s):696.2 (avg):360.8 Mh/s | Q:1285 A:659 R:1 HW:0 E:51% U:5.45/m

Cgminer (397 shares in 2 hours):
(5s):655.2 (avg):514.8 Mh/s | Q:1323 A:394 R:1 HW:0 E:30% U:3.25/m
before start cgminer
the deepbit shows: “xiangfu.z@gmail.com_0″:”shares”: 292939,
after mining 2 hours,
the deepbit shows: “xiangfu.z@gmail.com_0″:”shares”: 293336,

Miner.py (608 shares in 2 hours):
before start cgminer
the deepbit shows: “xiangfu.z@gmail.com_1″:”shares”: 144101,
after mining 2 hours,
the deepbit shows: “xiangfu.z@gmail.com_1″:”shares”: 144709,

北京的 p2pool: www.openmobilefree.net:9332

By Xiangfu Liu

把我的 p2pool 发布出来,服务器在北京,会长期运行,使用方法:
 ./cgminer -o www.openmobilefree.net:9332 -O YOUR_BITCOIN_ADDREE:x

用户名是你的bitcoin 地址,密码任意。

p2pool 使用的是:
git://github.com/forrestv/p2pool.git, commit: 5ca5a69b6cb7d6633de8c31ea8b9747bddc4eb7f

Icarus with cgminer mining pool compare (deepbit VS p2pool)

By Xiangfu Liu

Connect to deepbit: ~180 Shares/Hour
Connect to p2pool : ~150 Shares/Hour

The networks is 2MB ADSL, cgminer running under TP-LINK WR1043ND router with OpenWrt system. Icarus connect to TP-LINK WR1043ND USB prot.

Why p2pool is slow which V3 bitstream of icarus:
P2pool’s idea of a “block” changes every 10 seconds instead of 10 minutes, on p2pool you have on average 10sec to do work, so if you doing U:3/m then it takes 20sec to do the work. the block changes in that time so you’re never working on the current block, this is a big problem.

Command:
(deepbit) cgminer -Q 4 -S /dev/ttyUSB0 -o http://pit.deepbit.net:8332/ -O xiangfu.z@gmail.com_0:1234
(p2pool) cgminer -Q 4 -o http://www.openmobilefree.net:9332/ -O 1AUuX4auVWUYByhLGP1okhWsHsSm9zxqmz:x -S /dev/ttyUSB0

More Info:
26 hours on deepbit:
cgminer version 2.2.5 – Started: [2012-02-15 19:35:52]
——————————————————————————–
(5s):59.5 (avg):524.4 Mh/s | Q:17086 A:4765 R:26 HW:0 E:28% U:3.02/m
TQ: 1 ST: 1 SS: 27 DW: 272 NB: 160 LW: 0 GF: 483 RF: 8
Connected to http://pit.deepbit.net:8332/ with LP as user xiangfu.z@gmail.com_0

1 hour on p2pool:
cgminer version 2.2.5 – Started: [2012-02-17 11:57:21]
——————————————————————————–
(5s):655.5 (avg):306.9 Mh/s | Q:367 A:146 R:40 HW:0 E:40% U:2.50/m
TQ: 1 ST: 2 SS: 36 DW: 294 NB: 6 LW: 657 GF: 0 RF: 0
Connected to http://www.openmobilefree.net:9332/ with LP as user 1AUuX4auVWUYByhLGP1okhWsHsSm9zxqmz
Block: 00000a20ebe31a4c1fb65aaca47e691c… Started: [12:48:08]

February 09, 2012

Our Privacy

By Sean Moss-Pultz

I’ve been reading a lot of Andy Grove lately. This quote, from an older Esquire interview, is particularly prophetic:

Privacy is one of the biggest problems in this new electronic age. At the heart of the Internet culture is a force that wants to find out everything about you. And once it has found out everything about you and two hundred million others, that’s a very valuable asset, and people will be tempted to trade and do commerce with that asset. This wasn’t the information that people were thinking of when they called this the information age.

Satisfying a customer should always be the primary goal of a business. It genuinely saddens me to learn of companies spending more time thinking about what they, rather than you, can do with your data.

Trust: So hard to build, yet so easy to destroy.