# Syncing a Palm Pilot with Gentoo+jpilot or similar [Solved]

## gentsquash

Using: Gentoo 2.6.8.1	and	jpilot-0.99.6-r1

I am a new Gentoo user, although not new to Unix, and

trying to make the jump to being a sysadmin (of a

one-user system).  I did not install the system --a

friend installed it for me, and I am finding the

transition to sysadmin rather steep.

I have a Palm Pilot M130 and am trying to sync it;

currently, by means of the `jpilot' program (but any

program is fine; I happen to use KDE although I have

Gnome installed).

So far, I cannot get `jpilot' to find the device; I don't

know what to symlink /dev/pilot to.

I have read, but don't fully understand:

A: http://www.gentoo.org/doc/en/gentoo-pda.xml?style=printable

B: The Gentoo handbook.

1: The program `usbview' shows "Palm handheld" when I

press the hotsync button, so Gentoo is detecting the Palm

at some level.

2: The /dev/ directory has no filename with the letters

"usb" in it.  Turning-on the printer ephemerally creates

dir+file "/dev/usb/lp0"; it disappears when I turn the

printer off.

  No other devices ever appear in "/dev/usb/", even

though `usbview' shows both the Palm and my usb-mouse.

3: I found a message thread (which I subsequently lost)

of someone with a similar problem.  The folks trying to

help asked questions that I do not know how to answer

about my own system:

  One was "devfs or udev?"; how do I tell?

  Another was whether some kind of option (support?) was

"compiled into the kernel" --how do I tell?

I'm happy to be pointed to a solution that is already

posted on some Gentoo forum (or elsewhere), but I'll need

help if the soln requires changing config files,

installing modules or (shudder) "recompiling the kernel".

	Sincerely, -Prof. JLF King

----------

## adsmith

First, don;'t be afraid of recompiling the kernel.  It's really no harder than installing anything else.

Okay, now to your question:

If you didn't do anything special, you're probably running devfs.  type 

```
/sbin/devfsd
```

 to see if the command is there (indicating that devfs is installed)

```

abe@tock ~ $ /sbin/devfsd

Usage:  devfsd mntpnt [-v] [-d] [-t num] [-D mask] [-fg] [-np]

```

Supposing this works, then there are a couple things you need to do:  

0) make sure the visor module is on your system.  type  

```
locate visor.o
```

 you should get something in your modules directory.  If it's there, then type 

```
/sbin/lsmod | grep visor
```

to see if the module is loaded.    

Furthermore, if no tty parts are listed in /dev/usb, then you may not have the usbserial module loaded. try loading it. /sbin/insmod usbserial

1) make sure the visor module is loaded automatically when the palm is trying to sync; and 

2) make sure users can access the palm device.

For each of these:

0) if visor.o is not found on your system, you'll have to compile it  in the kernel (as a module).  We'll deal with that when you get there.

1) this is managed by hotplug.  So cd /etc/hotplug, then type grep visor *   You should see  a line in /etc/hotplug/usb.distmap containing "visor" and a bunch of hex numbers.

2) this is managed by devfsd.

Check /etc/devfsd.conf for the lines 

```

REGISTER        ^usb            PERMISSIONS     0.0     0777

REGISTER        ^usb/tts        PERMISSIONS     0.0     0777

```

----------

## gentsquash

Dear adsmith	

Thank you for your quick, cogent reply.  

[Aside: I wasn't sure how to reply to it via a browser, so I pasted

your reply into an Emacs+RMAIL buffer and composed a reply there.

Does GentooForum have a mechanism to email me postings on a thread

that I initiated?]

>   PostPosted: Fri 05Nov2004 18:03    Post subject:

>   First, don;'t be afraid of recompiling the kernel. It's really no

>   harder than installing anything else.

I hope one keeps one's current kernel intact as fall-backable whilst

making the new one...

>   Okay, now to your question:

>    If you didn't do anything special, you're probably running

>   devfs. type Code: /sbin/devfsd to see if the command is there

>   (indicating that devfs is installed)

Is present: 

# /sbin/devfsd

Usage:	devfsd mntpnt [-v] [-d] [-t num] [-D mask] [-fg] [-np]

