Posts

Blog moved to https://anarsoul.github.io

The blog has moved to https://anarsoul.github.io

OLED brightness in Linux

Recently I've got a new laptop with OLED panel only to find out that brightness control for OLED panels is not yet supported in Linux. Archlinux wiki page mentions using gamma ramp for controlling perceived brightness using hackish userspace tools (icc-brightness), so my first thought was to implement a hack for i915 driver to expose backlight interface that actually adjusts gamma ramp. So I went to #dri-devel to ask around whether this idea sounds too crazy and it turned out that there are better ways than using gamma ramp. Basically if you use gamma ramp you essentially reduce dynamic range, i.e. if you have 8 bits per pixel at 50% brightness you would get 7 bit, at 25% - 6 bit and that will result in banding artefacts at low brightness levels. To overcome that issue OLED panels actually have an interface to control brightness. There are at least 2 competing "standards" - VESA and Intel proprietary. First one is already supported by i915 driver while latter is not. Unfo...

Hacking u-boot for Pinebook. Part #1 - using FEL

It's been a while since I posted to my blog. A lot of things happened since then, I guess the most important is -- I moved to Canada. I've been living in Vancouver (OK, Greater Vancouver) with my wife and cat for more than 2 years now. But enough about me, let's get back to the topic. Recently I've got a Pinebook , mostly for hacking purposes. It's pretty nice device - quad-core Allwinner A64 CPU, 2GB LPDDR3 RAM, eMMC storage, etc, etc. See pine64.org for full specs. But unfortunately it comes with BSP kernel from Allwinner which is pretty ancient - 3.10 (released in 2013, more than 4 years ago!) Hopefully, mainline support for A64 is in pretty decent shape, see  http://linux-sunxi.org/Linux_mainlining_effort . Sure some things are missing - LCD, sound, power management, and that's not all. But it's good - there's something to hack on, right? So I decided to start with u-boot. Hopefully, Allwinner SoCs support boot over USB - it's called FEL, ...

Access point with Raspberry Pi and rtl8192cu dongle

On Thursday ethernet ports (WAN and LAN1-4) in my Asus WL500GPv1 router have completely died, so I needed a replacement. Hopefully, recently I've got Raspberry Pi, so I decided to use it as a router. I've got TP-LINK TL-WN821NC USB stick from local store which is based on RTL8192CU chipset. Unfortunately, its driver doesn't work with vanilla hostapd, but requires patched ancient version of hostapd from Realtek . I'm using Archlinux on my rpi and I've found manual how to setup AP using this USB stick  here , but I don't want to overwrite binaries from repository packages, since it's not a sane way, and it can (and will) be broken by hostapd update. So I prepared a package, here's source package (just unpack it and build with makepkg directly on rpi), and here's binary package for armv6h (you can install it with pacman -U). I can't put PKGBUILD in AUR, since there's no stable hosting for Realtek's hostapd. If anyone is willing to host...

Wayland and software rendering

Image
Recently I spent few evenings for hacking wayland . I like idea of wayland - rendering is done completely on client (in whatever way), compositor (server part) is responsible in rendering buffers from clients on the screen. Issue for me was rendering part of weston (reference compositor for wayland) - it uses GLES for compositing, but I want to try wayland and weston on devices without hw acceleration (pure software rendering), and running software GL on PXA270@312MHz does not sound like a good idea, does it? :) So I asked on #wayland@irc.freenode.org if it possible to implement software renderer, Kristian Høgsberg (khr) responded that in master branch of weston repo there's a nice abstraction of renderer, so it's possible to implement pixman renderer. So I did :) weston with x11-backend and pixman renderer khr and pq from #wayland were very helpful, and described place of renderer in wayland architecture, here're some points renderer just performs rendering of ...

Hacking on fingerprinting again or AES2550/AES2810 driver for libfprint

