Macbook Pro sound hardware

A few weeks ago, I wrote that sound didn’t work on the new Macbook Pro. A helpful reader sent me in the remarkably simple solution: just show and unmute the “surround” channel in gnome-volume-control (and then file a bug). I also made the gnome-volume-applet use both the surround and the headphone channel, so that it works both with headphones and with speakers. This way, the device works flawlessly (I didn’t test microphone or line-in yet, but that most likely works just fine, also). I’m suspecting the surround channel should be renamed (to speakers) for this specific card type using the hda-intel chipset, and that the other surround-channels and surround-related channels (e.g. to make line-in and mic outputs and have them be used for LFE and for surround sound) should be disabled.

With Ryan Lortie’s mention on how to setup the remote control to work using appleIR, this means all hardware and features of the device appear to work reasonably well under Linux (including wireless, suspend/resume and such).

Now back to real programming!

iSight @ Linux #3

As previously stated, I’ve been working on a Linux driver for the iSight built-in in the Macbook Pro. Today, at the DDC in Ottawa (Canada), I got it working in a good enough state to call it useful. I’ll test it in various applications to make sure all ioctls behave correctly, but that should be minor work. This would complete phase I.

The Apple iSight is, on closer look, not UVC-compliant. Format querying (to query which framerates, sizes and pixelformats the device supports) is UVC-style, but data transfer is different. It took me a while to figure out how to get a full image out of those datadumps, but hexedit came to the rescue. The main problem with the driver right now is that it requires you to boot Mac OS X before starting Linux. OS X appears to initialize the device in some way (before that, it is recognized as a vendor-specific device and it doesn’t really do anything), and I don’t know how. Anybody with experience in USB bus sniffing under OS X (or who has this device and is willing to do that for me under OS X or WinXP), please contact me (or leave a message in the comments).

iSight @ Linux #2

(See this blogpost for history.)

After some trying out, some hangs (”do not write into NULL pointers in the kernel, Ronald, do not write into NULL pointers in the kernel *argh* too late“), some fixing and some more stuff, I can now get a semi-recognizeable picture. Not good enough for a hackergotchi yet, but I’ll probably be able to fix that up soon. After that, I’ll post a patch.

Macbook Pro Built-in iSight

Previously, I write about my Macbook Pro and Linux installation. Most of this works fine now, so time to get the hardware working.

I decided to start with the iSight. Apparently, this is a USB device which shows up in lsusb -v output as the top-most device. What’s better, it implements the new USB Video Class standard, of which a basic Linux implementation exists. Unfortunately, it doesn’t load by default, it errors out early in the initialization process with an error about not being able to retrieve the current palette.

[17186281.868000] usbcore: deregistering driver uvcvideo
[17186287.236000] Linux video capture interface: v1.00
[17186287.240000] uvcvideo: Found UVC 1.00 device Built-in iSight (05ac:8501)
[17186287.240000] uvcvideo: Failed to query (135) UVC control 1 (unit 0) : -32.
[17186287.240000] uvcvideo: Failed to initialize the device (-5).
[17186287.240000] usbcore: registered new driver uvcvideo

I of course went on to debug it, and somewhere in this process, I crashed my kernel (oops :-) ). However, after a restart, I cannot see the device in lsusb output anymore. A quick touch upon the back of my laptop suggests that the whole machine is highly overheated. So here’s my real two questions:

  • Has anyone played with the UVC driver to get the built-in iSight to work?
  • Has anyone found that his Macbook overheats under Linux? How do I get the fan to turn on automatically (or manually, if I really have to)?

