Archive for the ‘mac’ Category

Put that SPDIF out to use! (as an HDD or network indicator)

Monday, November 13th, 2006

Apple decided we don’t need an LED indicator for disk activity. I decided we do. Using the SPDIF out, we now have one!

I put together a quick little script that’ll poll the proc filesystem and toggle the SPDIF out accordingly.

Check it out: MacBook LED

Both headphone sensing and microphone fixed for Linux on MacBook!

Monday, November 13th, 2006

The current (2006/11/12) state of ALSA for the MacBook (and MBP, ..?) is pretty strange: If you’re using a vanilla kernel, chances are your headphone sensing works (when you plug in headphones, your internal laptop speakers mute and you hear audio from your headphones). If you’re using a mactel-patched kernel (or the generic Ubuntu kernel, maybe other distros that prepatch with mactel), chances are your microphone has the ability to work (you have to toggle between Line-in and Mic on the ALSA mixer for it to work), but your headphone sensing doesn’t (when you plug in headphones, you hear audio from both the internal speakers and the headphones).

After screwing around with the ALSA driver source code, the Windows driver files, and the Microsoft and Intel spec sheets, I’ve found a solution that allows for both the microphone and the headphone sensing to work! Read more in the Linux on MacBook section

Hamachi nicknames to hostnames

Thursday, November 9th, 2006

If you have a set of machines (or friends) and you’re not using Hamachi, you should! Creating a VPN is as simple as joining a room (think IRC, except you’re VPNed with all though in the room). Pretty amazing.

They support many platforms (at least Windows, Linux, and OS X), but one problem I’ve found on the *NIX is there isn’t a way to translate from the nicknames of those in your room to IP addresses without having to refer to the list. I’ve created a bash script to parse the list of Hamachi users in your rooms and place them into your hosts file (/etc/hosts typically).

The general naming convention I use for my Hamachi nicknames are [computer owner’s name]@[computer name], or sometimes even just the [computer name]. An example of the former nickname style would be jason@mooBook (where mooBook is my laptop’s name), and the latter mooMedia (where mooMedia is my media server–like the moo theme?). So, my script will take the [computer name], tack on the room name, and map that newly created hostname to the VPN IP of the machine. Suppose both of these machines are in the room mooNet. I can now ping moomedia.moonet (case insensitive) or moobook.moonet. I’ve tacked on the room name to prevent adversarial behavior (although if you’re in the room com or net or any other TLD, you’re screwed ;).

You only need to run hamachi2hosts.sh once initially and when more users join your rooms. It creates a section in your /etc/hosts for the automagically mapped Hamachi hosts. Please be sure to change the settings near the top of the file. Also, it assumes you’re logged in when you run it.

Here you go: hamachi2hosts.sh

VMware raw partition booting

Wednesday, November 8th, 2006

VMware is amazing due to one outstanding feature: the ability to run a virtual machine from a raw partition. I mention this in Linux on MacBook page, but I highly recommend this for everyone running Linux.

What this lets you do is have a single XP installation, that is able to be booted natively (for games, etc.) and in the virtual machine (from Linux for random things, mostly turns out to be opening Office files that don’t load cleanly in OO).

I’ve updated the Linux on MacBook’s VMware section with detailed instructions on how to achieve this. On the MacBook, I had issues with XP BSODing on boot, so I’ve noted how to fix this.

New section for Linux on MacBook

Sunday, October 22nd, 2006

It seems like there is still a lot to be done with getting the MacBook to run nicely on Linux. I’ll try to document all of these on this site, and having separate blog posts doesn’t seem too ideal for a newcomer wanting to get all the info at once. I’ve created the Linux on MacBook page. Most of the information there applies across Linux distros, but once in a while there may be something Ubuntu specific. And once in a once in a while there may be something Kubuntu specific.

MacBook fan control in Linux

Sunday, October 22nd, 2006

Turns out the applesmc kernel module (patch from Mactel) supports viewing/changing the fan speeds on the MacBook. But, when you want to modify the fan speed, you must set it to manual mode and set a fixed fan speed. I’d rather have automatic scaling to heat but specify a minimum fan speed. This was luckily an easy change in the applesmc module (just make the /sys device read/write and allow storing a value to the address). Patch: MacBook Minimum Fan Speed Patch. Afterwards, you can set the minimum speed (in this example, to 3000, double the default minimum speed) by:

sudo sh -c "echo 3000 > /sys/devices/platform/applesmc/fan0_minimum_speed"

Enjoy a cooler laptop!

appletouch (Linux kernel driver for Apple trackpads) changes

Monday, October 16th, 2006

It’s been almost two months since I first used OS X on my new MacBook, but I still miss Kubuntu (I’ll have a separate post soon on why). I decided to switch back (well, triple boot–mostly in Kubuntu), but in doing so there have been a few roadblocks. One of these is the trackpad (touchpad) working smoothly–both in terms of moving the mouse and also advanced features of two-finger scrolling, two/three finger taps (for right click and 3rd button click), etc. I changed a few things in the appletouch kernel driver, and the results are pretty good!

