tag:blogger.com,1999:blog-2397043469298853852024-03-13T05:30:24.389+01:00(blog-dump 'dciabrin)A coding and hacking diaryAnonymoushttp://www.blogger.com/profile/15807471573169658489noreply@blogger.comBlogger8125tag:blogger.com,1999:blog-239704346929885385.post-27782687799061328832011-05-19T21:35:00.000+02:002011-05-19T21:35:32.627+02:00Support for Aluminium Keyboards packaged, code-named apple-kbd<p>After many episodes, the support for Apple Aluminium Keyboards is finally becoming user-friendly. All major distribs now ship a recent version of <a href="http://www.freedesktop.org/wiki/Software/XKeyboardConfig">xkeyboard-config</a>, so there is no need to mess with XKB patches anymore...</p><p>To complete the user experience, I'm happy to introduce you <a href="https://github.com/dciabrin/apple-kbd"><tt id='tt1099'
>apple-kbd</tt></a>, the collection of helpful goodies you need for your Aluminium Keyboard under Linux. Here's what you'll get with this package:</p><dl><dt>Automatic keyboard detection under X</dt><dd>At boot time or when the keyboard is plugged in, <tt id='tt1101'
>apple-kbd</tt> auto-updates the system-wide XKB settings so that the X server sees the Aluminium Keyboard and enables all its keys and its geometry.</dd> <dt>Key style preferences</dt><dd><tt id='tt1103'
>apple-kbd</tt> lets you remap some of the keyboard's keys: you'll get back the Insert key, the antique Print, Scroll-Lock and Pause... You can also set the precedence of functions keys over multimedia keys.</dd> <dt>User-friendly installation</dt><dd>Both auto-detect and configuration features are available in a single, easy to install package. If you're running Debian or Ubuntu, there's even a package for you which comes with interactive configuration thanks to debconf!</dd></dl><a name='more'></a> <br />
<h2>Installing the debian package of apple-kbd</h2><p>I made a <a href="https://launchpad.net/~damien-ciabrini/+archive/apple-kbd">PPA on Launchpad</a> to package <tt id='tt1107'
>apple-kbd</tt>, so it's super easy to install it on your Debian or Ubuntu release. The plus of the Debian version compared to the plain sources is that you'll get a graphical dialog to configure your key style preferences. The dialog is also localized, only in French for the time being, but translators are welcome!</p><h3>Automatic installation for Ubuntu Natty Narwhal</h3><p>To install <tt id='tt1109'
>apple-kbd</tt> on Natty, you basically have to follow the instructions found on Launchpad. Just add the PPA to your list of available locations:</p><pre>sudo add-apt-repository ppa:damien-ciabrini/apple-kbd
</pre><p>And once the PPA repository and its GPG key are imported, you can install the package as usual:</p><pre>sudo apt-get update
sudo apt-get install apple-kbd
</pre><p>The first time you'll install the package, you'll be asked some questions regarding the behaviour of the keyboard, <em>i.e.</em>, Insert key, PC keys emulation... At any time, you can reconfigure your keyboard by typing:</p><pre>sudo dpkg-reconfigure apple-kbd
</pre><h3>Manual installation for the others</h3><p>Oh damned, you don't run Natty (like me...)! No worries, you can still proceed the Old Way™. Just edit <tt id='tt1117'
>/etc/apt/sources.list</tt> and add the following line at the end of the file:</p><pre>deb http://ppa.launchpad.net/damien-ciabrini/apple-kbd/ubuntu natty main
</pre><p>And you're good to go! Resynchronize the index of available packages and install <tt id='tt1120'
>apple-kbd</tt>:</p><pre>sudo apt-get update
sudo apt-get install apple-kbd
</pre><h2>Don't want a Debian package? Get the sources!</h2><p>The simplest way of getting <a href="https://github.com/dciabrin/apple-kbd">the sources form GitHub</a> is to download the latest <tt id='tt1123'
>apple-kbd</tt> archive:</p><pre>wget --no-check-certificate https://github.com/dciabrin/apple-kbd/tarball/apple-kbd-0.1 -Oapple-kbd-0.1.tar.gz
tar zxvf apple-kbd-0.1.tar.gz
</pre><p>But you can of course fork my git repository to play with it:</p><pre>git clone git://github.com/dciabrin/apple-kbd.git
</pre><p>Have a look at <tt id='tt1128'
>README.rst</tt> for the details. Basically, you want to edit the file <tt id='tt1129'
>apple-kbd</tt> to configure your keyboard preferences (Insert key, PC keyboard emulation...). Then, you need the usual:</p><pre>make
sudo make install
</pre><p>I'm unfortunately a bit lazy, so contrary to the Debian package, you will need to reboot, or at least to re-plug the keyboard and restart the X server for your configuration to take effect. In a future version I will provide a command-line tool to force configuration changes to take effect on-the-fly.</p><h2>Is the support finished?</h2><p>I believe <tt id='tt1133'
>apple-kbd</tt> is really a milestone in the support of the Aluminium Keyboards. But of course, everything's perfectible. I actually see two important things that remain to do. The first one is to check whether the <a href="https://bugs.launchpad.net/ubuntu/+source/linux/+bug/214786">longstanding ISO-swapped-keys bug</a> is really fixed for all the layouts. The second is to add a XKB geometry for the Wireless Aluminium Keyboards (the short ones). Plenty of work in perspective...</p><p>So here it is, tell the world about <tt id='tt1135'
>apple-kbd</tt>, future will tell if this package is useful!</p>Anonymoushttp://www.blogger.com/profile/15807471573169658489noreply@blogger.com8tag:blogger.com,1999:blog-239704346929885385.post-73709389215056081542011-01-11T22:48:00.004+01:002011-04-30T14:04:38.288+02:00Apple Aluminium Keyboards with udev, Xorg server 1.9<p>It's been a year now since I published my support for Aluminium Keyboards. Since then, my XKB patches have been accepted in <a href="http://freedesktop.org/wiki/Software/XKeyboardConfig">XKeyboardConfig</a> 1.9, with a few modifications:</p><ul><li>The multimedia keys can always be accessed by combining Fxx with the 3rd level chooser (this was option <tt id='tt1099'
>alul3media</tt> in my original XKB patches)</li>
<li>There is now a single XKB option <tt id='tt1101'
>alupckeys</tt> to emulate the behaviour of a PC keyboard, <em>i.e.</em> to enable PrintScreen, ScrollLock, SysReq and NumLock (options <tt id='tt1103'
>alupcfkeys</tt> and <tt id='tt1104'
>alupcnumlock</tt> in the original patches)</li>
</ul><p>Meanwhile, Xorg server 1.9 went stable, becoming more and more pervasive. As far as input hotplugging is concerned, this is a major revision for it dropped <a href="http://www.freedesktop.org/wiki/Software/hal">HAL</a> in favor of <a href="http://www.kernel.org/pub/linux/utils/kernel/hotplug/udev.html">udev</a>: input discovery is achieved via udev and XKB settings for devices are fetched from the udev database.</p><p>I have thus ported the support for the Aluminium Keyboards to udev. As before, a configuration file controls the XKB settings to apply, as well as the remapping of the "fn" key to "insert", if requested.</p><a name='more'></a><br />
<h2>Installing the udev-enabled support</h2><p>First, download the <a href="http://damien.ciabrini.free.fr/pub/alu-kbd-udev/95-keymap-apple-kdb.rules">necessary udev rules</a> and install them in whatever directory your distrib uses to store user rules. On Ubuntu, assuming that you downloaded the rules in your home directory, this gives:</p><pre>sudo cp $HOME/95-keymap-apple-kdb.rules /etc/udev/rules.d
</pre><p>Then, download the <a href="http://damien.ciabrini.free.fr/pub/alu-kbd-udev/apple-kbd">configuration file</a> and install it in your distrib's configuration directory. On Ubuntu, this gives:</p><pre>sudo cp $HOME/apple-kbd /etc/default
</pre><p>The configuration file contains various key-value pairs that drive the behaviour of the Aluminium Keyboard. By default, the configuration enables the XKB option for PC-like mapping (PrintScreen, ScrollLock, Pause, NumLock) and maps the "fn" key to "insert". Comment out the relevant lines to disable any of those settings if necessary.</p><h2>There's a catch: what's your distrib?</h2><p>The udev-enabled support assumes one thing: that you are running xkeyboard-config 1.9 or above. Not all distribs are equal in this regard.</p><p>A quick search shows that Arch, Gentoo, Fedora or openSUSE all ship a recent-enough xkeyboard-config. On the other hand, Debian is currently stuck with xkeyboard-config 1.8-2 (at least for unstable, I haven't checked experimental).</p><p>The Ubuntu case is the most puzzling one. At the time of writing, Maverick and Natty ship xkeyboard-config 1.8-1ubuntu8, which is based on 1.8 stock plus additional important commits from the git repository. This includes my patches for the Aluminium Keyboard (!), but unfortunately only 6 patches out of 7 have been included (!?!). Consequently, the XKB support is currently broken for Ubuntu. I have filled <a href="https://bugs.launchpad.net/bugs/696232">bug 696232</a> in Launchpad to track this issue and check whether this was intended or not. Meanwhile, you can grab <a href="http://damien.ciabrini.free.fr/pub/alu-kbd-udev/xkb-data-1.8-evdev.patch">this XKB patch</a> and try to apply it:</p><pre>sudo bash
cd /usr/share/X11/xkb/rules
patch -p0 --dry-run < $HOME/xkb-data-1.8-evdev.patch
</pre><p>If the patch applies successfully, you can proceed and apply it for real:</p><pre>patch -p0 < $HOME/xkb-data-1.8-evdev.patch
</pre><h2>Steps to come</h2><p>With this updated support, Aluminium Keyboards work again under recent versions of the Xorg server, but there are still various improvements to think about. The next step is to package the support to make it more user-friendly. A package is definitely a good place to deal with other keyboard options, such as kernel settings for activating multimedia keys <em>vs.</em> function keys.</p><p>On the XKB side, it would be necessary to perform a second pass to ensure that there are no missing or misplaced symbols on the 16 existing keymaps: ANSI, JIS and the 14 ISO layouts.</p><p>Speaking of misplaced symbols: I am currently checking whether it's possible to come with a fully user-space, udev-based solution to the <a href="https://bugs.launchpad.net/ubuntu/+source/linux/+bug/214786">"keys swapped" issue</a> that plague some owners of the ISO variants. I have some ideas, but this will be another post!</p>Anonymoushttp://www.blogger.com/profile/15807471573169658489noreply@blogger.com0tag:blogger.com,1999:blog-239704346929885385.post-58244439338892987082009-12-22T22:03:00.008+01:002011-04-30T14:01:01.594+02:00Aluminium Keyboard support under X11: all models, all OSes<p>I finally found the time to update my previous support for Aluminium Keyboard under Xorg, and take it to the Next Level (tm). The overall support is now much more polished. For you this means several things:</p><ul><li>I've implemented the XKB geometries of <strong>all variants of the long Aluminium Keyboard</strong>, be it <a href="http://damien.ciabrini.free.fr/pub/applekbd-xkb/apple-alukbd-ansi.svg">ANSI</a> (American), <a href="http://damien.ciabrini.free.fr/pub/applekbd-xkb/apple-alukbd-iso.svg">ISO</a> (Internationnal) or <a href="http://damien.ciabrini.free.fr/pub/applekbd-xkb/apple-alukbd-jis.svg">JIS</a> (Japanese)! And believe me, it's darned complicated to support JIS keyboard's dual layout without having access to the real hardware :D</li>
<li>I've added support for base XKB rules, which means that the keyboard will now be properly configured <strong>on other OSes than Linux</strong>. I personally used <a href="http://www.opensolaris.org/">OpenSolaris</a> during my tests, but it should work equally well on <a href="http://www.freebsd.org/">FreeBSD</a>, <a href="http://openbsd.org/">OpenBSD</a>, and all their cousins!</li>
<li>The keyboard support is now <strong>aware of the system-wide keyboard settings</strong> as found in Debian or Fedora for example. If you configured your system to default to Dvorak layout, the support will use it automatically!</li>
</ul><a name='more'></a><br />
<h2>Installing the new support</h2><p>I'm short on details, but you can find a complete explanation for all these steps in a <a href="http://damienciabrini.blogspot.com/2009/05/make-your-apple-aluminium-keyboard.html">previous post</a>.</p><h3>XKB Patch</h3><p>First of all, download <a href="http://damien.ciabrini.free.fr/pub/applekbd-xkb/applekbd-xkb-support.patch.gz">this XKB patch</a> and try to apply it on your XKB install in dry-run. For the sake of the example, I assume you downloaded the patch in your <code>$HOME</code> directory.</p><pre>sudo bash
cd /usr/share/X11/xkb
gunzip -cd $HOME/applekbd-xkb-support.patch.gz | patch -p1 --dry-run
</pre><p>If the patch applies successfuly, you can proceed and apply it for real:</p><pre>gunzip -cd $HOME/applekbd-xkb-support.patch.gz | patch -p1
</pre><h3>HAL support</h3><p>Well, even if HAL is meant to be replaced sooner or later by <a href="http://fedoraproject.org/wiki/Features/DeviceKit">DeviceKit</a>, that's the way to go for the time being. So I reworked the previous HAL support and split it in one fdi file to track your keyboard on your hardware, plus a script to configure XKB for Aluminium Keyboard and to remap the Fn key to Insert. To install it, first remove the fdi file from the previous support if necessary. Then, copy this <a href="http://damien.ciabrini.free.fr/pub/applekbd-xkb/10-applekbd-xkb-settings.fdi">new fdi file</a> (which you have previously downloaded in your <code>$HOME</code> directory) in the relevant HAL directory. On my Ubuntu Karmic, this gives (<strong>update:</strong> added missing chmod, thanks Patrick):</p><pre>sudo bash
rm -f /usr/share/hal/fdi/policy/30user/10-apple-aluminium-kbd.fdi
mkdir -p /usr/share/hal/fdi/policy/30user
cp $HOME/10-applekbd-xkb-settings.fdi /usr/share/hal/fdi/policy/30user
</pre><p>Download (I assume in your <code>$HOME</code> directory) the <a href="http://damien.ciabrini.free.fr/pub/applekbd-xkb/applekbd-xkb-settings.sh">new script for XKB setting</a>, plus its associated <a href="http://damien.ciabrini.free.fr/pub/applekbd-xkb/applekbd-xkb-settings">configuration file</a>. Then copy them respectively in HAL's installation directory and in the system-wide configuration directory. On my Ubuntu, ths gives:</p><pre>sudo bash
cp $HOME/applekbd-xkb-settings.sh /usr/lib/hal
chmod +x /usr/lib/hal/applekbd-xkb-settings.sh
cp $HOME/applekbd-xkb-settings /etc/default
</pre><p>You can tweak the configuration file <code>/etc/default/applekbd-xkb-settings</code> to enable the settings you want for your keyboard. By default, the Fn key is remapped to Insert. The XKB options can be configured there for system-wide setting, as explained in the configuration file itself. But it's more user-friendly to configure XKB in your preferred Desktop Environment (GNOME, KDE, XFCE... whatever).</p><h2>Enjoy!</h2><p>I'm particularly happy with my revised XKB geometries. A tedious work, but this time keys dimension and layout perfectly match the original hardware, whatever the model. I'm even more happy now that I discovered how Apple decided to implement their EISU and KANA keys on the JIS keyboard! If you are curious, have a look at file <code>xkb/keycodes/machintosh</code> in the patch, or read <a href="http://forum.parallels.com/showthread.php?t=90313">this post on Parallels' forum</a>.</p><p>The XKB patches are now ready for submission to the Xorg people (xkeyboard-config). The rest of the files are also clean enough to start providing .deb packages for this support! Maybe a good opportunity of learning <a href="https://help.launchpad.net/Packaging/PPA">PPA</a> in <a href="https://launchpad.net/">LaunchPad</a> :P</p>Anonymoushttp://www.blogger.com/profile/15807471573169658489noreply@blogger.com14tag:blogger.com,1999:blog-239704346929885385.post-51981983395572257412009-05-15T00:16:00.013+02:002011-04-30T13:59:09.411+02:00Make your Apple Aluminium Keyboard really work under Linux, X.org<p>Like many others, I've bought an Aluminium Keyboard for <del>its cool style</del> the smooth typing experience it provides. Mine is a wired version, ISO variant (international, 110-keys). It's not working 100% out-of-the-box under Linux, so this post explains what I did to make it happen:</p><ul><li>Supporting the additional keys (F13..F19) and geometry (physical layout) under X.org</li>
<li>Making the keyboard auto-configured at X.org startup. No need to mess with xorg.conf!</li>
</ul><p>But wait, there's more. If you're accustomed to PC keyboards, you really need those ones too:</p><ul><li><strong>Making this fn key located on top of the delete key behave like a regular PC keyboard: Insert!</strong></li>
<li>Making multimedia keys output Fxx symbols by default</li>
<li>Making F13..F15 behave like those charmingly obsolete Scroll Lock..Print Screen keys</li>
<li>Keeping the multimedia keys accessible when the fn key is remapped to Insert</li>
</ul><a name='more'></a><br />
<h2>Prerequisite</h2><p>First, make sure you have installed all the packages below and that their versions are recent enough:</p><ul><li><a href="http://www.freedesktop.org/wiki/Software/Xserver">xserver-xorg</a> v1.5.2, X.org's hotplug-aware X server</li>
<li><a href="http://cgit.freedesktop.org/xorg/driver/xf86-input-evdev">xserver-xorg-input-evdev</a> v2.0.xx, evdev driver for input devices</li>
<li><a href="http://www.freedesktop.org/wiki/Software/hal">HAL</a> v0.5.xx, the hardware abstraction layer daemon which gives hotplug information to the X server</li>
</ul><h2>How the support works</h2><h3>Install</h3><p>Go grab <a href="http://damien.ciabrini.free.fr/pub/apple-alu-kbd/xkb-apple-aluminium-kdb-iso.patch.gz">this patch</a> and save it in your home directory; it contains the relevant XKB updates to support the keymap and the geometry of Apple Aluminium keyboard, ISO variant. It also defines two XKB options to make this keyboard behave more like a PC keyboard (more on that later). To install it, first <em>pretend</em> to apply the patch in the directory that holds the XKB data. On my Ubuntu, this gives:</p><pre>sudo bash
cd /usr/share/X11/xkb
gunzip -cd $HOME/xkb-apple-aluminium-kdb-iso.patch.gz | patch -p1 --dry-run
</pre><p>If the patch applies successfuly, you can proceed and apply it for real:</p><pre>gunzip -cd $HOME/xkb-apple-aluminium-kdb-iso.patch.gz | patch -p1
</pre><p>Once you have the relevant XKB definition for your keyboard, you need to tell X.org to apply these settings automatically when it detects your keyboard. <a href="http://damien.ciabrini.free.fr/pub/apple-alu-kbd/10-apple-aluminium-kbd.fdi">The following HAL fdi file</a> makes the necessary voodoo (read: XKB settings) for you. Note that these settings do not preclude your system-wide XKB options.</p><p>In order to install the fdi file I'm providing, just copy it in the HAL directory which holds user-defined policies for devices. On my Ubuntu, this directory is <code>/usr/share/hal/fdi/policy/30user</code>. You might need to create <code>30user</code> if it doesn't exist.</p><h3>Test</h3><p>Now that you installed everything, restart HAL. For example, on a Debian-like distro:</p><pre>sudo /etc/init.d/hal restart
</pre><p>Then log out from your current X session and start a new one. If everything went well, you should now be able to see the Aluminium Keyboard in your keyboard preferences application. The screenshots below show the result under GNOME:</p><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhSLt02r6MJJpiiSqgYbVO-KmTreptX_-eH3YqgwRmTDAINNAatmDbQi0ufHiGRFTBA_WpH7xSMC-wEDhVtprv3yzNIzk7Eo4Jdnys1JG9AqCw4DEUE9zYD1b5qh7m2DTtf2u3hPf_-ysQ/s1600-h/alukbd-preferences.png"><img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 311px; height: 320px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhSLt02r6MJJpiiSqgYbVO-KmTreptX_-eH3YqgwRmTDAINNAatmDbQi0ufHiGRFTBA_WpH7xSMC-wEDhVtprv3yzNIzk7Eo4Jdnys1JG9AqCw4DEUE9zYD1b5qh7m2DTtf2u3hPf_-ysQ/s320/alukbd-preferences.png" alt="" id="BLOGGER_PHOTO_ID_5336183606693452386" border="0" /></a><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhaANGQr-vDPDGBsC4Do8kyc41Yjmoz6zKZnGSjQ4ZE6c4og5bQP9cQCohvGgxuhxkSDezQs8DBO-LKCAOjo_hhBmJbjaG9_XNY0I0WT-wCw6zM9ItM-0brVaAD9PUFXFhgxr8jp9pMvzw/s1600-h/alukbd-geometry.png"><img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 320px; height: 166px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhaANGQr-vDPDGBsC4Do8kyc41Yjmoz6zKZnGSjQ4ZE6c4og5bQP9cQCohvGgxuhxkSDezQs8DBO-LKCAOjo_hhBmJbjaG9_XNY0I0WT-wCw6zM9ItM-0brVaAD9PUFXFhgxr8jp9pMvzw/s320/alukbd-geometry.png" alt="" id="BLOGGER_PHOTO_ID_5336183605782026258" border="0" /></a><h2>Make it a PC keyboard!</h2><h3>The Insert key hack</h3><p>The fn key is not seen by X because its keycode (464) is greater than 255, <a href="http://bugs.freedesktop.org/show_bug.cgi?id=x11-keycode-limit">which is not allowed</a> in X11 protocol. But there is a trick: under Linux, you can modify the kernel scancode→keycode mapping of your evdev device!</p><p>Just uncomment the two optional lines in the <a href="http://damien.ciabrini.free.fr/pub/apple-alu-kbd/10-apple-aluminium-kbd.fdi">fdi file</a> I'm providing to make the fn scancode (HID usage 0xff0003 on this keyboard) generate the Insert keycode (110) in userland and make Xorg happy :D</p><p>For curious people: <a href="http://thread.gmane.org/gmane.comp.freedesktop.hal/8615/focus=8615">Initially</a> (funny how these names look familiar if you read <a href="http://planet.gnome.org/">p.g.o</a>...), HAL's keycode remapping seems to have been designed with <a href="http://www.win.tue.nl/%7Eaeb/linux/kbd/scancodes-1.html">AT scancodes</a> in mind, not HID usages. In order to override those ones, you must <a href="http://thread.gmane.org/gmane.comp.freedesktop.hal/8615/focus=8687">revert a special encoding</a> performed for representing AT escape scancodes. In our case, you end up remapping usage 0xffdf83!</p><h3>Fxx keys enabled by default</h3><p>This one is not new. In order to boot with Fxx keys enabled, you must pass an option to the <code>hid</code> Linux module. On my Ubuntu, this can be done by updating modprobe options and rebuilding an <code>initrd</code> image.</p><pre>sudo bash
echo "options hid pb_fnmode=2" >> /etc/modprobe.d/alukbd
echo "options hid_apple fnmode=2" >> /etc/modprobe.d/alukbd
update-initramfs -k `uname -r` -u
</pre><h3>Additional PC-like XKB options</h3><p>The XKB patch I'm providing defines two new XKB options:</p><dl><dt><code>apple:alupcfkeys</code></dt>
<dd>If you need to map F13..F15 to Scroll Lock..Print Screen keys (I won't judge you, I swear :P)</dd>
<dt><code>apple:alul3media</code></dt>
<dd>If you remap fn to Insert, this options allows you to access the multimedia keys is by typing 3rd-level chooser + Fxx key. I've mapped my 3rd-level chooser to the right Alt key (XKB option <code>lv3:ralt_switch</code> )</dd></dl><p>Naturally, the simplest way of using these XKB options is to enable them via your keyboard preferences application. For instance, GNOME users can find them in the Keyboard Layout Options:</p><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgbWaGjuaLtdK487Nw53IpYpLP-J3sYVfDwNJKldqUPGGH6su3GI-SJWoU54eFd43O0ZZoliVtPqPmP50Tpm0i8Ho2Uf7dU7mVM_Qz-hIwy_ZBwhfpg_HKeTmjx7OqK7Cn_mKl-jcU6UYc/s1600-h/alukbd-options.png"><img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 320px; height: 232px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgbWaGjuaLtdK487Nw53IpYpLP-J3sYVfDwNJKldqUPGGH6su3GI-SJWoU54eFd43O0ZZoliVtPqPmP50Tpm0i8Ho2Uf7dU7mVM_Qz-hIwy_ZBwhfpg_HKeTmjx7OqK7Cn_mKl-jcU6UYc/s320/alukbd-options.png" alt="" id="BLOGGER_PHOTO_ID_5336183605271785506" border="0" /></a><h2>Conclusion</h2><p>My XKB and HAL settings provide complete support for your Aluminium Keyboard on Xorg Linux. However, the Insert key hack is probably not mainstream and ultimately should not land in a fdi file. It would be better to make a distro package such as “enable PC-support on Aluminium Keyboard”.</p><p>The XKB geometry implemented is for the ISO variant. if you have one of the other variant and like to throw it away, you know I'd be happy to add support for it, eheh :P</p>Anonymoushttp://www.blogger.com/profile/15807471573169658489noreply@blogger.com24tag:blogger.com,1999:blog-239704346929885385.post-3631586931812713352009-02-23T21:53:00.003+01:002009-02-23T22:00:35.458+01:00Toolchain.sh is amazing!<p>A few weeks ago, I finally upgraded my iPhone to firwmare 2.2.1. It was actually an utterly painless operation, thanks to the amazing <a href="http://code.google.com/p/iphonedevonlinux/wiki/Installation">toolchain.sh</a> by the guys from <a href="http://code.google.com/p/iphonedevonlinux/">iphonedevlinux</a>.
</p><p>I remember in the 1.1.4 days, I had a hard time extracting the MacOS 10.5 SDK on Linux and compiling the openSDK on my Core2 Quad by following <a href="http://www.saurik.com/id/4">saurik's great instructions</a>.
</p><p>It turns out that building an open SDK for firmware 2.2.1 is actually very simple: getting a copy of the phone's sysroot, building GCC, importing headers from the official iphone SDK, classdumping private frameworks... all these operations are now almost automatic thanks to toolchain.sh.
</p><p>The icing on the cake: those smart people from <a href="http://code.google.com/p/iphonedevonlinux/">iphonedevlinux</a> are friendly and reactive! Another good reason for <a href="http://code.google.com/p/iphonedevonlinux/issues/detail?id=7">sending</a> <a href="http://code.google.com/p/iphonedevonlinux/issues/detail?id=6&can=1#c15">them</a> <a href="http://code.google.com/p/iphonedevonlinux/issues/detail?id=10">patches</a> and using their script :)
</p>Anonymoushttp://www.blogger.com/profile/15807471573169658489noreply@blogger.com0tag:blogger.com,1999:blog-239704346929885385.post-292066248469083642008-07-05T00:27:00.003+02:002008-07-05T00:39:02.970+02:00Hello MikMod!As promised earlier, I've packaged an obligatory example of how to use the iPhone port of <a href="http://mikmod.raphnet.net/">libmikmod</a> which I've talked about recently. Go grab <a href="http://damien.ciabrini.free.fr/pub/mikmod-iphone/HelloMikMod.tar.gz">this tarball</a> which implements a very simple "Hello World!":
<ul><li>It shows how to play a module within a <a href="http://www.cocoadev.com/index.pl?UIKit">UIKit</a> application. This is an adaptation of the skeleton program found in <a href="http://http//mikmod.raphnet.net/#docs">MikMod Documentation</a>.</li><li>It shows how to use the higher level sound API <a href="http://www.cocoadev.com/index.pl?CelestialFramework">Celestial</a> to control mikmod output. For instance, how to react to volume change events when iPhone buttons are pressed.</li></ul>What to do with this archive once you've extracted it?
<pre>
tar -zxf HelloMikMod.tar.gz
cd HelloMikMod
</pre>
Simple! Modify the Makefile to set the location of the <span style="font-family:courier new;">AudioQueue.h</span> header, as well as the location where you've installed libmikmod. Once you're done, the makefile should look like:
<pre>
# directory where AudioQueue.h is located
AQDIR=$(HOME)/local/audioqueue
# directory where MikMod is located
MMDIR=$(HOME)/local/mikmod-iphone
# comment the following line when the previous settings are OK for you
#$(error configure AudioQueue and Mikmod location in the Makefile first)
</pre>
Then, just build and install the app by typing:
<pre>
make
scp -r HelloMikMod.app root@iphone:/Applications
</pre>
Where <span style="font-family:courier new;">iphone</span> stands for the hostname or the IP of your iPhone. Note that you will need either curl or wget installed or your machine so that the build process is able to download the module played in this example app (fortunately, one of those should always be available on MacOS X or on your favorite Linux distro).
For your convenience, the <span style="font-family:courier new;">HelloMikMod.app</span> directory is standalone: it contains the app itself linked statically to libmikmod, a launcher descriptor for Springboard and the module to play. For my own pleasure, the mod played is <a href="http://modarchive.org/module.php?59344">Stardust Memories</a> by Jester / Sanity, my all time favorite Amiga mod (see the compo <a href="http://www.pouet.net/prod.php?which=2938">World of Commodore</a>).
This is only a simple example of how to use MikMod on iPhone. I've started implementing a more complex app that mimics the iPod interface for playing mods (Module DB, Screenshot of associated demos...). Now if only I could use <a href="http://www.scenemusic.net/">Nectarine</a> or <a href="http://pouet.net/">Pouet.net</a> DB to make some kind of systematic indexing available!! (sigh....)Anonymoushttp://www.blogger.com/profile/15807471573169658489noreply@blogger.com4tag:blogger.com,1999:blog-239704346929885385.post-16560092111098340392008-06-27T23:18:00.007+02:002009-02-03T21:27:17.037+01:00MikMod library ported to iPhoneI've always been a big fan of old skool computer music, like chiptunes or demoscene music. Perhaps because they remind me the Good Old Days (tm) of my <a href="http://en.wikipedia.org/wiki/Amiga">Amiga</a>. Or perhaps for the same reason I like <a href="http://pouet.net/">demoscene</a>: real-time computer art!
Because it's definitely cool, I've decided to port MikMod to the iPhone! We'll see later if it might be useful to someone else :)
<span style="font-size:130%;">Compiling libmikmod</span>
Here are the steps to follow to build libmikmod for your iPhone or iPod Touch.
First of all, make sure that you have the necessary header file from Apple, namely <span style="font-size:100%;"><span style="font-family:courier new;">AudioQueue.h</span></span>. This file is part of the AudioQueue framework, which is available in the <a href="http://developer.apple.com/tools/download">MacOS X 10.5 SDK</a>. This means that the official iPhone SDK is not required.
Then, download the latest <a href="http://mikmod.raphnet.net/files/libmikmod-3.2.0-beta2.tar.gz">libmikmod-3.2.0-beta2</a> available on the <a href="http://mikmod.raphnet.net/">MikMod homepage</a>, as well as <a href="http://damien.ciabrini.free.fr/pub/mikmod-iphone/iphone-drv-mikmod-3.2.0-beta2.patch.gz">this patch for iPhone support</a>. For simplicity, let's consider that both files will be downloaded in the same directory. Once you have them, extract the archive and apply the patch:
<pre>
tar -zxf libmikmod-3.2.0-beta2.tar.gz
cd libmikmod-3.2.0-beta2
gunzip -cd ../iphone-drv-mikmod-3.2.0-beta2.patch.gz | patch -p1
</pre>
Among other things, the patch modifies various Makefiles and the configure script, so we have to cleanly regenerate all the autotool-related files:
<pre>
aclocal
automake
autoconf
</pre>
Now let's set up the necessary environment variables to configure and build libmikmod. First, where to find the AudioQueue header and where to install libmikmod:
<pre>
export AQDIR=$HOME/local/audioqueue
export MMDIR=$HOME/local/mikmod-iphone
</pre>
Make sure you are using absolute paths for the variables above. Then, let's set up some compilation flags and name the tools we'll use from the iPhone toolchain:
<pre>
export CFLAGS="-I$AQDIR -DAVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER="
export CPPFLAGS="$CFLAGS"
export LDFLAGS="-framework AudioToolbox"
export CC=arm-apple-darwin-gcc
export RANLIB=arm-apple-darwin-ranlib
</pre>
Okay, now it's time to let configure do its job:
<pre>
./configure --enable-iphone --host=arm-apple-darwin --disable-oss --disable-esd --prefix=$MMDIR
</pre>
We're almost done! But there's still a little quirk that must be addressed. The project is configured to build shared libraries, which for some reason refuse to link with the version of the open-source iPhone toolchain I use. To overcome this problem, you just need to patch the generated libtool configuration. Knowing no clever means to do so, I propose something like:
<pre>
sed -r -i 's/^(allow_undefined_flag.*)"/\1 -Wl,-read_only_relocs,suppress"/' libtool
</pre>
Phew, now we're done! Just type:
<pre>
make CFLAGS="$CFLAGS"
make install
</pre>
And voila! a fresh libmikmod with support for your beloved iPhone or iPod Touch! Oh, by the way: the library comes in both static and dynamic flavor, so it should be pretty usable. Of course, the obligatory example will follow soon :P
<span style="font-weight: bold;">EDIT: </span>the link to the patch was pointing to a plain file instead of a gzip one, fixed!Anonymoushttp://www.blogger.com/profile/15807471573169658489noreply@blogger.com8tag:blogger.com,1999:blog-239704346929885385.post-60790058687474727302008-06-19T21:44:00.005+02:002008-06-27T23:18:10.527+02:00Hello World!I'm opening this blog to share my bits of code, hacks or thoughts I have during the time I spend in front of my computer.
That will be a great occasion for me to retrieve all the goodies laying in my attic and that I should take the time to package cleanly! Moreover, that will be a good way of talking about the cool things I work on nowadays...
Okay, I know... it sounds so vague... but hey, it's only a Hello World after all :)Anonymoushttp://www.blogger.com/profile/15807471573169658489noreply@blogger.com0