tiistai 16. helmikuuta 2010

S/PDIF TOSLINK mod for a motherboard

Problem: A motherboard (Asrock Conroe 865PE) that has no digital audio output.

Solution: alsamixer shows a control for IEC958 (which means digital output), and also that the codec chip is Realtek ALC850. Docs from Realtek show that digital output is at pin 48, and it can directly drive TOSLINK transmitters like TOTX176.



Black blob on lower left is the TOTX176 (or TOTX178 or something like that, I'm not sure as I took it from a broken DVD player), 100nF capacitor between its ground and Vcc and a pin header for those, signal wire going to Realtek chip with a loop through a connector to remove physical strain on the soldering. Added a launcher button to XFCE4 (the window manager I use), executing "/usr/bin/amixer 'IEC958' toggle"; meaning that clicking it will toggle the output on-off.

Problem solved. :)

Happy Valentine's

This is just lovely.

I like to keep all personal messages - cards, letters, emails, sms' - for sentimental values. And now, for no apparent reason, my cellular (HTC Diamond) decided to lose ALL messages sent or received on Valentine's day. Nice. I did backup all messages a couple days ago, but didn't make it a scheduled job or to be done after each receive/send, so that doesn't help. The irony is that I wanted to make backing up automatic right from the beginning when I got this phone, but it seems that Windows Mobile is as nice to make do things for you as regular Windows is. *Explicit deleted*, that is. Some regular Python love ought to be enough on _any_ platform. (Well, yeah, I did find out there is Python for WinCE, but I doubt messaging APIs are up to the task...)

Looks like it's time to cash in for the Linux kernel development project on this cellular.

sunnuntai 3. tammikuuta 2010

Headtracking part 2, Silent Wings

Sometimes it's nice to be wrong. When I tried soaring simulator Silent Wings' remote UDP control earlier, I must've done something wrong. I thought PANH and PANV parameters control only external view, but they do work in cockpit view too - and, almost immediately after suggesting, the developer added support for full 6DOF movement, which will be available in next patch. Nice!

In the meantime, here's how to get 2DOF headtracking. Do the stuff in previous post, get ltlib_test.c.sw-udp here and overwrite linux-track-read-only/src/ltlib_test.c with it, do "make" again in linux-track-read-only, change "use_remote_control" to "true" in SilentWings/data/options.dat, run ltlib_test (again, activate wiimote with 1+2 buttons first), and then run SilentWings. For subsequent runs, running ltlib_test and SilentWings is enough.

Although Condor has much more online races, Silent Wings was a easy choice. Whereas Condor runs poorly on Wine and development/fixing seems quite dead, Silent Wings not only runs well on Wine but also has native clients for linux and OSX, and is evolving. AFAIK both will have V2 "soon", but at this state, wanting to fly now, it was clear. Not to mention that being a bit more "open" suits my taste well.

And for something not so different, check out James May riding a U2. Preferably with no hurry and a nice cup of coffee / tea / wine / etc. This still leaves me speechless.

sunnuntai 20. joulukuuta 2009

Headtracking (with Wiimote) in linux

Alrighty then. Being an avid simflyer and linux user, I wanted to come up with some solution for headtracking. Naturalpoint, the creator of TrackIR, hasn't shown much interest supporting their hardware, and although Wiimote is quite nice tool for this, I wasn't too fond of porting Freetrack to linux because of the language. So I wrote neccessary parts of Freetrack in python about an year ago and got it to work, but never bothered to clean the code enough to make it available for others, just enjoyed it myself :) Anyhow, some very nice people have begun project linux-track, which supports TrackIR and Wiimote - and its future looks nice. So here's pretty much copy-paste ready stuff to try it out yourself. This is what I did on Ubuntu 9.04, pretty much based on linux-track howto, but some differences because of wiimote and wine support:

Install neccessary packages. This includes at least build-essential, svn, libusb-dev (for TrackIR hardware?), libcwiid1-dev (for wiimote) and liblo0-dev (for wine). I presume the dev-packages take the libraries as dependency, if not, also Some others might be needed, unfortunately I've been compiling software so long on this box that I can't be sure.

Get linux-track, X-Plane SDK, GlovePIE and my patch & script:

mkdir XLinuxTracker; cd XLinuxTracker
svn checkout http://linux-track.googlecode.com/svn/trunk/ linux-track-read-only
wget http://www.xsquawkbox.net/xpsdk/XPSDK200.zip
unzip XPSDK200.zip
wget http://jusu.is-a-geek.net/GlovePIE030.zip
mkdir gpie; cd gpie
unzip ../GlovePIE030.zip
cd ..
wget jusu.is-a-geek.net/ltrack-gpie-patch.tar.gz
tar zxvf ltrack-gpie-patch.tar.gz


And for TrackIR hardware this binary blob:

wget http://media.naturalpoint.com/software/external/bulk_config_data.tgz
tar zxvf bulk_config_data.tgz


Ready to compile:

cd linux-track-read-only
./configure
make
cd ..


Copy src/.linuxtrack (the dot makes it a hidden file!) to your home directory

cp linux-track-read-only/src/.linuxtrack ~

and remember to edit according to your setup! Guess if I forgot it, luckily X-Plane plugin, when run from terminal, whined about missing hardware..

TrackIR hardware needs a rule in udev to make the device accessible to normal users:

sudo echo 'SUBSYSTEM=="usb", ENV{DEVTYPE}=="usb_device",SYSFS{idVendor}=="131d" , SYSFS{idProduct}=="0156", MODE="0666"' > /lib/udev/rules.d/51-TIR4.rules

For X-Plane:
X-Plane plugin linux-track-read-only/src/xlinuxtrack.xpl goes in X-Plane/Resources/plugins, and bulk_config_data.bin in upper directory goes in X-Plane directory. If using wiimote, press 1+2 on wiimote right away when starting X-Plane to make it visible to PC.

For Wine applications, eg. IL-2:

wine gpie/GlovePIE.exe -gpie/tir-osc.pie &
linux-track-read-only/src/ltlib_test


..and again, wiimote has to be bluetooth-visible (press 1+2) when running ltlib_test. GlovePIE starts running the script right away, and doesn't quit nicely unless it's receiving OSC data, and in every case throws an error message when closing. And ltlib_test doesn't shut down, just ctrl-c it. :)

Ok, that's about it, more hacks (maybe) and rants (bii suur!) later.

Edit: added link to linux-track. If anybody knows how to force blogger not to wrap lines (in blockquotes), please let me know.

Edit2: One stupid mistake in ltlib_test.c (send yaw as roll), and changed multipliers in gpie/tir-osc.pie so that things work (6dof) reasonably in Silent Wings.