The first issue I had was the mouse pointer jumping a few pixels constantly when moving around. The trackpad consists of many sensors (20 on the X axis, 10 on the Y axis for the MacBooks), so when you glide your finger across, each sensor on your finger’s path will go high as the finger approaches/hovers (and go low once your finger leaves the sensor’s ‘zone’). For the trackpad to be used for neat functions (two/three finger functionality), the synaptics X driver should be used, and in order for it to be used, the trackpad must give off absolute coordinates instead of relative (so the actual position of your finger(s) as opposed to the change in your finger(s)’s position). There is thresholding for each of the sensors in order to discard jitter when the finger isn’t triggering a sensor. As soon as a sensor passes the threshold, its value is used (along with the other sensors that are over the threshold) to calculate the absolute coordinates. So, when a finger is approaching a sensor, the sensor’s contribution to the absolute coordinate calculation is 0, but when the finger gets close enough to allow the sensor to pass the threshold, the sensor’s contribution becomes at minimum the threshold value. The default threshold level is 10, so this causes the sensor to go from giving 0 feedback on coordinates, to giving a value of 10 (not exactly) to the function to give coordinates. So instead, I subtract the threshold from each sensor that contributes to the absolute coordinate function. This ends up giving a smooth mouse movement when a sensor suddenly goes from below the threshold, to above.

The second issue was the accuracy of two finger (and three finger) detection. These are used for two-finger scrolling, two-finger clicks, and three-finger clicks, so it’s pretty important in day-to-day use. I found it difficult to trigger the multiple fingers properly (I couldn’t have my two fingers touching each other and I would have to make sure they maintained a good gap when scrolling), so two-finger scrolling was difficult to do. The way it checked for multiple fingers is to count how many sensors that has passed the threshold are preceded by a sensor that is below the threshold. So, the first finger would obviously pass, and then if there is a sensor gap between the first and second finger, the second finger would get triggered. I didn’t like this as I don’t usually leave a gap between my two fingers (OS X didn’t have this constraint). I changed it to check for ‘humps’ in the sensors, so basically check for transitions from nonincreasing to increasing sequential sensor readings on each X/Y axis. This works since the middle sensor(s) (sensors are close enough so when having two fingers down, there will be one sensor between the two) can still be over the threshold and still count as the lower part between humps. After the patch, the two-finger scrolling works as well as OS X (from what I can tell).

The last small issue is being able to change the threshold value. I turned this into a kernel module option (modinfo appletouch).

This patches against Mactel appletouch patch that allows MacBooks to work with that driver. I’ve submitted it to the maintainer of the appletouch kernel driver, so we’ll hopefully see it there!

appletouch-2finger_det-threshold_opt.patch

Summer purchases: Scion tC + MacBook

Thursday, September 28th, 2006

Almost two months later, entry #2!

This summer I made two big purchases: a Scion tC and a MacBook.

I spent the summer with an internship at Avaya Labs in Basking Ridge, NJ. Overall, good experience in terms of both checking out a research lab’s environment and being close to NY and other great cities (== great food!). A few days prior to my planned departure back to Atlanta, my car breaks down! I barely drive it back to the place I was staying (engine was crazily vibrating) and do as much diagnostics as I can without proper tools. I check the forums, and realize I have at least one dead cylinder. Long story short, I had a few dead cylinders caused by a blown head gasket. At this point, I knew I was screwed. The car was already a rebuilt salvage, so it’s value was lower than the cost of any repairs. I end up selling the car to the mechanic for $500, and he keeps the LCD (I took HIDs and RAM+CPU+blown motherboard). I did get screwed, but not much else I could have done. I ended up finding a 5 speed super white Scion tC (exactly what I wanted!) on eBay! It was a rebuilt car, so the cost was half of what it would have been with a clear title, and aside from the hood being misaligned slightly, the car was in great shape. I set out with a cashier’s check for $8,500 and convinced him to let me have it. This car came riced out. It’s slammed to the ground (no finger gap!) and has a huge exhaust, both of which I don’t like. I took off a tire the other day and checked out a spring, turns out they’re factory springs with a coil cut off! My ride is HORRIBLE, I have to go 5 mph over any bump. I ordered some aftermarket springs (not too much drop from factory), so I’ll be putting those on (it’s gonna be rough, but I’ve done it on my old car).

Second purchase was a MacBook. This one I got through crazy bartering. I was browsing FatWallet and found a deal on an HP DV2000t at OfficeDepot for really cheap. It was built-to-order, so you don’t get it in the store, instead it gets shipped to you. I ordered it with a few upgrades, and after rebates and taxes it will come to $500. The retail price would be around $1,000. Oh yeah, I got a free AIO printer too. At this point, I could either keep it (had it’s own set of great features) or sell it and get a MacBook. I figured I might as well sell it, and so I did. I got $800 + 40 for the printer. Next, Apple was having their MacBook + iPod + AIO for $1050. I aligned this purchase with the tax-free period in Georgia (which covered laptop and printer purchases!), so I get it for $1050 + 10 tax on iPod. I also got 1.5% back from my PayPal credit card, and 2.5% FatCash. I wanted to get my order in before the tax-free rush, so I placed the order on Thursday 12:15 AM EST, and tax-free started Thursday 12:01 AM EST. Turns out Apple’s systems go by PST, so they didn’t give me the tax credit right away. After tons of arguing (this took a month before I got the refund–their customer support really blows, but at least they speak English) I got two $50 credits. I sold the AIO for $70 and the iPod for $160.

Leaves me at:

$1060 + $500 - $42 (CC + FC) - $840 (HP + AIO) - $100 (CSR credits) - $70 (MacBook AIO) - $160 (iPod) = $348

My old laptop was a Gateway 4025GZ that I bought a year before in Austin (during IBM Extreme Blue internship) for $350 brand new (another FW deal!). I sold it for $350: $348 - $350 = -$2

After a lot of time investment, I got paid two bucks for using a new laptop for a year and eventually upgrading to the MacBook. Thanks FatWallet!