Image
Back in 2007 I participated in driver development for AuthenTec AES2501 scanner, driver was later merged into libfprint project. I didn't hack much on libfprint, just sent few bugfixes, but recently AuthenTec announced that they're willing to send fingerprint scanners for opensource enthusiasts who wants to develop driver for those scanners. So far, so good... I've wrote a letter to AuthenTec and they proposed to send AES2550 or AES2810 scanner to me. I chose AES2550. Actually, AES2550 and AES2810 are pretty same (AES2550 driver should work with AES2810), the only difference is missing crypto engine on AES2550 (who needs cryptography anyway? :)) So, I've got parcel with scanner in August, but unfortunately had no spare time for hacking, I only coded driver stub and read datasheet from AuthenTec. So, in September/October I've spent few (5-6?) nights hacking on this driver, and finally got it working on my AES2550. Image quality is much better then on my AE...

Reboot instead of shutdown issue

Recently hit subj issue on 2 PCs, on 2 different distros: ubuntu 12.04 on my sister's nettop current archlinux on my mother's-in-law PC Here're symptoms: PC shutdowns on poweroff command and then immediately turns on. Sounds weird, right? It turned out that cause is forcedeth driver (both PCs are based on nVidia chipset). I suspect it's somehow related to WoL implementation (however there's not WoL packets in my network for sure - local segment contains only router + 1-2 PCs). Solution is to 'rmmod forcedeth' somewhere on shutdown path. Can't investigate this issue more broadly, I've no permanent access to those PCs :) But some forcedeth dev is guilty for sure

fheroes2 on zipit

Image
Just got fheroes2 running on z2. Rays of hate to the author for "-I$(PREFIX)/include" in Makefile. PREFIX is usually /usr, so it pulled headers from host and produced weird compile errors. It took half a day to debug and fix it. You'll need data and maps from original heroes 2 in /root/.fheroes2 to play. As usual, here's screenshot: Btw, I've moved to gcc-4.6, so don't forget to get updated openwrt .config Binaries are here: uImage rootfs

More stuff for openwrt

Image
Recently I added scummvm, mplayer (for zipit), netsurf, mouse-emul packages to openwrt-zipit, all this stuff is in my github repos. Also there's a package with cyrillic layout. Btw, here's guide to mouse-emul usage: option key toggles "mouse" mode, in "mouse" mode: "stop" - right button "enter" (on joystick) - left button joystick - moves cursor "prev" - "f1" "next" - "f5" "q" - "1" You can change behavior by editing /etc/mouse-emulrc Update:  here're binaries:  kernel  and  rootfs Screenshots:

openwrt for Zipit Z2

Spent some time hacking on openwrt for Zipit Z2.  It's highly based on projectgus work, so thanks in advance to him ;) I've just integrated 3.2 kernel into it, made libertas work prorerly with nl80211, also hacked some packages (gmenu2x, mocp, gmu) to work properly on Z2. Basically, it works :) Here's short manual how to compile it: mkdir ~/zipit cd ~/zipit git clone git://github.com/anarsoul/openwrt-zipit.git git clone git://github.com/anarsoul/openwrt-packages.git git clone git://github.com/anarsoul/qi-openwrt-packages.git cd openwrt-zipit echo "src-link qipackages $HOME/zipit/qi-openwrt-packages" >feeds.conf echo "src-link packages $HOME/zipit/openwrt-packages" >>feeds.conf wget https://github.com/downloads/anarsoul/openwrt-zipit/.config make package/symlinks Now you can 'make menuconfig' and select/deselect packages you want (press M on package to build as package, but do not install in default rootfs) Then just ...

rx3715

Image
Got Linux booting on my rx3715. Problem was in wrong serial port number. I thought that serial port brought to external connector is ttySAC0, but it's ttySAC1 on rx3715. Just changed some values in kernel config - and voila - it boots. Will try to get touch screen, buttons, udc and ASIC3 working a bit later. Btw, now I have serial cable for iPAQs and JTAG adapter (Olimex). So I hope debugging will be easier now. :)

My little Zoo :)

Image

New item to my collection

Today I owned iPAQ rx3715. Joystick does not work well, battery does not work at all, but it's s3c2440 based, and I'm going to push upstream everything for it :)

May report

