HAL stands for Hardware Abstraction Layer, a piece of software which provides a view of the various pieces of hardware attached to a system. In addition to this, HAL also keeps detailed metadata for each piece of hardware and provides hooks so that system and desktop-level software can react to changes in the hardware configuration in order to maintain system policy.
The most important goal of HAL is to provide plug-and-play facilities for
UNIX-like desktops, with focus on providing a rich and extensible description
of device characteristics and features. One example of the functionality
provided by HAL is when you plug in a USB storage device. HAL can automatically
create an appropriate entry in the
Before emerging the needed programs you should check that
# tail -n 18 /var/log/messages scsi4 : SCSI emulation for USB Mass Storage devices usb-storage: device found at 4 usb-storage: waiting for device to settle before scanning Vendor: PEAK II Model: Flash Drive Rev: 3000 Type: Direct-Access ANSI SCSI revision: 00 SCSI device sdc: 503808 512-byte hdwr sectors (258 MB) sdc: Write Protect is off sdc: Mode Sense: 43 00 00 00 sdc: assuming drive cache: write through SCSI device sdc: 503808 512-byte hdwr sectors (258 MB) sdc: Write Protect is off sdc: Mode Sense: 43 00 00 00 sdc: assuming drive cache: write through sdc: sdc1 sd 4:0:0:0: Attached scsi removable disk sdc sd 4:0:0:0: Attached scsi generic sg2 type 0 usb-storage: device scan complete scsi.agent[30478]: disk at /devices/pci0000:00/0000:00:0b.2/usb1/1-5/1-5:1.0/host4/target4:0:0/4:0:0:0
As well as checking that
KOBJECT_UEVENT=y CONFIG_HOTPLUG=y
Before emerging any packages, you will need to enable the
# euse -E hal # emerge -v hal dbus hotplug # rc-update add dbus default # /etc/init.d/dbus start # rc-update add hald default # /etc/init.d/hald start
Instead of configuring the software manually, we can just use various pieces of software to do this for us.
# emerge -v pmount # emerge -v ivman # rc-update add ivman default # /etc/init.d/ivman start(after this, you need to add your user to the plugdev group, after running this command, you should restart X or log out then in again) # gpasswd -a username plugdev(now start ivman as normal user so that external devices get mounted with the correct permissions) $ ivman&
Now your window manager should automatically ask you where you would like your external devices mounted. The only thing we could do to enhance the way in which hal works, is let hal make symlinks of our devices. We can do this by making sure it is owned by group hal.
BUS=="usb", SYSFS{serial}=="123456789011121314", SYSFS{product}=="JUMPDRIVE",\ KERNEL=="sd?1", NAME="%k", SYMLINK="usbdrive", GROUP="hal" BUS=="usb", SYSFS{manufacturer}=="Sony", SYSFS{product}=="PSP Type A",\ KERNEL=="sd?1", NAME="%k", SYMLINK="psp", GROUP="hal" BUS=="usb", SYSFS{manufacturer}=="Apple", SYSFS{product}=="iPod",\ KERNEL=="sd?2", NAME="%k", SYMLINK="ipod", GROUP="hal"
Make sure the options below are set as follows in your kernel config, which can
be found at
# nano /usr/src/linux/.config MSDOS_FS=y VFAT_FS=y BLK_DEV_SD=y CHR_DEV_ST=y CHR_DEV_SG=y USB_STORAGE=y USB_UHCI_HCD=y USB_OHCI_HCD=n
Now compile and install your kernel, when that finishes, reboot your system.
# dmesg | grep usb-storage
usb.c: USB device 4 (vend/prod 0xdda/0x2005) is not claimed by any active driver.
You can do this automatically by putting your driver name in
Utilities for querying the sg SCSI interface (contains rescan_scsi_bus.sh) # emerge sg3_utils
After that emerge completes, you should be able to mount the drive:
# mkdir /mnt/usbstick # mount -t vfat /dev/sda1 /mnt/usbstick
You can use sg3_utils to scan for firewire devices as such:
# sg_scan -i # sg_map
# MY USB STICK /dev/sda1 /mnt/stick vfat noauto,user,exec,sync 0 0
Please note that you should use vfat in the fstab file, because if you choose
If vfat exists in
# # This file defines the filesystems search order used by a # 'mount -t auto' command. # # Uncomment the following line if your modular kernel has vfat # support and you want mount to try vfat. vfat # Uncomment the following line if your modular kernel has udf # support and you want mount to try udf before iso9660. udf # Keep the last '*' intact as it directs mount to use the # filesystems list available at /proc/filesystems also. # Don't remove it unless you REALLY know what you are doing!
To be able to access the contents of an iPod correctly, you will need to install
# emerge gtk-pod
# mount -t ntfs /dev/hda1 /mnt/win # mount -t vfat /dev/hda2 /mnt/data
With all three filesystems (MS-DOS, VFAT, NTFS), mount lets you pass the uid
and gid options, which allow you set the user and group IDs of those who the
files are chown'd to when the filesystem is mounted. To find out the values for
uid and gid, you can run
You can change permissions using the parameter umask. However, please be aware
that it must be the bitmask of permissions which are not present for the
mountpoint. It is an octal number, formed like this:
Table 3.1: Permissions table | |||
---|---|---|---|
# my windows partition /dev/hda1 /mnt/ntfs ntfs uid=1000,gid=100 0 0
UTF-8
You may also add utf8 option, normally, this is only the case if you can't see
some files with international characters in filenames.
/etc/fstab /dev/hda1 /mnt/vfat vfat ro,utf8 0 0
For more options:
# man mount 8
We need
Emerge captive:
# emerge captive
Now load the appropriate kernel module, and make it load at boot.
# modules-update # modprobe fuse # echo "fuse" >> /etc/modules.autoload.d/kernel-2.6
Congratulations; Captive should now be installed. To acquire the necessary
filesystems drivers you should run the following command to locate your ntfs
drives in a wizard. You should choose to download the appropriate drivers from
# captive-install-acquire
After you walked through the wizard, you should now be able to mount your windows partitions read/write.
# umount /mnt/win # mount -t captive-ntfs /dev/hda1 /mnt/win
If the following works without errors you may want to put it in your
/dev/hda2 /windows captive-ntfs users 0 0
# modprobe -r fuse # emerge sys-fs/fuse # modules-update # modprobe fuse
This is probably due to udev not working. One of the reasons this could be
happening is becse udev needs specific kernel options to be turned on. The
basic options needed by
Enable
KOBJECT_UEVENT=y CONFIG_HOTPLUG=y