Also, anyone familiar with the USB Video Class or the USB stack on Linux (and with some spare time), please contact me on IRC (#gnome-hackers), I’d love to debug this thing with someone more familiar with the standard than I am.

Edit: apparently, after a reboot into MacOS X and back into Linux, it is recognized again. It appears some of the (read-only?) fields in the device have to be specifically initialized. This may imply the device is not 100% UVC-compatible. Anyway, it works again, let’s see how it works.

A Mac

Recently, I decided to buy a new laptop. After some thinking, I figured: why not a Mac? Makes the OS (commonly referred to as MS tax) that they shove in your ass with new laptops actually useful. And still allows me to run MS Office, crucial for university/research work (and OO.o is useless).

The first interesting thing is to go to a Mac store. The sales people there will quickly and happily talk to you, they’re actually nice guys, until you get to the actual act of buying. “Do you want a dot-Mac account?” and “You’re a student? If you just want to use MS Office and send some email, a regular MacBook may be just as good a choice, and it’s much cheaper”. I bought the 15″ MacBook pro.

Getting Linux to run
OS X is beautiful, with some rough edges. Obviously, I’d eventually want to run a dualboot. After seeing many people be enthousiastic about Ubuntu and getting sick of Fedora (die, yum, die!) small oddities, I followed this howto to get it all to work, and it mostly just worked out-of-the-box. I also like how universe can be added in a single click (somehow, I wish synaptic would always start in advanced mode; how do I do that?). Other distros should learn from this. Yum may theoretically be correct (?), but I don’t give a damn. Ubuntu’s package management really is a bliss.

Not all is fine:

  • Ubuntu’s live-CD installer gives me the nerves. The worst part was where I manually partitioned the hard-disk (to make sure it wouldn’t destroy my HFS+ partition, but just use the partition set aside for “WinXP” using bootcamp). After endless trying, the thing was convinced to either use my swap partition as ext3 and my ext3 partition as swap, or both as swap, that choice apparently depending on airwaves instead of the selection I made two dialogs back. It crashed on me three times, once while pressing forward/back in the partitioning tool, once between formatting/installation and once after the installation after it fails to install grub. Reminds me of old horrible Fedora times. Fortunately, restarting the installer from the live-CD is a lot faster than having to restart the whole Fedora installer process. Also, even though I selected the HFS+ partition to be mounted as /mnt/mac, I had to manually add it to /etc/fstab, and my normal Ubuntu user cannot access documents in /mnt/mac/Users/[my apple user ID]/ (permission denied). Lazyweb, how do I fix that? (Edit: one helpful reader told me to use the same UID for my Apple/Ubuntu user.)
  • sound doesn’t work with Ubuntu’s 2.6.15-23 kernel. With 2.6.15-25 (which contains an upstream alsa-patch for hda-intel merged in), I can only get sound through the Microphone jack (?). Speakers and line-in/out are silent, as also reporter here. Sound appears to be fine on the 17″, so I guess I’ll need to look through some PCI / gpio dumps to get this to work properly.
  • I decided to see how multimedia on the desktop was going. Banshee (which everybody loves, and which should have great iPod support) just crashes when loading /tmp. Rhytmbox actually works after that, but even after installing gst-ugly, -bad, -disgusting, -awful and other such modules, I still couldn’t get my iTunes-ripped m4a files to play. The totem-mozilla plugin didn’t play anything and gave cryptic warnings about “fd://0″ that reminded me of ancient history. It probably doesn’t support asf playlists, which is what all big sites serve (no, nobody uses Theora). What a waste. Installing totem-xine lead me into this bug. With the workaround, totem-xine sometimes works, but the mozilla plugin still crashes (only with flgrx, not with vesa). No wonder people use mplayer. Geez. (Note that the Windows Media Player Flip4mac additions for OS X – to get support for WMV/WMA in Quicktime – also don’t work yet on MacIntels, but that’s barely a valid excuse). (Edit: As one reader pointed out, this should read flip4mac, not WMP, of course. Apparently, those are in beta and will come out “soon”.)
  • People tell me suspend/resume on this thing should work. How? There’s only a hibernate button in the session-quit dialog, and IIRC, that is software suspend. Lazyweb, anyone?

All in all, not so bad. Next step: buy a (cheap!) huge USB disk (as recommended by the MacStore sales people), find some decent IDE (Anjuta looks promising) and go do something again.