<?xml version="1.0"?>
<article><artheader><title>Handspring-Visor with Linux mini-HOWTO</title><author><firstname>Ryan</firstname><surname>VanderBijl</surname><affiliation><address format="linespecific">		<email>rvbijl-howto@vanderbijlfamily.com</email>
	    </address></affiliation></author><revhistory><revision><revnumber>v0.6</revnumber><date>January 2003</date><authorinitials>rvbijl</authorinitials><revremark>                Update my contact information.  Remove references to outdated 
                software. Removed PPP stuff.  Updated hotplug section.
	    </revremark></revision><revision><revnumber>v0.5</revnumber><date>December, 2000 - Feb, 2001</date><authorinitials>rvbijl39</authorinitials><revremark>		Seperate kernel/user-space parts. Updates for modules.
		Add usbdevfs info. Hotpluggable info. PPP info.  Updates
		for the linux 2.4 kernel. Added troubleshooting tips.
		Change the SGML to DocBook format.
	    </revremark></revision><revision><revnumber>v0.4</revnumber><date>August 7, 2000</date><authorinitials>rvbijl39</authorinitials><revremark>		Clarifications, updates, suggested by Matt Shook,
		Steven Coffman, Miles Lott, and info from Greg KH. 
	    </revremark></revision><revision><revnumber>v0.3</revnumber><date>April or May, 2000</date><authorinitials>rvbijl39</authorinitials><revremark>		 SGML version. Some fixes from Miles Lott.
	    </revremark></revision><revision><revnumber>v0.1, v0.2</revnumber><date>April 6, 2000</date><authorinitials>rvbijl39</authorinitials><revremark>		 Original Version, HTML version. 
	    </revremark></revision></revhistory><abstract><para>	This document should give you instructions on how to connect
	your Handspring Visor (any version) to Linux, using USB.
	</para></abstract><keywordset><keyword>Linux</keyword><keyword>Handspring</keyword><keyword>Visor</keyword><keyword>USB</keyword><keyword>pilot-link</keyword><keyword>coldsync</keyword></keywordset></artheader><sect1 id="stanrd"><title>Standard Information</title><sect2 id="disclaimer"><title>Disclaimer</title><para>	    No liability for the contents of this documents can be 
	    accepted.  Use the concepts, examples and other content at 
	    your own risk.  As this is a new edition of this document,
	    there may be errors and inaccuracies, that may of course 
	    be damaging to your system.  Proceed with caution, and 
	    although this is highly unlikely, the author(s) do not
	    take any responsibility for that.
	</para></sect2><sect2 id="author"><title>Author</title><para>	    This document was originally written, and is maintained 
            (occasionally) by Ryan VanderBijl.  Many people have
            made good suggestions for the improvement of this
            document. Many thanks to Miles Lott and especially
            to Greg Kroah-Hartman.  Feedback is always welcome,
            although I can't promise if/when any suggestions
            will be incorporrated.
	</para><para>            After being out-of-date for about a year and a half,
            I have finally updated my contact information. Also,
	    very occasionally their may be a new copy of this
            document on my website.  Test your luck at: 
            <ulink url="http://www.vanderbijlfamily.com/~rvbijl/visor/howto/">http://www.vanderbijlfamily.com/~rvbijl/visor/howto/</ulink>.
	</para><para>	    I would appreciate receiving an email from you 
	    if you get your Visor up and Sync'ed using this document.
	</para></sect2><sect2 id="copyright"><title>Copyright</title><para>	    This document is Copyright (c) 2000-2002 by Ryan VanderBijl. 
	    You may distribute freely under the terms of the GPL 
	    (<ulink url="http://www.gnu.org/copyleft/gpl.html">http://www.gnu.org/copyleft/gpl.html</ulink>). 
	</para></sect2></sect1><sect1 id="introduction"><title>Introduction</title><sect2 id="devices"><title>Supported Devices</title><para>            The following list of PDA's are supported by the Linux USB-Visor module:
        </para><itemizedlist><listitem><para>Handspring Visor (all)</para></listitem><listitem><para>Palm USB Devices (all)</para></listitem><listitem><para>Sony Clie (all)</para></listitem></itemizedlist></sect2><sect2 id="needed"><title>What's needed?</title><para>            To syncronize your Handspring Visor onto your linux computer, you
            need to configure linux to know how to do the low-level communication
            with your device, and then a a user-space program to do the actual
            communication with the device.
        </para><para>    </para></sect2><sect2 id="distros"><title>Linux Distributions</title><para>            Many distibutions now come with kernels pre-configured with appropriate 
            support.  If you have such a distro, and do not wish to re-compile the
            kernel, then you can probably skip ahead to the 
            <link linkend="syncsoftware">Syncronziation Software</link> section.
            The following is an incomplete list of distro's that have 
            support pre-configured:
        </para><itemizedlist><listitem><para>Mandrake 8.2 (or later)</para></listitem><listitem><para>Redhat 7.2 (or later)</para></listitem><listitem><para>Suse 8.0 (or later)</para></listitem></itemizedlist><para>            You may check if your distro already has support by running this command
            as root:
        </para><para>	   <screen format="linespecific">modprobe visor</screen>
	</para><para>            If the program printed any error messages, then you will need to
            re-compile the kernel with the approriate support.  If nothing
            was printed, it means that it was successful, and your distro
            already provides support.  
        </para></sect2></sect1><sect1 id="kernel"><title>Configuring the Kernel</title><sect2 id="requirements"><title>Requirements</title><para>	    Some obvious things are required, such as a computer,
	    USB ports, Handspring Visor (with USB cradle).
	    You should also know how to compile and install programs 
	    and the kernel. If you do not, you have a few options:
	    learn, get your resident expert to help you, or get a distro
	    with everything prepared for you. 
	</para><para>	    If you don't have a USB controller for your computer, then 
	    you need to either buy the serial cradle for the Visor
            (but you wont need this document), or buy a USB-capable 
            device for your computer (ie. add-on card or a new 
            motherboard).  
	</para></sect2><sect2 id="kernelversion"><title>Kernel Version</title><para>	    The linux kernel version v2.4 was the first to have USB support.  You can get the latest v2.4 kernel from: 
            <ulink url="ftp://ftp.kernel.org/pub/linux/kernel/v2.4/">ftp://ftp.kernel.org/pub/linux/kernel/v2.4/</ulink>. 
	</para><para>            The USB code has been backported to the v2.2 kernel, starting
            at version v2.2.18.  If you must, you should probably be
            able to follow the same instructions with the latest v2.2 kernel
	</para><para>            Now would be a good time to download the latest kernel, and
            configure things to your desire.  The following has the
            instructions you need to configure USB.
        </para><para>            If you have already have compiled and installed the kernel,
            you should not need to reboot!  All we need to do is
            to compile and install the appropriate modules, and we
            will be all set.
	</para></sect2><sect2 id="controller"><title>USB Controller Type</title><para>	    The first thing to do is o determine which type of USB 
	    host controller you have. The USB host controller is the 
	    hardware in your computer which handles USB input/output.
	</para><para>	    Motherboards based on Intel chipsets, are 
	    typically UHCI controllers. Most addon cards are OHCI
	    controllers. You can determine the type of USB hardware 
	    available by using, as root, the following command:
	</para><para><screen format="linespecific">lspci -v</screen></para><para>	    If you see an entry like:
	</para><para><screen format="linespecific">USB Controller: ......
Flags: .....
I/O ports at ....</screen>
	</para><para>	Then you have a UHCI based controller.  If you see an entry like:
	</para><para><screen format="linespecific">USB Controller: .....
Flags: ....
Memory at .....</screen>
	</para><para>	    Then you have a OHCI based controller.  You could 
	    refer to <ulink url="http://www.linux-usb.org">http://www.linux-usb.org</ulink>
	    for further details. The kernel documentation 
	    <filename moreinfo="none">/usr/src/linux/Documentation/usb/usb.txt</filename> may
	    also be helpful in determining which type of controller 
	    you have.
	</para></sect2><sect2 id="makekernel"><title>Configure/Build Kernel</title><para>	    Now we need to configure, and make your kernel. During 
	    configuration, make sure you enable the following entries.
	    You may either compile them directly into your kernel,
	    or as modules. It is highly recommended that you compile 
            them as modules. If you compile them directly in, you will
	    need to reboot.  
	</para><para>	    <itemizedlist><listitem><para>		       USB support (<emphasis>CONFIG_USB</emphasis>)
		    </para></listitem><listitem><para>		       The preliminary USB Device Filesystem
		       (<emphasis>CONFIG_USB_DEVICEFS</emphasis>)
		</para></listitem><listitem><para>		       The appropriate controller - UHCI, or OHCI 
		       (<emphasis>CONFIG_USB_UHCI</emphasis>, or 
		       <emphasis>CONFIG_USB_OHCI</emphasis>) 
		    </para></listitem><listitem><para>		       USB Serial Converter support 
		       (<emphasis>CONFIG_USB_SERIAL</emphasis>)
		    </para></listitem><listitem><para>			USB Handspring Visor Driver 
			(<emphasis>CONFIG_USB_SERIAL_VISOR</emphasis>)
			(serial converter's sub-option)
		    </para></listitem></itemizedlist>
	</para><para>	    There are two UHCI drivers. You do not want the "UHCI 
	    Alternate (JE)" driver. This driver does not yet support 
	    all the USB features which the Visor uses. Thus, you will be
            unable to sync using this driver.  If you are unable to
            see the original driver, ensure that the UHCI-JE driver
            is NOT selected, you should then see the option for both
            drivers.
	</para><para> 
	    Here, you should decide if you would like to include
            Hotplug support.  With Hotplug support, you are able
            to auto-magically sync your visor by only pressing the 
            Hotsync button.  Please see the 
            <link linkend="hotplug">hotplug section</link>, and
            especially the <link linkend="hpkernel">Hotplug Kernel
            Config</link>, before choosing this route.
	</para><para>	    Compile and install as required. Don't forget to run
	    lilo. If you are installing a new kernel image, do not
	    reboot yet.
	</para></sect2><sect2 id="usbdevfs"><title>usbdevfs</title><para>	    <emphasis>usbdevfs</emphasis> puts information about your 
	    USB bus into the 
	    <filename class="directory" moreinfo="none">/proc</filename> 
	    directory tree. Its a good thing, and can be especially 
	    useful for debugging. You can enable it by adding the 
	    following line into your <filename moreinfo="none">/etc/fstab</filename>.
	</para><para><screen format="linespecific">none  /proc/bus/usb  usbdevfs  defaults  0  0</screen>
	</para><para>	    If you installed a new kernel image, you could reboot
	    from this point on. Remember, if you are just adding the
	    USB info as modules, you do not need to reboot. 
	</para></sect2><sect2 id="deventries"><title>	    Making <filename class="directory" moreinfo="none">/dev</filename> Entries
	</title><para>            If your linux distro does not come with USB Visor support,
            or if you are NOT using <emphasis>devfs</emphasis> (not
            the same thing as <emphasis>usbdevfs</emphasis>), you will need 
            to make the USB tty devices. 
        </para><para>            If you are using <emphasis>devfs</emphasis>, these devices are 
            automagically created under 
            <filename moreinfo="none">/dev/usb/tts/{0,1,...}</filename>; so you can skip 
            ahead to <link linkend="usingmodules">using the modules</link>
	</para><para>            If you are not using <emphasis>devfs</emphasis>, you can create
            the devices by executing these commands, as root: 
	</para><para>            <screen format="linespecific">            mknod /dev/ttyUSB0 c 188 0
            mknod /dev/ttyUSB1 c 188 1
            mknod /dev/ttyUSB2 c 188 2
            mknod /dev/ttyUSB3 c 188 3
            etc...
            chmod 666 /dev/ttyUSB*
            </screen>
	</para><para>	    You are able to have up to 255
	    connections/ports/devices, but unless you have more than 
	    one USB serial device, you'll probably only need the first few.
	    The chmod is to allow users to be able to access the Visor
	    device.  It is the opinion of the author of this document 
	    that this should be safe for a personal computer. Multiuser
	    computers may want to look into the security for this 
	    (please let me know).
	</para><para>	    When a Visor connects, there are two "ports" opened. (For 
	    most people, this will be <filename moreinfo="none">/dev/ttyUSB0</filename>,
	    and <filename moreinfo="none">/dev/ttyUSB1</filename>).  The first port 
	    (zero), is a generic connection. The second 
	    port is the hotsync port. This feature allows for future 
	    developments; for example, to export a filesystem from the 
	    Visor. A useful thing to do is to create a link to the 
	    hotsync port so that synchronization software will use the 
	    appropriate device be default. You can do this by:
	</para><para>            <screen format="linespecific">            cd /dev
            ln -s /dev/ttyUSB1 pilot
            ln -s /dev/ttyUSB1 palm
            </screen>
	</para><para>	    The software package <application moreinfo="none">pilot-xfer</application>
	    uses <filename moreinfo="none">/dev/pilot</filename> by default. 
	    <application moreinfo="none">coldsync</application>
	    defaults to <filename moreinfo="none">/dev/palm</filename>. Create devices 
	    and links as appropriate.  Just for fun, you might also want
	    to create a link from <filename moreinfo="none">/dev/visor</filename> to 
	    <filename moreinfo="none">/dev/ttyUSB1</filename>, just, well, because 
	    we have a visor, not a pilot (or Palm(tm)). The actual 
	    device number may change, depending on how many (active?) 
	    USB-serial devices you have on your system. A message
	    containing the device actually used is entered into syslog.
	    Eventually, the idea is to make an entry in the 
	    <filename class="directory" moreinfo="none">/proc</filename> filesystem 
	    which contains the needed information.  
	</para></sect2><sect2 id="usingmodules"><title>Using the Modules</title><para>	    For people who compiled the USB code as modules, you 
	    will also need to insert the modules into the running 
	    kernel.  When you want to use the visor, you will need to 
            runt the following commands as root:
	</para><para>            <screen format="linespecific">            /sbin/modprobe usb-uhci
            /sbin/modprobe usb-ohci
            /sbin/modprobe visor
            </screen>
	</para><para>	    One important note is that the actually driver/device 
	    connection for <filename moreinfo="none">/dev/ttyUSB*</filename> are not 
	    created in the kernel memory until the hotsync button is 
	    pressed.  Therefore, if you try to use any software before 
	    pressing the hotsync button, it won't work.
	</para></sect2></sect1><sect1 id="syncsoftware"><title>Synchronization Software</title><sect2><title>General</title><para>            There are two software packages which communicate with your
            Visor.  The first is <application moreinfo="none">coldsync</application>,
            and the second is <application moreinfo="none">pilot-link</application>.
            These programs are command-line based, and do "low-level" 
            synchronization of the actual databases.  They provide 
            [different] interfaces for conduits.  I assume you know 
            how to download and install programs yourself.  
            If not, learn. (I suppose you could cheat and install a 
            pre-compiled package, but I don't support that ;-).
	</para></sect2><sect2 id="coldsync"><title>coldsync</title><para>	    <application moreinfo="none">coldsync</application> can be found at 
	    <ulink url="http://coldsync.org/">http://coldsync.org/</ulink>.
	</para></sect2><sect2 id="pilotlink"><title>pilot-link</title><para>	    <application moreinfo="none">pilot-link</application> can be found at
            <ulink url="http://www.pilot-link.org/">http://www.pilot-link.org/</ulink>.
            If you plan on using a Palm Desktop Equivalant, you'll want to use
            this package.
	</para></sect2><sect2 id="testing"><title>Time to Sync</title><para>	    At this point we should be able to test to make sure things
	    are working.  Of course, the visor needs to be in the 
	    cradle, and the cradle needs to be plugged into your USB 
	    port. The proper modules should be 
	    <link linkend="usingmodules">loaded</link>.
	</para><para>	    NOTE: you MUST press the hotsync button BEFORE 
	    running the software.  The visor driver will make an entry
	    in syslog, and, eventually (ie, in newer drivers), to 
	    <filename moreinfo="none">/proc/drivers/visor</filename>.  Assuming the 
	    driver connects to <filename moreinfo="none">/dev/ttyUSB0</filename> and 
	    <filename moreinfo="none">/dev/ttyUSB1</filename>, you may run your program
	    to backup the visor (chose the appropriate program):
	</para><para><screen format="linespecific">cd ~
mkdir visorbackup
coldsync   -p /dev/ttyUSB1 -mb visorbackup 
pilot-xfer -p /dev/ttyUSB1 -b  visorbackup </screen>
	</para><para>	    If you get an error such as "unable to bind to the port", 
	    you probably need to re-read the previous paragraph.
            With any other errors, please refer to the
            <link linkend="troubleshooting">Troubleshooting Guide</link>.
	</para></sect2><sect2><title>Palm Desktop Equivalents</title><para>	    There are a few Palm desktop equivalents. I haven't had
	    time to test them. I intend, at some
	    point, to put something about them in here. If you want
	    to write up something to have it included here, please
	    feel free to send it in. To my knowledge, all of them use
	    the pilot-link libraries to talk with the Visor.
	</para><para>	    Here is the list that I know of:
	    <itemizedlist><listitem><para><ulink url="http://www.jpilot.org/">J-Pilot</ulink></para></listitem><listitem><para><ulink url="http://www.slac.com/pilone/kpilot_home/">KPilot</ulink> (KDE)</para></listitem><listitem><para><ulink url="http://www.gnome.org/gnome-pilot/">Gnome-Pilot</ulink> (GNOME)</para></listitem></itemizedlist>
	</para></sect2><sect2><title>Your Done!</title><para>	    At this point, you are done! You are able to install,
	    backup, and syncronize your information. Congratulations!
	    I would appreciate an email of gratitutde!  The next 
            sections talk about setting up a PPP connection
	    and Hotplug support. 
	</para></sect2></sect1><sect1 id="hotplug"><title>Hotplug-able</title><para>        You must be using a fairly recent v2.4 kernel for this.  
	You may wish to read over the whole section before proceeding.
    </para><para>        Hotplug will allow you to automatically run your syncronization
        software when you press your sync button.  You will only be
        able to configure this to sync for one Visor. If you need
        to be able to sync multiple users with differen Visors, you
        can't. (With different Palm's and Clie's, is a separate 
        question, to which I don't know the answer to).
    </para><sect2 id="hpkernel"><title>Hotplug Kernel Config</title><para>	    You will need to enable "Support for hot-pluggable devices"
	    under "General Options" in the kernel config. This is
	    the kernel option <emphasis>CONFIG_HOTPLUG</emphasis>.
            Make sure you compile/re-install.
	</para></sect2><sect2 id="hpinstallbase"><title>Installing Hotplug</title><para>	    You need to get the hotplug scripts from the linux-hotplug
            homepage: <ulink url="http://linux-hotplug.sourceforge.net">http://linux-hotplug.sourceforge.net</ulink>.
            The scripts are available as a rpm package or tarball If 
            installing the tarball package, please read the README 
            file that is included on proper installation procedures.
            If all you are configuring is the Visor hotplug support,
            then most likely you'll just have to do this:
	</para><para>            <screen format="linespecific">            gzip -dc hotplug-2002_08_26.tar.gz | tar xvf -
            cp hotplug-2002_08_26/sbin/hotplug /sbin/hotplug
            cp -r hotplug-2002_08_26/etc/hotplug  /etc
            </screen>
        </para></sect2><sect2 id="hpinstallvisor"><title>Configure the Visor Driver</title><para>            When all is said and done, an (executable) script named
            <filename moreinfo="none">/etc/hotplug/usb/visor</filename> should
            get run when you press the hotsync button.
	</para><para>	    <screen format="linespecific">		#!/bin/sh
		/bin/su rvbijl -c /usr/local/bin/coldsync
	    </screen>
	</para><para>	    Obviously, you would want to replace the 
	    <emphasis>rvbijl39</emphasis> with your normal user account.
	    And make that script executable. 
	</para></sect2></sect1><sect1 id="troubleshooting"><title>Troubleshooting Tips</title><sect2 id="thetips"><title>The Tips</title><para>	<itemizedlist><listitem><para>		    There is a known bug about the Visor that sometimes
		    you need to reset the Visor before it is able to
		    sync properly.  This is the number one solution for 
                    most people having problems syncing.  If a soft 
		    reset does not work, and other USB devices work on 
		    this machine on Linux, a hard reset has been known 
		    to solve the problem. (Try some of the other 
                    suggestions before doing a hard reset).
		</para></listitem><listitem><para>Did you install the new kernel/modules?</para></listitem><listitem><para>		    Make sure that all the modules are running. The
		    command is <emphasis>lsmod</emphasis> and there
		    should be, at least, these modules: visor,
		    usbserial, usbcore; and one of the following:
                    usb-uhci or usb-ohci.
		</para></listitem><listitem><para>If you installed a new kernel, did you reboot?</para></listitem><listitem><para>		    Is the USB hardware enabled on your computer?
		    (Check your BIOS. Does it work in other operating
		    systems?)
		</para></listitem><listitem><para>		    Are things (ie "usb-serial") appearing in
		    <filename moreinfo="none">/proc/devices</filename>? In 
		    <filename moreinfo="none">/proc/bus/usb/devices</filename>? If not,
		    then the drivers aren't being loaded properly. 
	        </para></listitem><listitem><para>                    Is there any information being entered in syslog
                    when you press the hotsync button?
	        </para></listitem><listitem><para>		    Did you really remember to press the hotsync button
		    BEFORE running your synchronization script?
		</para></listitem><listitem><para> Email <email>usbvisor-unix@lists.sourceforge.net</email>.  </para></listitem></itemizedlist>
	</para></sect2></sect1><sect1 id="references"><title>Links</title><para>	You may find useful information at the following webpages.  
        Some provided the information included in this document.
    </para><para>	<itemizedlist><listitem><para>		   ColdSync: <ulink url="http://coldsync.org">http://coldsync.org</ulink> 
		</para></listitem><listitem><para>		   Pilot-link: <ulink url="http://www.pilot-link.org/">http://www.pilot-link.org/</ulink>
		</para></listitem><listitem><para>		   PalmOS HOWTO: <ulink url="http://www.orbits.com/Palm/">http://www.orbits.com/Palm/</ulink>
		</para></listitem><listitem><para>		   Linux Kernel: <ulink url="ftp.kernel.org/pub/linux/kernel/">ftp.kernel.org/pub/linux/kernel/</ulink>
		</para></listitem><listitem><para>		   USB Visor page: <ulink url="http://usbvisor.sourceforge.net">http://usbvisor.sourceforge.net</ulink>
		</para></listitem><listitem><para>		    Hotplug info: <ulink url="http://linux-hotplug.sourceforge.net/">http://linux-hotplug.sourceforge.net/</ulink>.
		</para></listitem><listitem><para>		   Documentation to figure out type type of controller 
		   was leached from the kernel documentation, 
		   Documentation/usb/scanner.txt.
		</para></listitem></itemizedlist>
    </para></sect1></article>

