# Gnokii Tips

*Posted 2007-05-22, updated 2021-07-01.*

I own a Nokia 6102i phone (provided by Cingular). [gnokii](http://gnokii.org) is a Linux program that lets me interface with the phone. Here are some recipes:

## File I/O

`gnokii --getfilelist "A:\\predefgallery\\predeftones\\predefringtones\\*"`

`gnokii --putfile WiiSports.mp3 "A:\\predefgallery\\predeftones\\predefringtones\\WiiSports.mp3"`

## Ring Tones

Voice mail picks up in 20 seconds, so a ring tone should be about 20 seconds long.

The easiest way to chop an MP3 in Linux is with dd; the drawback is that you need to specify length in KB, not time. To chop an MP3 to be 200 KB long, do:

`dd if=Mii\ Channel.mp3 of=MiiChan2.mp3 bs=1k count=200`

## Phonebook

To make a Phonebook.ldif file from the phone (suitable for import into Thunderbird):

`gnokii --getphonebook ME 1 end --ldif > Phonebook.ldif`

To add the entries in Phonebook.ldif to the phone:

`cat Phonebook.ldif | gnokii --writephonebook -m ME --find-free --ldif`

You can specify `--overwrite` instead of `--find-free` if you want to overwrite all the entries, but this will lose some data (e.g. speed dial, preferred numbers).

## Multimedia

You can get photos like this:
`gnokii --getfile "A:\\predefgallery\\predefphotos\\Image000.jpg"`
They are 640x480 JPG files. (You can also configure the camera so that it takes pictures at 80x96.)

You can also store files:
`gnokii --putfile silly.jpg "A:\\predefgallery\\predefphotos\\silly.jpg"`
These show up on the phone in `My Stuff/Images`. The files don't need to be any specific size; they are autoscaled. GIFs probably also work.

Videos live here:
`gnokii --getfile "A:\\predefgallery\\predefvideos\\Video000.3gp"`
VLC seems to be able to play `.3gp` files, but the audio doesn't work.

Audio recordings live here:
`gnokii --getfile "A:\\predefgallery\\predefrecordings\\Audio000.amr"`

Unfortunately, nothing I knew of in 2007 (when this page was first written) would play `.amr` files, but these days (2021) perhaps `ffmpeg input.amr output.mp3` would work. You might have to use the `-ar` flag to specify the audio rate. I haven't actually tried this though!