>   ...Supposing this works, then there are a couple things you need to do:

>

>   0) make sure the visor module is on your system. 

>

>   type  Code: locate visor.o

Alas, it is not present.  `locate visor' produces

 /-------------------------------------------------------------\

/usr/src/linux-2.6.9/drivers/usb/serial/visor.c

/usr/src/linux-2.6.9/drivers/usb/serial/visor.h

/usr/src/linux-2.6.8.1/drivers/usb/serial/visor.c

/usr/src/linux-2.6.8.1/drivers/usb/serial/visor.h

/usr/share/icons/hicolor/48x48/apps/visor.png

 \

----------

## adsmith

Okay, so it seems you need to compile usbserial and visor support into the kernel (as a module).

You are correct -- there is no need to blast your old kernel -- indeed, it's a very bad idea!  

It's probably best to reference one of the many kernel HOWTO's around like in Gentoo's online documentation.

Important questions:

You made your current kernel with genkernel?

Do you have a 2.4 (gentoo-sources) or 2.6 (gentoo-dev-sources) kernel? 

Basically, the process is this:

cd /usr/src/linux

make xconfig if in X, or make menuconfig if in console

this brings up the kernel config editor.  Set the options you want.  These save as a .config file, which just lists all the options you want.  Hopefully, genkernel made for you such a file last time, so you can load it and just change what you want.

then (assuming 2.6 kernel -- there's one more command for 2.4 kernel) do

make && make modules

which compiles the kernel to a zipped file, and installed the modules in /usr/lib/modules/<version>

then, copy the kernel file to /boot, add an appropriate line to grub.conf, and reboot.  If it fails to boot properly or something breaks when you try to use it, just reboot to your old kernel and try again.

----------

## gentsquash

Thanks again for a quick reply.

> Okay, so it seems you need to compile usbserial and visor

> support into the kernel (as a module).

Am I correct, alternative to compiling a module into the

kernel, that it can be made dynamically loaded upon-demand?  If

yes, what is appropriate for modules "usbserial" and "visor"

--and how could I have figured that out myself?

> ...It's probably best to reference one of the many kernel HOWTO's

> around like in Gentoo's online documentation.

Roger, I'll furrow.

> Important questions: You made your current kernel with

> genkernel?  Do you have a 2.4 (gentoo-sources) or 2.6

> (gentoo-dev-sources) kernel?

I didn't do the install (and don't understand your

"gentoo-sources" reference); however, "/boot/" shows

```

/boot:

  drwxr-xr-x  2 root     632 Oct 26 00:35 grub

  -rw-r--r--  1 root 1819344 Sep 26 10:22 vmlinuz-2.6.8.1

  lrwxrwxrwx  1 root       1 Sep 23 15:26 boot -> .

  -rw-r--r--  1 root       0 Jul 11 15:07 .keep
```

so I'm sure that 2.6 is it.  

> Basically, the process is this:

> 

> cd /usr/src/linux

> 

> make xconfig if in X, or make menuconfig if in console this

> brings up the kernel config editor. Set the options you

> want. These save as a .config file, which just lists all the

> options you want. Hopefully, genkernel

Alas, I don't know what "genkernel" is.  I had intended to be

present as an observer while a friend (and former student)

installed Gentoo.  However, this was when one of the hurricanes

hit Florida, his home lost power, and I ended up leaving my

machine there for over a week, during which he did the work.

> made for you such a file

> last time, so you can load it and just change what you want.

> 

> then (assuming 2.6 kernel -- there's one more command for 2.4

> kernel) do

> 

> make && make modules

> 

> which compiles the kernel to a zipped file, and installed the

> modules in /usr/lib/modules/<version>

Hmmm.  I don't find a "/usr/lib/modules/" but I do have these

directories

```

/usr/X11R6/lib/modules

/lib/modules/2.6.8.1/
```

> then, copy the kernel file to /boot, add an appropriate line to   

> grub.conf, 

Is this correct?: I name the new kernel, say, "vmlinuz-2.6.8.1-withvisor".

Then in "grub.conf" I copy the stanza and create a second stanza

```

