Re: Please explain how hotplug works in lay terms.

From: Keith Keller (kkeller-usenet_at_wombat.san-francisco.ca.us)
Date: 02/07/05


Date: Sun, 6 Feb 2005 20:03:37 -0800

On 2005-02-06, Al. C <no.spam.acanton@take.out.adams-blake.no.spam.com> wrote:
> I run Slackware 9.1 with KDE.
>
> I have a cheapo Palm pilot and use Jpilot for it. Works fine. But I don't
> understand HOW. No matter which USB port I plug it into it works. The key is
> the link:
> /dev/pilot -> /dev/ttyUSB1
>
> Can someone explain in lay terms what is going on here?
>
> I read some of:
> http://linux-hotplug.sourceforge.net/?selected=overview
>
> but it's pretty technical. I'm just trying to figure out how the kernel knows
> that no matter what USB slot I plug in my Palm, it lets Jpilot find it.

The physical slot you use does not matter. When a device is plugged
into a USB port, if appropriate a device is created. In your case,
your Palm is possibly the second tty device you plugged in, so it gets
ttyUSB1. (The first tty USB device is generally ttyUSB0.)

This also depends on whether you are using old-style /dev (which IIRC
Slackware 9.1 uses), devfs, or udev.

> Second question.
>
> Given this entry in /etc/fstab
> /dev/sda1 /mnt/sony vfat user,noauto
>
> If I plug in my camera I can open it with /mnt/sony via a KDE desktop icon.
>
> Say I had a second camera or a printer or whater and I plug it into a second
> slot, it becomes sda2, right?

A camera might, since it'd probably be accessed by the USB mass storage
driver. A printer probably would not, unless it too has some sort of
storage mechanism. More likely it'd become a ttyUSB* device. (A camera
or other disk drive is a block device, whereas a printer or palm cradle
is a character device, which is the primary difference.)

> I'd have to have an entry in fstab for that as
> well, correct? What happens when I unplug the first device. Does sda2 become
> sda1?

No, but if you unplug both cameras, then the next camera you plug in may
become sda1, just as if you unplug your printer and palm, the next one
you plug in may become ttyUSB0. (Or ttyUSB1, if you have another
character device still plugged in.)

> I'm looking at buying a USB printer and don't understand which of the 4 USBs I
> should plug it into (or does it matter?), and what to put in fstab if
> anything.

For a printer you would not modify fstab, but beyond that I can't help
too much, since I have never used a USB printer. But I just did a quick
google.com/linux search, and a few links down is a link to an article by
AEleen Frisch, who notes that a USB printer will normally become
/dev/usblp0. So that's probably a good starting point for you.

--keith

-- 
kkeller-usenet@wombat.san-francisco.ca.us
(try just my userid to email me)
AOLSFAQ=http://wombat.san-francisco.ca.us/cgi-bin/fom
see X- headers for PGP signature information


Relevant Pages

  • Re: Getting fuji to work as webcam
    ... >>> If you put it in webcam mode what does your machine detect when you plug ... >>> of usb video capture chipsets supported by linux, ... I can set the camera to turn on in Mass ...
    (Fedora)
  • Kernel Panic on removing usb storage
    ... Every time I remove a USB storage device (camera, mp3 player, hd etc) I get ... a Kernel Panic and have to plug out the power to reboot my computer. ...
    (comp.os.linux.misc)
  • Re: USB cable
    ... When I plug my mp3 or camera cable into the usb socket it freezes my ... Plug in the USB camera. ...
    (microsoft.public.windowsxp.music)
  • Re: [kde] Cant transfer pics from camera to PC anymore
    ... # USB connection line is O.K. Got new. ... Plug in camera does not come up on monitor. ... I don't use the camera, I use a USB reader, or a USB/SD card, but I ...
    (KDE)
  • Re: usb malfunctioned!pic cant be loaded.
    ... > Mary Sauer MSFT MVP ... >> i just need to plug in to the usb port and then the pic will automatically be ... >> diff in loading the pic.my pc cant detect my camera. ...
    (microsoft.public.windowsxp.photos)