Tuesday, September 04, 2007

Using 'moto4lin' for interfacing Motorola phones with Linux

I've got a new digital camera! Well kind of, the camera being my Razr phone that I had with me for almost a year now. I've really not used the phone much, granted that I have never been a mobile phone fanatic, besides the reason that I find Motorola's phones lacking in usability compared to a Nokia. Not getting a new phone wasn't an option, given that my old Nokia 8210 did not have support for multi-band frequency, which makes it a problem because of the different frequencies used by the GSM networks in the US.

(Picture taken of the Bay Bridge with the Razr v3i)

While I've only been using my phone predominantly for calls, it was only a while ago that it struck me that I can use the phone-camera to snap pictures and upload them online, provided that I can get to work with my computer. Good news is, there are software available on Linux that allows you to do just that.

('make menuconfig' screenshot for Linux's CDC ACM kernel module)

'moto4lin' is one of them, which allows you to connect to Motorola phones directly from Linux. Before it is able to work, you'll need to have your kernel compiled with 'USB Modem (CDC ACM)' support enabled. It is keyword masked in Gentoo, so you may need to unmask it if you want to use 'emerge' to compile it for you, by adding this line into /etc/portage/package.keywords:
app-mobilephone/moto4lin ~x86
Because of the proprietary nature of phone OSes, it can be hard to figure out what to do in order to make your phone work, so I'll be explicit about mine:
Motorola Razr V3i
Boot Loader 0A.30.
SW Version: R47A_G_08.D8.35R
Initially, I've spent quite a bit of time trying to figure out why my phone doesn't work, and after reading about other people's failures, and quirks, I was almost giving up, until I read the output from the 'dmesg' command:
sd 0:0:0:0: SCSI error: return code = 0x08000002
sda: Current: sense key=0x3
ASC=0x0 ASCQ=0x0
end_request: I/O error, dev sda, sector 101
printk: 246 messages suppressed.
Buffer I/O error on device sda1, logical block 0
It seems like Linux is treating my phone as a USB memory device, and it wasn't able to determine what filesystem it was. That had led me to try to mount the phone as a filesystem, which didn't work.

Finally, I resorted to tinkering on the phone itself to see if there is any settings to stop making the phone act as if it is a memory card. The closest thing I found was the menu item 'Settings->Connectivity->Usb Settings' where the configuration was set as 'Memory Card'. I decided to change it to 'Data/Fax' for testing, even though I wasn't confident it'll work.
usb 4-1: USB disconnect, address 3
usb 4-1: new full speed USB device using uhci_hcd and address 4
usb 4-1: configuration #1 chosen from 2 choices
cdc_acm 4-1:1.0: ttyACM0: USB ACM device
usbcore: registered new driver cdc_acm
drivers/usb/class/cdc-acm.c: v0.25:USB Abstract Control Model driver for USB modems and ISDN adapters
From the output from 'dmesg' again, it indicates that something is different. After which re-running moto4lin works now! After trying a few downloads of the pictures I've taken, I must say that I'm surprised that phone cameras these days have a pretty modest picture fidelity, although the colour depth of the pictures isn't too great. Still, it is nice to be able to pull something out of the pocket to take a snap whenever something interesting happens!

2 comments:

Anonymous said...

thats a pretty good photo for a cell phone.

x said...

Hi Hoto,

Thanks for the comments. Guess I'll be taking more pictures using it in the future then!

Cheers :)

Post a Comment