title  Gentoo Linux (2.6.8.1) with visor and usbserial

   root (hd0,1)

   kernel (hd0,1)/boot/vmlinuz-2.6.8.1-withvisor root=/dev/hda3

```

with no other changes to "grub.conf", yes?

> and reboot. If it fails to boot properly or something

> breaks when you try to use it, just reboot to your old kernel

> and try again.

I thank you for you detailed and prompt advice  --a nice comment

on the Gentoo community.   Thanks again.

----------

## adsmith

 *gentsquash wrote:*   

> Thanks again for a quick reply.
> 
> > Okay, so it seems you need to compile usbserial and visor
> 
> > support into the kernel (as a module).
> ...

 

You have two options for most things:

1) compile into the kernel binary itself

2) compile as a module which can be dynamically loaded.

Generally, it's best to have non-essential stuff as modules, so the kernel remains small when certain components aren't being used.

As for usbserial and visor, if you google a bit for "palm pilot linux" and so forth, you can find some overviews of the setup process for a generic linux setup (not gentoo specific), and they will mention all the kernel options you ultimately need.   In general how to "know" what modules and kernel options are necessary for extra hardware is always just a matter of googling or checking the Linux Hardware HOWTO at the linux documentation project at www.tldp.org.

Since you're compiling a kernel anyway, you might as well build the drivers (as modules) for anything you might concievable buy or use on this machine in, say, the next 6 months or year.  Afterall, the extra modules will probably only take an extra couple megabytes on the hard drive.

To start out with your current config, load the config file.

look in /usr/src/linux for a .config, in /boot for one matching your kernel version, or in /proc/config if your friend built in live config file support.

 *Quote:*   

> 
> 
> I didn't do the install (and don't understand your
> 
> "gentoo-sources" reference); however, "/boot/" shows
> ...

 

gentoo-sources and gentoo-dev-sources are the portage ebuilds which provide the kernel source code.  ...-dev-... is the 2.6 branch.  

 *Quote:*   

> 
> 
> Alas, I don't know what "genkernel" is.  I had intended to be
> 
> present as an observer while a friend (and former student)
> ...

 

genkernel is gentoo automatic kernel maker, as opposed to doing the config editing and compiling "by hand".   I personally don't like genkernel, since it has never quite worked right for me, and compiling a kernel is really quite easy.

 *Quote:*   

> 
> 
> Hmmm.  I don't find a "/usr/lib/modules/" but I do have these
> 
> directories
> ...

 

whoops... /lib/modules/

sorry

 *Quote:*   

> 
> 
> Is this correct?: I name the new kernel, say, "vmlinuz-2.6.8.1-withvisor".
> 
> Then in "grub.conf" I copy the stanza and create a second stanza
> ...

 

something like that, yes.  exactly what setting you apply w.r.t. the devices are highly dependent on your hard disk and partition setup.

----------

## gentsquash

By the way, after the recompiling and such...

what will I symlink 

```
   /dev/pilot  
```

to?

----------

## adsmith

in my case, it's /dev/usb/tts/1

----------

## gentsquash

To avoid pestering you all day, I'm trying to contact one of my two

Gentoo-savvy friends, to "talk me through" a recompile.  (Neither, to 

my knowledge, syncs a PDA with Gentoo.)   I do have three questions:

1: Where do I obtain the most recent versions of "visor.c" and 

"usbserial.c"?  (The latter is not on my system at all.) `emerge -s'

finds neither..

2: How do I arrange that they are loaded on-demand? --that is,

pressing <hotsync> causes the "visor.o" module to be loaded?

3: You wronte that your PDA port is

 *adsImith wrote:*   

> in my case, it's /dev/usb/tts/1

 

At what point in the recompile process will I discover if

"/dev/usb/tts/1" is what I need to use?

----------

## adsmith

 *Quote:*   

