Linux - Hardware-related articles

How to detect and use my HP Deskjet printer / scanner on Debian ?

Situation :

I have an HP Deskjet F2480 "all-in-one" printer/scanner. I know it works on GNU/Linux because I already printed with it with Ubuntu (can't remember which release, though, 't was the 12.xx or 13.xx maybe). The scanner worked fine too.

Now I've switched to Debian (Jessie in the initial version of this article, Stretch for the current edit), I can't remember what I did to make it work (if anything special).

So here are notes for my future self to make things easier (you're welcome, bro' )

Details :

In search of solutions, I've tried many different things which finally worked. But I can't tell whether just the final action was the solution, or a combination of actions. So here's everything I did.

Solution :

  1. sane-find-scanner
    • on Jessie :
      # sane-find-scanner will now attempt to detect your scanner. If the
      # result is different from what you expected, first make sure your
      # scanner is powered up and properly connected to your computer.
      # No SCSI scanners found. If you expected something different, make sure that
      # you have loaded a kernel SCSI driver for your SCSI adapter.
      found USB scanner (vendor=0x03f0 [HP], product=0x7611 [Deskjet F2400 series]) at libusb:001:044
      # Your USB scanner was (probably) detected. It may or may not be supported by
      # SANE. Try scanimage -L and read the backend's manpage.
      # Not checking for parallel port scanners.
      # Most Scanners connected to the parallel port or other proprietary ports
      # can't be detected by this program.
    • on Stretch :
      ...
      found USB scanner (vendor=0x03f0 [HP], product=0x7611 [Deskjet F2400 series]) at libusb:001:007
      ...
  2. scanimage -L
    • on Jessie :
      No scanners were identified. If you were expecting something different,
      check that the scanner is plugged in, turned on and detected by the
      sane-find-scanner tool (if appropriate). Please read the documentation
      which came with this software (README, FAQ, manpages).
    • on Stretch :
      device `hpaio:/usb/Deskjet_F2400_series?serial=CN9AT172RV05BS' is a Hewlett-Packard Deskjet_F2400_series all-in-one
  3. apt-get install libsane-extras
  4. vim /etc/sane.d/dll.conf (source)
    (nothing found matching my scanner )
  5. lsusb
    ...
    Bus 001 Device 044: ID 03f0:7611 Hewlett-Packard DeskJet F2492 All-in-One
    ...
    ls -al /dev/bus/usb/001/044
    crw-rw-r-- 1 root lp 189, 43 Jan 11 20:21 /dev/bus/usb/001/044

    The device ID (here 044) is incremented each time a device is detected (unplug + replug or off + on counts as "new device detected")

  6. sudo adduser saned lp
  7. apt install hplip

    Those 2 latest steps seem to do the trick. The very latest thing to do was to reboot the computer / power off + on the printer / unplug + replug the printer USB cord .

Final note : Xsane now detects my scanner but looks WAY too complex for my VERY basics needs. Simple-scan is just fine.

How to get information on your system ?

Hardware

Hardware detection utilities :
  • discover (need more details)
  • lshal : show vendor, product name, S/N, /sys/device path, ...
One-liner for CPU and RAM :

serverList='server1 server2'; user='bob'; for server in $serverList; do echo $server; ssh $user@$server 'echo -en "Physical CPU\t: "; grep "physical id" /proc/cpuinfo | sort | uniq | wc -l; echo -en "CPU Cores\t: "; grep -c ^processor /proc/cpuinfo; echo -en "CPU Model\t: "; grep "model name" /proc/cpuinfo | sort | uniq; echo -en "RAM\t\t: "; grep "MemTotal:" /proc/meminfo'; echo; done

Motherboard
  • Model reference : dmidecode -t baseboard | grep "Base Board Information" -A13
  • SATA capabilities (bandwidth of SATA versions, I:1.5Gb/s, II:3Gb/s, III:6Gb/s) : dmesg | grep -i sata
CPU
  • lscpu
  • less /proc/cpuinfo (Differentiate multi-core / multi-socket / hyperthreading CPUs)
  • dmidecode -t processor (requires privileges)
  • Number of physical processors : grep 'physical id' /proc/cpuinfo | sort -u | wc -l
  • Number of cores :
    • grep -Ec '^processor' /proc/cpuinfo
    • top + 1
  • Whether the processor is a 32/64 bits :
    • method 1 : arch
    • method 2 : This command checks whether the kernel is 32 or 64 bit (source) : getconf LONG_BIT
      • 64 / ia64 / x86_64 : 64-bit mode
      • 32 / i386 : 32-bit mode
    • method 3 : perl -e 'print ~123;'; echo
      • 4294967172 : 32 bits
      • 18446744073709551492 : 64 bits
RAM
  • less /proc/meminfo
  • Total installed RAM :
  • the shell command free
  • dmidecode -t memory (requires privileges)
HDD and storage devices
  • List storage (aka block) devices : lsblk
  • Manufacturer, model number, S/N, firmware and A LOT more :
    • hdparm -I /dev/sdb (this is a capital 'i').
      For details on all installed drives : for letter in {a..z}; do device="/dev/sd$letter"; [ -b "$device" ] && hdparm -I "$device" | head -8; done
    • smartctl -a /dev/sdb (this comes with smartmontools, more from wikipedia, more from Ubuntu documentation)
  • List available partitions :
    • fdisk -l
    • or less /proc/partitions
    • or mount | grep sd
    • or grep sd /etc/mtab
  • Get device / filesystem metadata (type, last mount point, status, FS creation/last mount/last write/last check/next check, mount count, ...)
  • Get partitions size, usage, available space : df -h
  • Get device / partition size :
    • fdisk -l | grep -E '^Disk /'
    • Using the /sys pseudo filesystem :
      in sectors in GiB (1 sector = 512 B)
      • cat /sys/block/sda/size
      • cat /sys/block/sda/sda1/size
      • echo "$(cat /sys/block/sda/size)*512/1024/1024/1024" | bc
      • echo "$(cat /sys/block/sda/sda1/size)*512/1024/1024/1024" | bc
  • Total storage :

    Both methods give slightly different numbers. I guess this is because the df method sums formatted sizes whereas the /sys method gets device size.

  • Sector size :
SWAP usage in MB
  • free -m | awk '/Swap/ {print $3}'
LAN
  • mii-tool (comes from net-tools) : (as ) show the media-independent interface status :
    • mii-tool
    • mii-tool -v
    • mii-tool eth0
PCI devices
  • less /proc/pci (when available)
  • lspci lists all detected PCI devices (in a tree-like diagram with -tv : tree + verbose) :
    ...
    00:18.4 Host bridge: Advanced Micro Devices [AMD] Family 10h Processor Link Control
    01:00.0 VGA compatible controller: ATI Technologies Inc Juniper [Radeon HD 5700 Series]
    01:00.1 Audio device: ATI Technologies Inc Juniper HDMI Audio [Radeon HD 5700 Series]
    ...
    For more details on device (source) : lspci -v -s 01:00.0
    01:00.0 VGA compatible controller: ATI Technologies Inc Juniper [Radeon HD 5700 Series] (prog-if 00 [VGA controller])
    Subsystem: PC Partner Limited Device 1482
    Flags: bus master, fast devsel, latency 0, IRQ 27
    Memory at d0000000 (64-bit, prefetchable) [size=256M]
  • scanpci -vO (-v : verbose, -O : use the OS's specific mechanism to get information. Details). The PCI bus 0x1 is the AGP port.
USB devices
  • lsusb lists all detected USB devices (in a tree-like diagram with -tv : tree + verbose)

Software

Kernel
  • all about the kernel (name, release, version, ...) : uname -a
    Linux hostname 2.6.32-220.17.1.el6.x86_64 #1 SMP Thu Apr 26 13:37:13 EDT 2012 x86_64 x86_64 x86_64 GNU/Linux
    or : less /proc/version
    Linux version 2.6.32-220.17.1.el6.x86_64 (mockbuild@x86-003.build.bos.redhat.com) (gcc version 4.4.6 20110731 (Red Hat 4.4.6-3) (GCC) ) #1 SMP Thu Apr 26 13:37:13 EDT 2012
  • kernel release : uname -r
    2.6.32-042stab108.8
  • kernel version : uname -v
    #1 SMP Wed Jul 22 17:23:23 MSK 2015
Operating system
On Debianoids :
cat /etc/debian_version outputs 7.8
On Red Hatoids :
cat /etc/redhat-release outputs Red Hat Enterprise Linux Server release 6.2 (Santiago)
Common :
  • all of Linux Standard Base information : lsb_release -a
    Distributor ID:	Debian
    Description:	Debian GNU/Linux 7.8 (wheezy)
    Release:	7.8
    Codename:	wheezy
    Distributor ID:	RedHatEnterpriseServer
    Description:	Red Hat Enterprise Linux Server release 6.2 (Santiago)
    Release:	6.2
    Codename:	Santiago
    Consider the command flags to get single field information, in either long/short format ( for details)
  • cat /proc/version outputs :
    Linux version 2.6.32-042stab108.8 (root@kbuild-rh6-x64.eng.sw.ru) (gcc version 4.4.6 20120305 (Red Hat 4.4.6-4) (GCC) ) #1 SMP Wed Jul 22 17:23:23 MSK 2015
  • cat /etc/issue outputs :
    Debian GNU/Linux 7 \n \l
    This can be customized and may not be up-to-date.
Operating system installation date (source)
  • as : tune2fs -l $(mount | awk '/ \/ / {print $1}') | grep 'Filesystem created:'
    This hack assumes the operating system was installed the same day the / filesystem was created, which is true unless you've added a new disk, created a new / filesystem and moved files around.
  • on Debianoids : ll /var/log/installer/syslog
    This file (if still there) was created during install. This method is still approximate.
  • ls -lact --full-time /etc | tail
List daemons / services
Current shell
Environment variables
Files
  • get the file type : file myFile
  • information on file times : stat myFile
  • information (type, dimension, colors) of image files : identify myFile

Miscellaneous

  • Investigate (cat / more / less) the /proc/ directory
  • dmesg | less displays the kernel messages.
  • Read logs :
    • /var/log/messages
    • /var/log/boot.log
    To read logs in real time : tail -f /var/log/messages
  • List the loaded kernel modules (details) : lsmod

Install and configure WiFi

Identify which controller you're using :

lspci | egrep -i "(lan|network|ethernet|wireless)"

Using a Broadcom BCM4306 (rev 03) controller

  1. By typing dmesg, you may notice a message such as b43-phy0 ERROR : Firmware file "B43/ucode5.fw" not found or load failed. This means the WiFi controller firmware is missing.
  2. So let's install it : apt-get install b43-fwcutter (source). The installer will ask whether to unpack it all : accept.
  3. unload and reload the kernel module : rmmod b43 && modprobe b43
  4. NB : the LEDs of the PCMCIA WiFi controller should light up once the module is loaded.

Using an Intel Pro Wireless 2200 B/G with WPA (source : see III-B)

  1. The 1st thing you'll need is the Intel firmware ipw2200-bss.fw (alternate source). This firmware is required during the system setup.
  2. Some packages to install :
    • wireless-tools
    • wpasupplicant
  3. Let's encrypt our WPA passphrase : wpa_passphrase mySsid myClearPassphrase, which outputs :
    network={
    ssid="mySsid"
    #psk="myClearPassphrase"
    psk=600792632e29fc6c69f04e82d1290a28bf1bffff58294ca6ddaf48062c36f311
    }
  4. Then, let's save this into /etc/network/interfaces
    • static version :
      # Static configuration
      auto wlan0
      iface wlan0 inet static
      address 192.168.0.2
      netmask 255.255.255.0
      network 192.168.1.0
      broadcast 192.168.1.255
      gateway 192.168.0.1
      wpa-conf managed
      wpa-ap-scan 1
      wpa-scan-ssid 1
      wpa-ssid mySsid
      wpa-key-mgmt WPA-PSK
      wpa-psk 600792632e29fc6c69f04e82d1290a28bf1bffff58294ca6ddaf48062c36f311
    • DHCP version :
      # DHCP configuration
      auto wlan0
      iface wlan0 inet dhcp
      wpa-conf managed
      wpa-ap-scan 1
      wpa-scan-ssid 1
      wpa-ssid mySsid
      wpa-key-mgmt WPA-PSK
      wpa-psk 600792632e29fc6c69f04e82d1290a28bf1bffff58294ca6ddaf48062c36f311
  5. Then, restart the network to load changes : /etc/init.d/networking restart

    In some circumstances, it may be required to allow broadcasting the SSID so that the wireless host can discover it. Once the wireless host has been registered to the access point, SSID broadcasting can be turned off.
    This may also be related to MAC addresses filtering : while SSID broadcasting was off, my own wireless network was invisible to scanning.

Using an Intel PRO/Wireless 3945ABG [Golan] with WEP :

  1. To "see" the system complain, run /etc/init.d/network-manager restart && dmesg. You may notice an output like :
    [109694.622325] firmware: requesting iwlwifi-3945-1.ucode
    [109694.631281] iwl3945: iwlwifi-3945-1.ucode firmware file req failed: Reason -2
    [109694.631281] iwl3945: Could not read microcode: -2
    We need the firware file iwlwifi-3945-1.ucode.
  2. Let's get it from intellinuxwireless.org (alternate source)
  3. copy it into /lib/firmware/
  4. edit /etc/network/interfaces :
    auto wlan0
    iface wlan0 inet dhcp
    	wireless-essid myEssid
    	wireless-key myWepKey
  5. enable the interface with ifup wlan0

Tip to get the full data rate (Ubuntu 9.04 + Ralink RT2500)

  1. normal setup is done with : iwconfig wlan0 essid mySsid freq 2447000000 ap accessPointMacAddress rate 54M
  2. then, as : iwconfig wlan0 rate 54M
  3. ... and it should work ! (source)

When dmesg complains : phy0 -> rt2500pci_set_device_state: Error - Device failed to enter state 1 (-16) (source)

Run (as ) : iwconfig wlan0 power off

Notes

Wireless interfaces are not listed by ifconfig when they are down. Use iwconfig instead.

Swap management and swappiness

Facts and definitions :

Linux has a parameter called swappiness which determines how much the kernel is likely to swap out runtime memory rather than dropping pages from the system cache (more details). It defaults to 60.

There's a popular belief saying that the swappiness is the RAM usage threshold beyond which some of the contents of the RAM is moved to the SWAP partition. Based on the 60 default value, it's said that, if the free RAM goes below 60%, the SWAP will be used.
This is sooo WRONG !!!

Myths about Swap (source) :
  1. Swap space does not inherently slow down your system. In fact, not having swap space doesn't mean you won't swap pages. It merely means that Linux has fewer choices about what RAM can be reused when a demand hits. Thus, it is possible for the throughput of a system that has no swap space to be lower than that of a system that has some.
  2. Swap space is used for modified anonymous pages only. Your programs, shared libraries and filesystem cache are never written there under any circumstances.
  3. Given items 1 and 2 above, the philosophy of "minimization of swap space" is really just a concern about wasted disk space.
For more details and definitions :

Change the threshold temporarily :

echo 10 > /proc/sys/vm/swappiness

Albeit technically right, the procedure above is mostly pointless unless PERFECTLY understanding how the swap works. Again, changing the swappiness value has NOTHING to do with any amount of used RAM after which swapping starts. Read links above.

Make a permanent change :

Add into /etc/sysctl.conf :

vm.swappiness=10
Then reboot (or sysctl -p) to apply changes.

Performance indicators (source) :

Am i swapping ?
  • Superb : no swap space even has been allocated (free shows 0 swap in use), and RAM usage is low. Unless you benefit from a huge filesystem cache, you may have spent too much on RAM. Run more stuff.
  • Great : swap space is allocated, but there is almost no I/O on the swap partition.
  • OK : swap space is allocated, and there is some I/O on the swap partition. System throughput is still OK. For example, the CPUs are busy, and most of that is in the User or Nice categories. If you see CPU Wait, it indicates a disk bottleneck (possibly on swapping), and system time could mean the OS is frantically looking for memory to reuse (page scanning).
  • Not OK (too much swapping) : lots of I/O on the swap partition. CPU is spending a lot of time in Sys or Wait, and swap disk service times exceed the average disk access times.
  • Not OK (too little swap space) : system is running very well, but new programs refuse to start due to lack of virtual memory.

How to setup a ramdisk ?

The good news is : you don't have to, since most distributions create one for you. It used to be available at /dev/shm (shared memory) but /run/shm should be used instead since Wheezy (source).

On Debianoids, /run/shm actually symlinks to /dev/shm.

Find yours : df -h /run/shm
Filesystem	Size	Used	Avail	Use%	Mounted on
tmpfs		2.0G	12K	2.0G	1%	/dev/shm

This space can be used for temporary data.

More on tmpfs (Debian documentation, Wikipedia, kernel.org) :

  • tmpfs volumes can be read/written like any other filesystem type, but they are on volatile memory instead of a persistent storage device : their contents is not reboot-proof.
  • The memory used by tmpfs grows and shrinks to accommodate the files it contains and can be swapped out to swap space. By default, swapping is triggered by data on the tmpfs volume using more than half of the physical RAM.
  • Depending on distributions, /tmp itself can be a tmpfs volume

Usage

Create a custom ramdisk (source) :

mount -t tmpfs -o size=512M tmpfs /mount/point

Create a custom ramdisk at boot time :
Add into /etc/fstab :
none	/mount/point	tmpfs	defaults,size=512M	0	0
To save a reboot and apply settings NOW! : mount -o remount /mount/point
Change ramdisk size :

mount -o remount,size=8G /dev/shm

How to setup dual-screen display ?

To do so, your 1st idea may be to try using the ATI Catalyst Control Center (which binary is /usr/bin/amdcccle) as root, but this didn't work

Other solution : x11-xserver-utils :

Other solution : xrandr :

List the detected monitors :

xrandr -q may output something like (this is actually what is output AFTER configuration) :

Screen 0: minimum 320 x 200, current 1280 x 1024, maximum 8192 x 8192
DisplayPort-0 disconnected (normal left inverted right x axis y axis)
HDMI-0 disconnected (normal left inverted right x axis y axis)
DVI-0 connected 1280x1024+0+0 (normal left inverted right x axis y axis) 337mm x 270mm
	1280x1024     75.02    60.02*
	1024x768      75.08    70.07    60.00
	800x600       75.00    60.32
	640x480       75.00    60.00    59.93
	720x400       70.08    70.08
DVI-1 connected 1280x1024+0+0 (normal left inverted right x axis y axis) 338mm x 270mm
	1280x1024     60.02*+  75.02
	1152x864      75.00
	1024x768      75.08    70.07    60.00
	832x624       74.55
	800x600       72.19    75.00    60.32    56.25
	640x480       75.00    72.81    66.67    60.00    59.94
	720x400       70.08
Screen names are listed UPPERCASE, then their settings (Details).

Configure both monitors :

xrandr --auto --output DVI-0 --mode 1280x1024
xrandr --auto --output DVI-1 --mode 1024x768 --pos 1280x300

  1. --pos declares the offset of the lower-left corner of DVI-1 relatively to the lower-left corner of DVI-0.
  2. Don't spend too much time trying to align windows on screens of different sizes/resolutions : pixels may not be the same height on both screens
  3. The device that is declared 1st becomes the primary screen. By default, Gnome displays the panel on this screen only (source).
Even simpler method :

xrandr --output DVI-1 --left-of DVI-0

More in the xrandr man page and on Wikipedia.
If xrandr complains xrandr: screen cannot be larger than widthxheight (source) :
  1. Open /etc/X11/xorg.conf (this was created with aticonfig --initial when installing ATI non-free driver)
  2. In the Screen | Display subsection, declare the size on the Virtual Display : Virtual 2304 1068
    Section "Screen"
    	Identifier		"aticonfig-Screen[0]-0"
    	Device			"aticonfig-Device[0]-0"
    	Monitor			"aticonfig-Monitor[0]-0"
    	DefaultDepth		24
    	SubSection		"Display"
    		Viewport	0 0
    		Depth		24
    		Virtual		2304 1068
    	EndSubSection
    EndSection

Save settings (source) :

Simply write the command line above into ~/.xprofile.

(Re-)Apply settings after opening a graphical session :

How to disable the annoying PC speaker beep ?

Quick solution (not reboot-proof) :

As : rmmod pcspkr

Definitive solution : Kernel Module Blacklisting (sources : 1 (for Debian Etch), 2) :

As :
  1. echo blacklist pcspkr > /etc/modprobe.d/pcspkr.conf
  2. depmod -a
  3. update-initramfs -u
  4. reboot

Answers indicating to create a /etc/modprobe.d/blacklist.conf (or /etc/modprobe.d/blacklist) file containing blacklist pcspkr have no effect : naming modules there does not affect autoloading of modules by the kernel.

Fiddling with the MBR

With Linux, there is no "brute force" way to reinitialize the MBR like the MS-DOS fdisk /mbr. However, it is possible to save/restore it with dd.

Some preliminary details on the Master Boot Record (source) :

On hard disks (and many other mass storage media), the boot sector is called the Master Boot Record. It consists of 512 bytes at the first sector of the hard disk. It is important to note that it is not located inside any partition. The Master Boot Record precedes the first partition. Its layout is as follows :

  • First 446 bytes contain bootable code.
  • Next 64 bytes contain partition information for 4 partitions (16×4). That is why the hard disks can have only 4 primary partitions, as the MBR can store information for 4 partitions only. So if you need more than 4 partitions on the hard disk, one of the primary partition has to be made extended, and out of this extended partition, logical partitions are created.
  • Last 2 bytes are for MBR signature, also called magic number.

Thus total of 446 + 64 + 2 = 512 bytes :

|=================|======|======|======|======|===|
| 446             | 16   | 16   | 16   | 16   | 2 |
|=================|======|======|======|======|===|

The first 446 bytes of MBR contain the code that locates the partition to boot from. The rest of booting process takes place from that partition. This partition contains a software program for booting the system called the bootloader.

Now let's play with dd :

Save the MBR :
dd if=/dev/sda of=/path/to/file bs=446 count=1

Save the MBR + partition table :
dd if=/dev/sda of=/path/to/file bs=512 count=1

Restore one of those :
dd if=/path/to/file of=/dev/sda bs=446|512 count=1

System Tuning

Reduce disk I/O by mounting partitions with noatime (source)

  1. Edit /etc/fstab
  2. Add noatime to the mount options of the / filesystem
  3. Remount the filesystem : mount -o remount /
  4. Check with : mount

How to monitor the CPU temperature ?

  1. apt-get install lm-sensors
  2. load the i2c-dev kernel module : modprobe i2c-dev
  3. then detect sensors and configure the tool : sensors-detect, which finally outputs :
    To load everything that is needed, add this to /etc/modules:
    #----cut here----
    # Chip drivers
    w83627hf
    #----cut here----
  4. Then, once the chip kernel module is loaded, you can read sensor information : sensors
  5. To monitor CPU temperature easily in a terminal : watch -n 10 -d "sensors | grep 'Core'"

How to set the CPU frequency ?

  1. install the required packages : cpufrequtils, sysfsutils (is the latter useful ?)
  2. identify your CPU : grep model /proc/cpuinfo
  3. you can also get its current frequency : cpufreq-info
  4. now you need a kernel module to manage the frequency scaling :
    CPU family kernel module
    Pentium 4, Celeron D, Pentium D, Celeron M p4_clockmod
    Pentium M, Core Duo, Core 2 Duo speedstep_centrino
    AMD K6 powernow_k6
    AMD K7 (Athlon, Duron, Sempron 32) powernow_k7
    AMD K8 (Athlon 64, Turion 64, Sempron 64, Opteron 64) powernow_k8
    None of above acpi_cpufreq (with NO warranty that it works, whatsoever!)
    To list all available modules :
    • ls -l /lib/modules/$(uname -r)/kernel/arch/x86/kernel/cpu/cpufreq/
    • ls -l /lib/modules/$(uname -r)/kernel/arch/i386/kernel/cpu/cpufreq/ ("i386" | "x86" in the path)
  5. load the chosen module : modprobe p4_clockmod
  6. now it's time to setup the policy governor (governors are listed in /sys/devices/system/cpu/cpu0/cpufreq/scaling_available_governors) :
    governor usage module
    performance sets the frequency statically to the highest possible value within the configured MIN/MAX range cpufreq_performance
    powersave sets the frequency statically to the lowest possible value within the configured MIN/MAX range cpufreq_powersave
    userspace allows the users (or any application running as "root") to set the CPU frequency
    ondemand adjusts the CPU speed dynamically, depending on the usage cpufreq_ondemand
    conservative similar to ondemand, adjusts the frequency dynamically. It differs in behaviour in that it gracefully increases and decreases the CPU speed rather than jumping to max speed upon CPU load. This is more suitable in a battery powered environment. cpufreq_conservative
  7. load the chosen module : modprobe cpufreq_powersave
  8. now, find the range of supported frequencies by your CPU :
    • min/max values only : cpufreq-info -l
    • list of all supported values : cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_available_frequencies
      3200000 2500000 2100000 800000
  9. edit /etc/init.d/cpufrequtils and set values for GOVERNOR, MAX_SPEED and MIN_SPEED :
    ENABLE="true"
    GOVERNOR="ondemand"
    MAX_SPEED="1000000"
    MIN_SPEED="800000"
    
    The CPU frequency can be chosen only from the values listed above. Using another value for MAX_SPEED will cause no error, but the CPU won't be able to go faster than the nearest smaller accepted value.
  10. restart cpufrequtils : /etc/init.d/cpufrequtils restart
  11. make sure it works :
    • min max governor : cpufreq-info -p
    • verbose : cpufreq-info
    • cpufreq-info | grep "fréquence actuelle"
  12. load the CPU and governor modules at startup :
    1. echo p4_clockmod >> /etc/modules
    2. echo cpufreq_powersave >> /etc/modules
  13. [for fun] load you CPU at 100% : while [ 1 -eq 1 ]; do echo 1>/dev/null; done
  14. Enjoy !

Useless but funny way to eject a CD

  1. Get the mount point of the optical drive : grep cd /etc/fstab
    /dev/sr0	/media/cdrom0	udf,iso9660	user,noauto	0	0
  2. To eject the CD : eject /media/cdrom0
  3. To "inject" it back : eject -t /media/cdrom0
This may not work without privileges.

Linux and USB 2.0

New Logos :

Logo USB version Bandwidth
USB 2.0
(high speed version, with red stripe)
480 Mbits/s (theoretical)
60-80 Mbits/s (practical)
USB 1.1 12 Mbits/s (theoretical)
2 Mbits/s (practical)

Details

How to connect a FireWire (IEEE1394) hard drive?

IEEE 1394 is the "real" name of that technology, also known as FireWire and iLink (Sony).
Actually, the connection method is quite similar to connecting a USB digital camera. Here is the procedure I use:

To connect the HDD :

  1. physically connect the HDD
  2. modprobe ohci1394
  3. modprobe sbp2
  4. mount /dev/sdxx mountPoint

To disconnect this HDD :

  1. Unloading the ohci1394 driver in the 2.4.10-12a kernel results in a DEADLOCK condition that requires a reboot. So never unload the ohci1394 driver and don't use /etc/modules.conf to associate sbp2 with ohci1394 because if you do, then unloading sbp2 will cause ohci1394 to unload.
  2. simply unload the sbp2 module: modprobe -r sbp2
  3. physically disconnect the HDD.

To reconnect the HDD :

  1. physically connect the HDD
  2. To gain access to the drive, both ohci1394 and sbp2 must be loaded:
    • ohci1394 is still loaded since we can't unload it without messing things up.
    • sbp2 must be loaded / unloaded each time the drive is attached / removed. It is currently unloaded, so modprobe sbp2 to load it.