This month I did not do much hacking, as I was pretty busy with repairing in my house. But here's list what I did: Tried to run opie on Zipit Z2. It's pretty stable (but damn slow, maybe due to rotation?), opie understands kernel keymap, just don't use sticky modifiers, it does not understand them. Battery support is not working yet in opie. Made my own mouse emulator , it's simple and configurable. Going to use it with my distro for Zipit Z2 Hacking on something jlime-like (Xfbdev + matchbox-desktop + echinus + dzen2), and not oe- but buildroot-based. It's not ready yet. Added proper rotation support to qemu, now it's easier to test different Zipit stuff (especially, Xfbdev rotation) Also I'm going to buy iPAQ rx3715 to hack Linux kernel for it.

NetSurf on Zipit Z2

Image
Yesterday I prepared netsurf recipes for buildroot, you can get them here . You'll also need fonts and config, you can get them here . Recipes include some patches for netsurf, basically, zipit-specific (add zipit kbd layout, etc), but there's a bug fix aswell :) Also you'll need some mouse emulator, I'm using z2mouse   mouse-emul . To clear inputbox (i.e. for address) you can use ESC key. Here're some screenshots: I'm pretty happy with netsurf, it's a very nice browser, and it works smoothly even on complex pages :) Update: no more extra fonts necessary, netsurf uses liberation fonts from buildroot. I updated recipes and netsurf-stuff archive.

USB on Zipit Z2

Image
Today I finished my z2-usb-switch driver, so now it's possible to switch between device and host modes in software. By default, device mode is activated. To change mode invoke: echo device >/sys/devices/platform/z2-usb-switch/usb_mode or echo host >/sys/devices/platform/z2-usb-switch/usb_mode All changes are in my tree , branch pxa27x-devel. You can get precompiled binaries here .
Image
Finaly got new LCD for my h1940! Now I have two h1940, one lacks battery, but I plan to order one from ebay :)

More work on Zipit Z2

Month past since I last time posted to my blog, and many things happened, many stuff I was hacking on :) So... CPUFreq is working! I got cpufreq working on Zipit Z2. For some reason it's unstable when fastbus bit of CCLKCFG is set, so solution is to keep fastbus disabled. Here's patch . Now it works pretty well with ondemand and conservative governors (I'm using later). But I suggest to keep regulator support disabled - for some reason it adds some instability (even without cpufreq). linux-anarsoul-2.6 tree was set up :) I published my linux-2.6 git repo at github, for now it contains only zipit-related patches (in branch pxa27x-dev), but I plan to make a branch with h1940 and rx1950 patches (however, pretty all h1940/rx1950 patches are merged into mainline kernel) Patches... I submitted pack of patches for Zipit Z2, so they'll appear in 2.6.39 :) Also looks like Ben Dooks sent pull request for next-samsung tree, so rx1950 and h1940 patches should get into Linu...

qemu with Z2 support

I spent some days getting qemu to emulate some Z2 hardware, and got some results :) Almost all hw is emulated, it lacks only voltage regulator and WiFi, but it's not easy to implement Marvell's WiFi chip, because there's no datasheet, and anyway it makes no sense. Also screen rotation is not supported (yet). Stock bootloader - blob - (with slight modification) and stock kernel works. Blob puts Z2 into deepsleep on reset, so I hacked it not to do this. How to compile qemu: git clone git://github.com/anarsoul/qemu-z2.git cd qemu-z2 ./configure --audio-drv-list=alsa --target-list=arm-softmmu make -j4 arm-softmmu/qemu-system-arm binary is what you need. So, how to hack blob: put your blob image (first 64kb of NOR) somewhere convert it to hex representation with xxd: xxd mtdblock1.bin >mtdblock1.hex apply patch onto mtdblock1.hex convert hex back to bin: mv mtdblock1.bin mtdblock1.bin.bak; xxd -r mtdblock1.hex >mtdblock1.bin I don't pu...

pxa270 powersaving

Some days ago I made a driver (named pxa270-voltage) to set cpu core voltage according to its frequency, it should improve battery life (but I did not perform testing). freq-voltage table was taken from cpufreq-2xx driver. If anyone can test and report if it really improves battery life - it would be nice. Here's new patchset, precompiled binaries can be taken here , patches still should be applied ontop of Marex's tree Also new patchset fixes race condition in pxa2xx-spi suspend handler. P.S. This driver is just temporary solution until someone fix cpufreq on pxa270.