> 
> 
> 1: Where do I obtain the most recent versions of "visor.c" and 
> 
> "usbserial.c"?  (The latter is not on my system at all.) `emerge -s'
> ...

 

It doesn't work that way.  Everything is in the kernel sources.  /usr/src/linux/ (which is a link to /usr/src/linux-version).

You can pull a new version of the sources with emerge gentoo-dev-sources (you'll probably need to set ~x86 for it in /etc/portage/package.keywords)

 *Quote:*   

> 
> 
> 2: How do I arrange that they are loaded on-demand? --that is,
> 
> pressing <hotsync> causes the "visor.o" module to be loaded?
> ...

 

if there's a visor line in /etc/hotplug/usb.distmap, you're all set.

 *Quote:*   

> 
> 
> At what point in the recompile process will I discover if
> 
> "/dev/usb/tts/1" is what I need to use?
> ...

 

after you compile, reboot into the new kernel, and do modprobe usbserial, the /dev/usb/tts directory should exist.  When you hit the sync button on the palm, it should (hopefully) load the visor module automatically, and then you should have like /dev/usb/tts/0 and /dev/usb/tts/1.  It's helpful to be watching your system logs realt-time with tail -f /var/log/messages (or whatever your main system log file is)

As to which of .../0 and .../1  to use, I think it depends on your palm.  Just try both.  it's .../1 for most, I think

Enjoy!

----------

## gentsquash

Thank you.  I'll post a summary of what I find out after the re-compile.

 *adsmith wrote:*   

>  *Quote:*   
> 
> 1: Where do I obtain the most recent versions of "visor.c" and 
> 
> "usbserial.c"?  (The latter is not on my system at all.) `emerge -s'
> ...

 

Searching there, I found  "usb-serial.c", so my system does have the source code, just under a different name.

(Ok, now for the brain transplant.   Let's see; scapel, sutures, clamp...)

----------

## gentsquash

The following is a composite of what I learned from

adsmith (thank you),

from a friend who installed my Gentoo system, and from my experiments

as a Gentoo beginner.  It is not a HOWTO, but simply a transcript 

of what worked for me.

================

1: Did `ps auxww | grep dev' and searched for "udevd" or

"devfsd"; I found the former, so I presume that

my system uses `udev' for its

dynamic device allocation.

2: Compiled the kernel to have modules `visor' (`visor.c') and `usbserial'

(`usb-serial.c'), guessing what these were called in `make menuconfig'.

  Did `lsmod | grep visor' and saw nothing.  Did `modprobe visor'.  Now

`lsmod | grep visor' showed both the visor and usbserial modules:

```

visor      15888  0

usbserial  22432 1 visor

usbcore    99684 8 visor,usbserial,usblp,ehci_hcd,usbhid,uhci_hcd   
```

3: Ran `tail -f /var/log/messages',

then  pushed physical <<hotsync>> and saw "Palm

OS converter now attached to ttyUSB0 ... ttyUSB1".  Searched in `/dev/'

and did not find these.  Searched in `/dev/tts/' and saw ephemeral

```

    crw-rw----  1 root   usb 188,  0 Nov  8 21:04 USB0

    crw-rw----  1 root   usb 188,  1 Nov  8 21:04 USB1
```

`USB0' turned out to be the Palm (probably `USB1' is the cradle).  In

`/dev/', symlinked *both* [pilot,jpilot -> tts/USB0], since the docs

for  `kpilot', `jpilot', `jpilot-sync' and friends refer to both of these.

4: Put, into group "usb", the users that I want to be able to

sync.  Discovered "usb" from the `ls' above.  Can also follow the

trail of `/etc/udev/udev.conf' to `/etc/udev/permissions.d/' to

its file `50-udev.permissions'.  This latter has a line

```

tts/USB[0-9]*:root:usb:

```

which shows that when tts/USB0 is created, it will have owner

"root" and be in group "usb".

ASIDE: When I first recompiled the kernel, I did not have

X-windows working.  So in probing for the correct device-name

that `jpilot' (a graphical prgm) could use to access the Palm, it

was convenient to have the cmd-line version `jpilot-sync'.  I

experimented with

```

    jpilot-sync -b -p /dev/tts/USB0

    jpilot-sync -b -p /dev/tts/USB1

```

(having pushed <<hotsync>>) to see which device would sync.  On

my system it was "/dev/tts/USB0".

----------

