On Mon, 3 Jan 2005 18:14, John Layt wrote:
>
> Making some progress on LinuxQuestions there's this page:
> http://www.linuxquestions.org/hcl/showproduct.php?product=560
> which points to
> http://digikam.free.fr/hotplug/howto.html
> but it appears a little outdated in places.  I'll see what I can learn from
> the scripts provided and follow up later.
>
> john.

Eureka!  Got it!  Between those links, and actually installing GTkam to see 
what files it played with, I've figured out the secret to Mandrakes 
hot-plugging :-)

I'll write it up in full later as a step-by-step process once I have it down 
pat (yes Anne, and add it to the TWiki :-), but for now here's a high-level 
description of how stuff is linked in together from one script to the next to 
the next to the next...

You plug in the usb camera/scanner/whatever, the kernel doesn't recognise it 
as something it has a kernel module for, so passes it on to Hotplug to figure 
out what to do.  Hotplug gets the device details from the device, which 
includes the device id number and the device class, which is 'camera' for a 
camera, 'scanner' for a scanner, etc.  

Next hotplug looks up the device id in the file /etc/hotplg/usb.usermap to see 
if it's something it knows what to do with.  In the case of cameras, 
libgphoto2 has added to the usermap all the cameras that it supports, and 
tells hotplug to run the script /etc/hotplug/usb/usbcam.  Scanners are added 
to the usermap by libsane and points to the 
script /etc/hotplug/usb/libusbscanner and so on.  When these scripts are run, 
they do whatever initialisation is required, such as creating the usb device 
file (/dev/usb/whatever) and setting the required permissions on it, or 
downloading a required firmware to the device.

Mandrake has added Mandrake specific parts to the camera initialisation file 
to perform the autorun stuff by calling the 
script /etc/dynamic/scripts/camera.script and passing it the device file to 
use.  The scanner scripts libusbscanner and scanner.script are provided by 
libsane and as standard call the autorun stuff.  These files do more 
distribution specific setup work before calling yet another script, depending 
on the device class and the currently running desktop, to launch the required 
program (no, not there yet!).  

These scripts are kept in folders aclled /dynamic/launchers/device_class, such 
as /dynamic/launchers/camera or /dynamic/launchers/scanner.  In each of these 
folders are files kde.desktop and gnome.desktop which are .desktop files 
describing which program to autorun under that particular desktop.  In the 
case of Mandrake, these are actually symbolic links to the /etc/alternatives 
directory, which is the standard location for defining default applications 
such as your default browser.  For cameras, kde.desktop points 
to /etc/alternatives/camera.kde.dynamic, likewise for gnome. But it doesn't 
end there, camera.kde.dynamic is also a symbolic link back 
to /etc/launchers/camera/gtkam.desktop!  Finally, we've reached the actual 
file that runs gtkam!

So, in short for a digital camera:
1) Plug in camera
2) Look camera up in /etc/hotplg/usb.usermap
3) Run init script /etc/hotplug/usb/usbcam to create /dev/usb entry and call 4
4) Run /etc/dynamic/scripts/camera.script with the /dev/usb entry and call 5
5) If under KDE, run /dynamic/launchers/camera/kde.desktop which points to 6
6) Run /etc/alternatives/camera.kde.dynamic which points to 7
7) Run /etc/launchers/camera/gtkam.desktop

So the quick hack will be to edit /etc/launchers/camera/gtkam.desktop to 
actually call kaffeine instead of gtkam :-)  Unfortunately, I've loaned my 
digital camera to my brother for his honeymoon, so I can't confirm it works, 
but if you care to try, as root edit the file so the contents appear as 
follows:

  [Desktop Entry]
  Name=digikam
  Comment=Digital Camera Program
  TryExec=/usr/bin/digikam
  Exec=/usr/bin/digikam
  Terminal=false
  Icon=digikam.png
  Type=Application

Let me know if this works for now.

The proper course will be to uninstall gtkam, 
create /etc/launchers/camera/digikam.desktop, and create the other required 
symbolic links.  I'll experiment and detail that later.

John.

-----------------------------------------------------------------------------
Forget that new hard drive, save some lives instead, donate to the Red Cross:
  USA:  https://www.redcross.org/donate/donation-form.asp
  UK:  https://www.donate.bt.com/bt_form_dec.htm
  Oz:  https://www.redcross.org.au/Donations/onlineTsunamiDonations.asp
  NZ:  https://www.banqonit.com/proxypage.aspx?boiid=205

____________________________________________________
Want to buy your Pack or Services from MandrakeSoft? 
Go to http://www.mandrakestore.com
Join the Club : http://www.mandrakeclub.com
____________________________________________________

Reply via email to