Lazy bottom
Hack for your lives!
Sunday, January 22, 2012
Blog moved
I have moved the blog over to a self-hosted wordpress site: http://lazybottom.snowglo.be. Please update your subscriptions accordingly if you are still interested ;-)
Saturday, January 21, 2012
Bluetooth + pulseaudio misery on Ubuntu Precise
During one of the usual apt-get dist-upgrade cycles I have noticed that my bluetooth speakers no longer work. I decided to spend some time debugging the issue today.
Yep, speakers are definitely there. So why are they not showing up in any mixer application I tried? I vaguely remembered the label they usually get: Playback: Creative T12 Wireless (PulseAudio Mixer). Aha! Must be something with pulseaudio. Back in the day I used to fiddle around a lot with the pulseaudio settings (when Ubuntu first introduced it) and I have read quite a huge amount of back-and-forth flamewars between Ubuntu/Pulseaudio developers which illustrated the huge gap between their idea of a general purpose audio subsystem. It must be something with pulseaudio and Ubuntu again! :-)
Sure enough, killing pulseaudio and rerunning it from a console with debug logging showed this:
After stracing through pulseaudio, it turned out that it was trying to connect to a socket that did not in fact exist. At this point I spent a considerable amount of time searching for documentation on the exact options in the files under /etc/bluetooth/*.conf but all my efforts were in vain. Eventually, after stepping back a few times and getting more and more desperate, I found this gentoo wiki entry which described the exact same symptoms as I had, and offered the magic configuration option - put this in /etc/bluetooth/audio.conf under the [General] section:
After restarting the bluetooth stack, everything started working - the socket has been created, pulseaudio picked it up and finally my speakers were available in all of my mixers; including pavucontrol/paman.
It was weird because the speakers were definitely paired to my notebook as I could see the blue light on them. That usually means an active connection between the speakers and something. First thing to check:
zsol@urgar-ubuntu:~$ hcitool con
Connections:
< ACL 00:02:3C:25:C0:A2 handle 12 state 1 lm SLAVE AUTH ENCRYPT
zsol@urgar-ubuntu:~$ hcitool name 00:02:3C:25:C0:A2
Creative T12 Wireless
Yep, speakers are definitely there. So why are they not showing up in any mixer application I tried? I vaguely remembered the label they usually get: Playback: Creative T12 Wireless (PulseAudio Mixer). Aha! Must be something with pulseaudio. Back in the day I used to fiddle around a lot with the pulseaudio settings (when Ubuntu first introduced it) and I have read quite a huge amount of back-and-forth flamewars between Ubuntu/Pulseaudio developers which illustrated the huge gap between their idea of a general purpose audio subsystem. It must be something with pulseaudio and Ubuntu again! :-)
Sure enough, killing pulseaudio and rerunning it from a console with debug logging showed this:
bt_audio_service_open: connect() failed: Connection refused (111)
W: [pulseaudio] module-bluetooth-device.c: Bluetooth audio service not available
W: [pulseaudio] module-bluetooth-device.c: Service not connected
I: [pulseaudio] card.c: Freed 4 "bluez_card.00_02_3C_25_C0_A2"
E: [pulseaudio] module.c: Failed to load module "module-bluetooth-device" (argument: "address=00:02:3C:25:C0:A2"): initialization failed.
After stracing through pulseaudio, it turned out that it was trying to connect to a socket that did not in fact exist. At this point I spent a considerable amount of time searching for documentation on the exact options in the files under /etc/bluetooth/*.conf but all my efforts were in vain. Eventually, after stepping back a few times and getting more and more desperate, I found this gentoo wiki entry which described the exact same symptoms as I had, and offered the magic configuration option - put this in /etc/bluetooth/audio.conf under the [General] section:
Enable=Socket
After restarting the bluetooth stack, everything started working - the socket has been created, pulseaudio picked it up and finally my speakers were available in all of my mixers; including pavucontrol/paman.
Thursday, July 28, 2011
Solving Math-related Problems In C++ With STL
Whew, it's been a while since the last post. Lots of things have happened since then; amongst them is my Masters in Computer Science and a new job. The latter forced me to focus less on academic things and more on real world problems (like calculating risks in a distributed environment), so I went back to the basics: C++. I don't really have much time to spend on Haskell anymore (although i still use xmonad as my main window manager :-)).
In the past few months, I have taken up the habit of solving problems from the project euler website. Today, I stumbled across Problem 24, which is pretty simple in principle. Find the 1000000th permutation of the first 10 natural numbers. I usually solve these problems with as much STL as possible because the generic style it forces on you really fits me, so the phrase "lexicographical permutation" struck me as something I have read recently - in an entirely different context. Sure enough, after a bit of poking around, I have found it.
This essentially makes a (brute force) solution three lines of logic in C++, which - let's be honest - is not a common sight. So here's my solution to the problem:
In the past few months, I have taken up the habit of solving problems from the project euler website. Today, I stumbled across Problem 24, which is pretty simple in principle. Find the 1000000th permutation of the first 10 natural numbers. I usually solve these problems with as much STL as possible because the generic style it forces on you really fits me, so the phrase "lexicographical permutation" struck me as something I have read recently - in an entirely different context. Sure enough, after a bit of poking around, I have found it.
This essentially makes a (brute force) solution three lines of logic in C++, which - let's be honest - is not a common sight. So here's my solution to the problem:
Sunday, August 16, 2009
Building Cyanogen's android source
After finished playing with the official master branch, I went on to check out Cyanogen's modified tree. After checking it out, I had to modify build/core/tasks/localize.mk to read
because otherwise I would get an error saying too many arguments are passed to /bin/bash
values_resource_files := $(-- $(foreach elem, $(all_resource_files), $(shell echo $(elem) | \ tr -s / | \ tr " " "\n" | \ grep -E "\/values[^/]*/(strings.xml|arrays.xml)$$" | \ grep -v -E -e "-[a-zA-Z]{2}[/\-]")))
because otherwise I would get an error saying too many arguments are passed to /bin/bash
Wednesday, August 5, 2009
Tackling Android's Donut Branch Part II
The building process didn't finish yesterday, so I am continuing today morning. After the SDK is built, I had to symlink some directories to their proper places (wonder why this is so), because the "android" tool said "Error parsing SDK" or something like that, indicating it was missing these directories.
After this, I was finally able to create an AVD like so:
Awesome! Now I'm getting close. This command let me try the fresh build on an emulator:
Hack away!
ln -s ~/android/mydroid/out/host/linux-x86/sdk/android-sdk_eng.zsol_linux-x86/platforms/ out/host/linux-x86/ ln -s ~/android/mydroid/out/host/linux-x86/sdk/android-sdk_eng.zsol_linux-x86/add-ons/ out/host/linux-x86/
After this, I was finally able to create an AVD like so:
zsol@silithus:~/android/mydroid$ android create avd -n donuttest -t 1 Android Donut (Preview) is a basic Android platform. Do you wish to create a custom hardware profile [no] Created AVD 'donuttest' based on Android Donut (Preview), with the following hardware config: hw.lcd.density=160
Awesome! Now I'm getting close. This command let me try the fresh build on an emulator:
zsol@silithus:~/android/mydroid$ emulator -sysdir out/target/product/generic/ -kernel ./prebuilt/android-arm/kernel/kernel-qemu @donuttestThis is what it looks like:
Hack away!
Tuesday, August 4, 2009
Tackling Android's Donut Branch
I know I should be updating the graph visualization project, but I just wasn't in the mood these days, so after getting a new layer of screen protector for my G1/Dream/ADP, I went on checking out Android's master git branch, which has seen some merges from the Donut branch.
The checkout process went on for a whole night on my sloppy "high-speed internet" connection, and grabbed a few (less than 3)Note to self: next time settle for single-core compilation, it's faster.
Now that I have a working adb tool, I can get some proprietary blobs from my phone:
While building I noticed something interesting with my xterm:
That's right, it supports UTF-8 properly. Take that, urxvt!
After some 20ish minutes of compiling, the process is halted with some error messages missing "camera.h", "camframe.h", "jpeg_encoder.h", and the like. A quick search leads me to this thread. The funny thing is, the solution was not posted when I found it, only now that I rechecked the link. So this is what I did:
The checkout process went on for a whole night on my sloppy "high-speed internet" connection, and grabbed a few (less than 3)Note to self: next time settle for single-core compilation, it's faster.
Now that I have a working adb tool, I can get some proprietary blobs from my phone:
Now to configure the build for my G1:
zsol@silithus:~/android$ cd mydroid
zsol@silithus:~/android/mydroid$ . build/envsetup.sh
zsol@silithus:~/android/mydroid$ cd vendor/htc/dream-open/
zsol@silithus:~/android/mydroid/vendor/htc/dream-open$ ./extract-files.sh
[... output snipped off ...]
That looks pretty promising, doesn't it.
zsol@silithus:~/android/mydroid/vendor/htc/dream-open$ lunch htc_dream-eng
============================================
PLATFORM_VERSION_CODENAME=Donut
PLATFORM_VERSION=Donut
TARGET_PRODUCT=htc_dream
TARGET_BUILD_VARIANT=eng
TARGET_SIMULATOR=false
TARGET_BUILD_TYPE=release
TARGET_ARCH=arm
HOST_ARCH=x86
HOST_OS=linux
HOST_BUILD_TYPE=release
BUILD_ID=Donut
============================================
While building I noticed something interesting with my xterm:
That's right, it supports UTF-8 properly. Take that, urxvt!
After some 20ish minutes of compiling, the process is halted with some error messages missing "camera.h", "camframe.h", "jpeg_encoder.h", and the like. A quick search leads me to this thread. The funny thing is, the solution was not posted when I found it, only now that I rechecked the link. So this is what I did:
- patch the mentioned change with: repo download platform/vendor/htc/dream-open 10981/1
- hack hardware/msm7k/libcamera2/Android.mk and change the "true" value
on the first line to "false" - run make again
Friday, July 31, 2009
Ubuntu's default firefox search
So I have been using Karmic for a while now and I recently noticed that Ubuntu folks have changed the default search engine from plain old Google to Google custom search. How did I notice? I frequently use Google's built-in calculator to find out info about a great variety of things, like currency conversion:
The above is what I usually expect. It spits out a quick result with the obligatory disclaimer underneath it. Then some search results appear below it, which 99% of the time are totally uninteresting once I get the actual information I was looking for. These days the same search query produced an output like this:
Needless to say, this is does not really satisfy my needs. Now I don't have problems with these kinds of ads, my problem is that the calculator result is omitted. Hidden. Left out. So I went on and tweaked some settings like the keyword.url in about:config to no avail. My last attempt was to replace the default search engine with one of my "own" plain old google search plugins. Actually, I haven't managed to do this. Instead, I tried to add the plugin by another name, then use it instead of the ubuntu-supplied one. For this I have put up a simple web page with a stupid javascript that adds a new search plugin, which actually worked, so the story ends here.
The above is what I usually expect. It spits out a quick result with the obligatory disclaimer underneath it. Then some search results appear below it, which 99% of the time are totally uninteresting once I get the actual information I was looking for. These days the same search query produced an output like this:
Needless to say, this is does not really satisfy my needs. Now I don't have problems with these kinds of ads, my problem is that the calculator result is omitted. Hidden. Left out. So I went on and tweaked some settings like the keyword.url in about:config to no avail. My last attempt was to replace the default search engine with one of my "own" plain old google search plugins. Actually, I haven't managed to do this. Instead, I tried to add the plugin by another name, then use it instead of the ubuntu-supplied one. For this I have put up a simple web page with a stupid javascript that adds a new search plugin, which actually worked, so the story ends here.
Subscribe to:
Posts (Atom)