Project Trailblazer USB Hardware

   


Based on driver functionality, component availability, and cost, the engineers selected the following USB devices for Project Trailblazer:

  • Yamaha YST-MS35D USB speakers5

  • Kensington VideoCAM Super-VGA PC camera, model 670166

  • SanDisk USB SmartMedia card reader7

One additional product that caught the engineers' attention was the JVC RK-8010VBK AV receiver, with a USB input and five 100-watt output channels.8 This could be a solution for powering audio at the Silverjack AirPark. The engineers couldn't determine the device's USB specifics from online information, but they assumed that this receiver adheres to the USB Audio Class specification.9 Therefore, this chapter focuses on using the Yamaha YST-MS35D USB speakers for use around the village. At this point, the engineers threw in an extra side project. They envisioned an image kiosk, where visitors could transfer, view, and send images as email messages from their personal digital cameras. These kiosks would be equipped with SmartMedia card readers (future kiosks are expected to have Compact Flash readers as well), keyboards, monitors, and network connections. Guests would be able to insert their memory cards, view images, and select email options. The remaining sections of this chapter address kernel configuration and supplemental software compilation to get these Project Trailblazer USB devices up and running using tbdev1.

USB Audio: Yamaha YST-MS35D USB Speakers

Configuring Linux for USB audio is simple and straightforward. In 30 minutes, you can perform the following steps on tbdev1:

  1. Download the kernel, configure the kernel for USB audio, compile and install the kernel version 2.4.10, and then reboot tbdev1.

  2. Connect the USB speakers.

  3. Download and compile a console-based MP3 decoder program called mpg123 and then play an MP3 song.

Downloading, Configuring, Compiling, and Installing Kernel Version 2.4.10

tbdev1, as configured in Chapter 3, is running the Debian potato distribution, which uses Linux kernel version 2.2.19. In this section, you will update tbdev1 to run kernel version 2.4.10. This kernel version has the Project Trailblazer audio, video, and mass storage USB device drivers included within the source distribution. Getting these devices up and running requires simple kernel configurations. In this section, you will configure the kernel to recognize USB audio devices. Here are steps to download, configure, compile, and install kernel version 2.4.10:

  1. Log on to tbdev1 as root, change directory to /usr/src, and download and extract the kernel 2.4.10 source, by using these commands:

     root@tbdev1[550]: cd /usr/src root@tbdev1[551]: wget http://www.kernel.org/pub/ linux/kernel/v2.4/ linux-2.4.10.tar.gz root@tbdev1[552]: tar zxf linux-2.4.10.tar.gz 

    TIP

    The Linux source code repository, www.kernel.org, is an extremely busy Web site. You will experience faster download times if you use a mirror site than if you use www.kernel.org. Check www.kernel.org/mirrors to find the mirror site closest to you.

  2. Configure the kernel with USB audio support:

     root@tbdev1[553]: cd /usr/src/linux root@tbdev1[554]: make menuconfig 
  3. Configure the kernel options for sound support. Using the up and down arrow keys, scroll to the sound item and press Enter. When you see the Sound configuration menu, select the Sound Card Support item and press the spacebar until a * character appears between < > (that is, <*>). This means that sound card support will be built in to the kernel. If any other items are selected in <*>, scroll to them and use the spacebar to deselect them. Only the Sound Card Support item should be selected for USB audio. Use the left and right arrows to select Exit, and then press Enter. This takes you back to the main menu.

  4. Scroll to the USB support item and press Enter. Configure only the following USB support options:

    • <*> Support for USB

    • [*] USB verbose debug messages

    • [*] Preliminary USB device filesystem

    • [*] UHCI alternate driver (JE) support

    • [*] OHCI (Compaq, iMacs, OPTi, Sis, Ali) support

    • [*] USB audio support

    TIP

    You need to determine your computer's USB host controller type by using the lspci command. Look for the manufacturer of the USB controller. Typically, controllers from Intel and VIA technologies are UHCI devices. CMD, Symbios, OPTi, Lucent, Silicon Integrated Systems, Ali, National Semiconductor, and NEC make OHCI controllers.

    Use the left and right arrows to select Exit, and then press Enter. This takes you back to the main menu.

  5. Use the left and right arrows to select Exit, and then press Enter. When asked to save the kernel configuration, select Yes and press Enter.

  6. Build the new kernel by using this command:

     root@tbdev1[555]: make dep; make clean; make bzImage 
  7. When the kernel build completes, you need to install the new kernel by copying the kernel image to the /boot directory:

     root@tbdev1[556]: cp arch/i386/boot/bzImage /boot/usbtest 
  8. With the new kernel image installed, you need to configure lilo to load this kernel when booting instead of loading the potato kernel image. Add this entry to the bottom of /etc/lilo.conf and then run lilo:

     image=/boot/usbtest         label=usbtest         read-only root@tbdev1[558]: lilo Added Linux * Added usbtest Skipping /vmlinuz.old root@tbdev1[559]: 

    The * on the Added Linux line means lilo will load this default image. This is kernel 2.2.19, which the potato installation program installed. The new USB kernel is usbtest.

    TIP

    You can read more about lilo in two places: the LILO mini-HOWTO (www.linuxdoc.org/HOWTO/mini/LILO.html) and the tbdev1 user document's lilo directory, /usr/doc/lilo. These documents fully explain lilo's operation and its configuration file, /etc/lilo.conf.

  9. Reboot tbdev1 and press the Alt key when you see lilo. Type usbtest at the boot: prompt, and then press Enter. This boots tbdev1 using the new kernel with USB audio support.

  10. Log in as root and check the kernel version by using the uname command:

     root@tbdev1[500]: uname -r 2.4.10 
  11. Look in the /proc/bus directory for a usb directory. This is the first indication that the kernel has USB support:

     root@tbdev1[501]: ls /proc/bus/ pci/  usb/ 
  12. Mount the usbdevfs filesytem on the /proc/bus/usb directory:

     root@tbdev1[505]: mount -t usbdevfs usbdevfs /proc/bus/usb/ 

    This creates a filesystem that contains human-readable information about the USB subsystem.

  13. List the /proc/bus/usb directory contents:

     root@tbdev1[506]: ls /proc/bus/usb 001/  devices  drivers 

    The devices file contains information about the currently connected USB devices. The drivers file contains a list of currently loaded USB drivers.

tbdev1 is now running kernel version 2.4.10 with USB audio support.

Connecting the USB Speakers

Follow these steps to connect the USB speakers and examine USB information provided by the kernel:

  1. Connect the USB speakers and look at the contents of the /proc/bus/usb/drivers and /proc/bus/usb/devices:

     root@tbdev1[519]: cat /proc/bus/usb/drivers          usbdevfs          hub          audio 

    Use cat to check that Linux automatically loaded the USB audio device driver:

     root@tbdev1[520]: cat /proc/bus/usb/devices T:  Bus=01 Lev=00 Prnt=00 Port=00 Cnt=00 Dev#=  1 Spd=12  MxCh= 2 B:  Alloc=  0/900 us ( 0%), #Int=  0, #Iso=  0 D:  Ver= 1.00 Cls=09(hub  ) Sub=00 Prot=00 MxPS= 8 #Cfgs=  1 P:  Vendor=0000 ProdID=0000 Rev= 0.00 S:  Product=USB UHCI-alt Root Hub S:  SerialNumber=e000 C:* #Ifs= 1 Cfg#= 1 Atr=40 MxPwr=  0mA I:  If#= 0 Alt= 0 #EPs= 1 Cls=09(hub  ) Sub=00 Prot=00 Driver=hub E:  Ad=81(I) Atr=03(Int.) MxPS=   8 Ivl=255ms T:  Bus=01 Lev=01 Prnt=01 Port=00 Cnt=01 Dev#=  2 Spd=12  MxCh= 0 D:  Ver= 1.00 Cls=00(>ifc ) Sub=00 Prot=00 MxPS= 8 #Cfgs=  1 P:  Vendor=0499 ProdID=3002 Rev= 1.00 S:  Manufacturer=YAMAHA S:  Product=YAMAHA YST-MS35D USB Speaker S:  SerialNumber=Ser 00 em C:* #Ifs= 3 Cfg#= 1 Atr=40 MxPwr=  0mA I:  If#= 0 Alt= 0 #EPs= 0 Cls=01(audio) Sub=01 Prot=00 Driver=audio I:  If#= 1 Alt= 0 #EPs= 0 Cls=01(audio) Sub=02 Prot=00 Driver=audio I:  If#= 1 Alt= 1 #EPs= 1 Cls=01(audio) Sub=02 Prot=00 Driver=audio . . . some output deleted. root@tbdev1[521]: 

    The devices file contains what looks like cryptic information. (See /usr/src/linux/Documentation/usb/proc_usb_info.txt for complete description of the /proc/bus/usb/devices output.) You can see the following in the lines that start with S:

     S:  Product=USB UHCI-alt Root Hub S:  Manufacturer=YAMAHA S:  Product=YAMAHA YST-MS35D USB Speaker 

    The USB root hub and the Yamaha USB speakers are running. Also, the I: lines following the Yamaha speaker lines show the device connected to the USB audio driver.

  2. The USB subsystem has been loaded, the root hub and the speakers have been found, and the appropriate drivers loaded. Now you need to make two audio devices in the /dev directory. First check for /dev/audio and /dev/dsp, and if they don't exist, create them by using mknod:

     root@tbdev1[524]: ls -l /dev/audio /dev/dsp root@tbdev1[525]: mknod -m 666 /dev/dsp   c 14 3 root@tbdev1[526]: mknod -m 666 /dev/audio c 14 4 root@tbdev1[527]: ls -l /dev/audio /dev/dsp crw-rw-rw- 1 root audio 14, 4 Apr 14 18:44 /dev/audio crw-rw-rw- 1 root audio 14, 3 Apr 14 18:44 /dev/dsp 

tbdev1 recognizes the USB speakers, using the kernel's USB subsystem. With the audio device files created, you can now test the USB speakers by using an MP3 decoder.

Downloading and Compiling a Console-Based MP3 Decoder Program

In this section, you will download and compile mpg123, a console-based MP3 decoder. Using mpg123, you will test the USB subsystem and the USB speakers. Here are the steps to download, compile and run mpg123:

  1. Download the latest source code for the console-based MP3 decoder mpg123, from www.mpg123.de, extract the source from the tar file, and compile it:

     root@tbdev1[535]: cd /root root@tbdev1[536]: wget http://www.mpg123.de/mpg123/mpg123-0.59r.tar.gz root@tbdev1[537]: tar zxf mpg123-0.59r.tar.gz root@tbdev1[538]: cd mpg123-0.59r root@tbdev1[539]: make linux root@tbdev1[540]: ls -l mpg123 -rwxr-xr-x 1 root root 176049 Oct 7 17:57 mpg123 
  2. Test the USB speakers. To do so, you can play a now-famous Sun Studios recording as the first song:

     root@tbdev1[555]: mpg123 "Elvis_Presley-Thats_All_Right.mp3" High Performance MPEG 1.0/2.0/2.5 Audio Player for Layer 1, 2 and 3. Version 0.59r (1999/Jun/15). Written and copyrights by Michael Hipp. Uses code from various people. See 'README' for more! THIS SOFTWARE COMES WITH ABSOLUTELY NO WARRANTY! USE AT YOUR OWN RISK! Title  : Elvis Presley                   Artist: That's All Right Album  : The Sun Sessions CD             Year  : Comment:                                 Genre : Rock Playing MPEG stream from Elvis_Presley-Thats_All_Right.mp3 ... MPEG 1.0 layer III, 160 kbit/s, 44100 Hz joint-stereo [1:56] Decoding of Elvis_Presley-Thats_All_Right.mp3 finished. root@tbdev1[556]: 

    TIP

    In addition to playing local MP3 files, mpg123 can also stream files from a URL over the network. Also, the process of decoding MP3 files is CPU intensive. If you experience dropouts during playback, you might want to configure mpg123 to downsample or decode in mono rather than in stereo. Use the command mpg123 --longhelp to show the command options for mpg123.

    Elvis comes blasting out of the Yamaha speakers! You can now celebrate your successful configuration, compilation, and test of the Linux USB audio subsystem.

USB Image Capture: Kensington VideoCAM Super-VGA PC Camera

The Kensington VideoCAM is a low-cost USB camera that provides image resolution up to 800x600 pixels. This camera streams video at 24 frames per second. Project Trailblazer doesn't require streaming video merely image capture. The camera's high resolution will provide excellent-quality images for guest and Silverjack use.

There is no Kensington camera option in the USB support of the kernel configuration program, make menuconfig. The engineers didn't know where to start. So they just plugged in the camera, and the console spewed a couple hundred lines of text. Viewing the system log file, the engineers found these informational lines:

 Oct  7 19:54:16 tbdev1 kernel: hub.c: USB new device connect on bus1/2, assigned device  graphics/ccc.gifnumber 4 Oct  7 19:54:16 tbdev1 kernel: Product: VideoCAM Oct  7 19:54:16 tbdev1 kernel: usb.c: USB device 4 (vend/prod 0x47d/0x5003) is not  graphics/ccc.gifclaimed by any active driver 

The vend/prod information provides a key. The engineers researched 0x047D and 0x5003 at the Linux-USB device overview Web site and found that the Kensington camera uses the se401 driver. There's a kernel configuration option for se401 under the USB support menu. In this section, you will perform the following steps on tbdev1:

  1. Configure the kernel for video operation and se401 use. Compile and install the kernel, and then reboot tbdev1.

  2. Connect the Kensington camera.

  3. Download and compile a console-based video frame grabber program called vgrabbj, and then capture a video still image.

TIP

The vendor and product information pair identifies a unique USB device. Designs are often licensed to several companies for production and distribution. For example, two companies may offer USB cameras based on the same hardware design. These cameras are identical from an electrical perspective and can use the same USB device driver. If you can't find driver information for your USB device by name, use the vendor and product information pair.


Configuring the Kernel for Video Operation and se401 Use

To use the Kensington camera, you need to configure and rebuild the kernel with support for video and se401. You need to follow these steps:

  1. Configure the kernel with video and se401 support by using make menuconfig:

     root@tbdev1[553]: cd /usr/src/linux root@tbdev1[554]: make menuconfig 
  2. You need to configure the kernel options for video support. Using the up and down arrow keys, scroll to the Multimedia devices item and press Enter. Select the Video For Linux item and press the spacebar until a * character appears between < > (that is, <*>). Now scroll down to the Video For Linux ---> item and press Enter. With the V4L information in proc filesystem (NEW) item selected, use the spacebar until a * character appears between the [ ] characters (that is, [*]). Select Exit and press Enter. Select Exit and press Enter again. This take you back to the main menu.

  3. Scroll to the USB support item and press Enter. Configure this additional USB support option: <*> USB SE401 Camera support.

    Use the left and right arrows to select Exit, and then press Enter. This takes you back to the main menu.

  4. Use the left and right arrows to select Exit, and then press Enter. When you are asked to save the kernel configuration, select Yes and press Enter.

  5. Build the new kernel by using this command:

     root@tbdev1[555]: make dep; make clean; make bzImage 
  6. When the kernel build completes, copy the kernel image to the /boot directory and run lilo:

     root@tbdev1[556]: cp arch/i386/boot/bzImage /boot/usbtest root@tbdev1[557]: lilo Added Linux * Added usbtest 
  7. Reboot and type usbtest at the lilo boot: prompt. Log in as root.

  8. Mount usbdevfs on /proc/bus/usb by using this command:

     root@tbdev1[505]: mount -t usbdevfs usbdevfs /proc/bus/usb/ 
Connecting the Kensington Camera

Follow these steps to connect the Kensington camera and examine USB information provided by the kernel:

  1. Plug in the camera and check the /proc/bus/usb/devices file:

     root@tbdev1[506]: cat /proc/bus/usb/devices S:  Product=USB UHCI-alt Root Hub S:  SerialNumber=e000 S:  Manufacturer=YAMAHA S:  Product=YAMAHA YST-MS35D USB Speaker S:  SerialNumber=Ser 00 em C:* #Ifs= 3 Cfg#= 1 Atr=40 MxPwr=  0mA I:  If#= 0 Alt= 0 #EPs= 0 Cls=01(audio) Sub=01 Prot=00 Driver=audio P:  Vendor=047d ProdID=5003 Rev=20.50 S:  Product=VideoCAM C:* #Ifs= 1 Cfg#= 1 Atr=80 MxPwr=500mA I:  If#= 0 Alt= 0 #EPs= 2 Cls=00(>ifc ) Sub=00 Prot=00 Driver=se401 . . . some lined delete here. 

    The Linux USB subsystem finds the Kensington VideoCAM and loads the se401 driver. Use of the se401 device driver requires the configuration of the Video For Linux Two subsystem.10 This subsystem creates a /proc directory entry called /proc/video. If you explore that directory, you find these entries:

     root@tbdev1[515]: cd /proc/video/ root@tbdev1[516]: ls dev/  se401/ root@tbdev1[517]: cat /proc/video/dev/video0 name            : Kensington VideoCAM 67016 type            : VID_TYPE_CAPTURE hardware        : 0x1e root@tbdev1[518]: cat /proc/video/se401/video0 driver_version  : 0.23 model           : Kensington VideoCAM 67016 in use          : no streaming       : no button state    : no button pressed  : no num_frames      : 2 Sizes           : 160x120 200x152 176x144 320x240 352x288 400x300 640x480 704x576 800x600 Frames total    : 0 Frames read     : 0 Packets dropped : 0 Decoding Errors : 0 

    That's the camera!

  2. Get an image from the camera. First, you need to check for these video device entries in the /dev directory: video and video0. If they don't exist, you need to create them:

     root@tbdev1[521]: ls -l /dev/video* root@tbdev1[522]: mknod -m 644 /dev/video0 c 81 0 root@tbdev1[522]: ln  s /dev/video0 /dev/video root@tbdev1[527]: ls -l /dev/video* lrwxrwxrwx 1 root root 11 Oct 7 20:42 /dev/video -> /dev/video0 crw-r--r-- 1 root root 81, 0 Oct 7 20:42 /dev/video0 
Downloading and Compiling a Console-Based Video Frame Grabber

If you were to use cat/dev/video0, an RGB image byte stream would fill the monitor with text characters. That wouldn't do you any good. You can use a program called vgrabbj (http://vgrabbj.gecius.de) to convert the RGB byte stream to a JPEG image. vgrabbj allows you to periodically grab an image, overlay a timestamp on the image, and save it in JPEG format. Here are the steps to download, compile, and run vgrabbj:

  1. Get the latest source code for vgrabbj and compile it on tbdev1:

     root@tbdev1[541]: wget http://vgrabbj.gecius.de/ vgrabbj/vgrabbj-latest.tar.gz root@tbdev1[542]: tar zxvf vgrabbj-latest.tar.gz root@tbdev1[543]: cd vgrabbj-0.7.4/ root@tbdev1[549]: ./configure . . . lines removed checking for jpeg_set_defaults in -ljpeg... no configure: error: *** jpeg library not found! Please install the appropriate library *** 

    You can see that tbdev1 is missing some libraries. vgrabbj requires these libraries and their header files: libjpeg, libpng, and freetype. You need to install them on tbdev1 and rerun the vgrabbj configure:

     root@tbdev1[550]: apt-get install libjpeg62-dev root@tbdev1[551]: apt-get install libpng2-dev root@tbdev1[552]: apt-get install freetype2-dev root@tbdev1[553]: ./configure root@tbdev1[556]: make gcc -DHAVE_CONFIG_H -I. -I. -I.     -g -O2 -Wall -c vgrabbj.c gcc -DHAVE_CONFIG_H -I. -I. -I.     -g -O2 -Wall -c font.c gcc -DHAVE_CONFIG_H -I. -I. -I.     -g -O2 -Wall -c ccvt_c.c gcc -g -O2 -Wall -o vgrabbj vgrabbj.o font.o ccvt_c.o -lz -lttf -lpng -lm -ljpeg root@tbdev1[558]: ls -l vgrabbj -rwxr-xr-x 1 root  root   109463 Oct  7 21:23 vgrabbj 
  2. Run vgrabbj to see what you get:

     root@tbdev1[559]: vgrabbj -f /tmp/firstpicture.jpeg Reading image from /dev/video root@tbdev1[560]: ls -l /tmp/firstpicture.jpeg -rw-r--r-- 1 root root 6818 Oct 7 21:24 /tmp/firstpicture.jpeg 

    The result is a JPEG image file in the /tmp directory. tbdev1 doesn't have a JPEG viewer or graphics support, so you have to transfer /tmp/firstpicture.jpeg to another computer to view it. Sure enough, it is a JPEG image file, and it is shown in Figure 8.1.

    Figure 8.1. The vgrabbj image captured from the Kensington VideoCAM Super-VGA USB camera.

    graphics/08fig01.gif

  3. The vgrabbj program has many features, such as text overlays, image timestamping, and an automatic frame-grabbing time interval. This command line best suits the Project Trailblazer Lift 9 settings:

     vgrabbj -e -i vga -f /temp/image.jpg -p "Silverjack Lift 9 Top - %A, %D, %r" -T 20 -a 5  graphics/ccc.gif-m 50 -l 30 

    Table 8.1 explains each of these vgrabbj command-line parameters in more detail.

    Table 8.1. vgrabbj Command-Line Options
    Command-Line option Description
    -e Enables the timestamp
    -i vga Sets the image size to 640x480
    -f Writes to an output file instead of to stdout
    -p Defines the overlay in timestamp format
    -T Sets the overlay font size
    -a Sets the overlay alignment on the image
    -m Sets the overlay blending with the original image
    -l 30 Tells vgrabbj to become a daemon and write an image file every 30 seconds

  4. When you enable vgrabbj's timestamp functionality, you get this error:

     root@tbdev1[566]: vgrabbj -f /tmp/a.jpg -e Reading image from /dev/video Font not found: /usr/share/fonts/truetype/Arialn.ttf, timestamp disabled Could not initialize font-engine 

    The TrueType font file Arialn.ttf is missing. You can transfer that font file from a Windows machine to the /usr/share/fonts/truetype directory. vgrabbj then runs without errors, and it time-stamps the image correctly.

You have now successfully configured, compiled, and tested music playback and image capture. One USB project remains: the image kiosk that uses a SmartMedia card reader.

USB Mass Storage: SanDisk USB SmartMedia Card Reader

Most digital cameras have removable storage media. By using additional memory cards, the user can increase the number of photographs between computer downloads. An image kiosk that transfers and then emails images from memory cards could provide the same result. Besides, guests would love to email their co-workers shots from the slopes with captions like "Having a Great Time!"

The Project Trailblazer engineers selected the SmartMedia memory reader over Compact Flash or Memory Stick primarily because that's what their personal cameras use. This section outlines the tbdev1 configuration steps to read the contents of a SmartMedia card. Linux USB also supports other removal memory readers. See the Linux-USB device overview Web site for more information.4

Kernel version 2.4.10 includes driver source code for the SanDisk USB SmartMedia card reader, model number SDDR-09. USB mass storage device drivers are merely interfaces to the Linux SCSI layer.3 This means that, in addition to USB options, you also need to configure certain SCSI options within the kernel configuration. In this section, you will configure and build a new kernel that will access the USB SmartMedia card reader as a SCSI device. Here are the steps you will perform on tbdev1:

  1. Configure the kernel for SCSI operation and SDDR-09 use. Compile and install the kernel. Then reboot tbdev1.

  2. Connect the SanDisk USB SmartMedia card reader.

  3. Mount and test the card reader operation.

Configuring the Kernel for SCSI Operation and SDDR-09 Use

To use the SanDisk USB SmartMedia card reader, you will need to configure and rebuild the kernel with support for SCSI and SDDR-09. Follow these steps to configure and compile the kernel:

  1. Configure the kernel with SCSI and SDDR-09 support, by using make menuconfig:

     root@tbdev1[553]: cd /usr/src/linux root@tbdev1[554]: make menuconfig 
  2. You need to configure the kernel options for SCSI support. Using the up and down arrow keys, scroll to the SCSI support item and press Enter. Select the SCSI support item and press the spacebar until a * character appears between < > (that is, <*>). Select and configure these three SCSI support items:

    • <*> SCSI support

    • <*> SCSI disk support

    • <*> SCSI generic support

    Select Exit and press Enter. This takes you back to the main menu.

  3. The SDDR-09 driver is considered new. You will not see an option for it in the USB support menu unless you configure the kernel to prompt for development drivers. Using the up and down arrow keys, scroll to the Code Maturity Level options item and press Enter. Select the Prompt for Development and/or Incomplete Code/Drivers item and press the spacebar until a * character appears between < >. Select Exit and press Enter. This takes you back to the main menu.

  4. Configure the USB support options. Using the up and down arrow keys, scroll to the USB support item and press Enter. Configure these USB support items:

    • <*> USB Mass Storage support

    • [*] SanDisk SDDR-09 (and other SmartMedia) support (NEW)

    Select Exit and press Enter. This takes you back to the main menu.

  5. SmartMedia cards use the DOS FAT filesystem. You need to configure the kernel for DOS FAT filesystem support. Using the up and down arrow keys, scroll to the File Systems item and press Enter. Configure these file system items:

    • <*> DOS FAT fs support

    • <*> MSDOS fs support

    Select Exit and press Enter. This takes you back to the main menu.

  6. Use the left and right arrows to select Exit, and then press Enter. When you are asked to save the kernel configuration, select Yes and press Enter.

  7. Build the new kernel by using this command:

     root@tbdev1[555]: make dep; make clean; make bzImage 
  8. When the kernel build completes, copy the kernel image to the /boot directory and run lilo:

     root@tbdev1[556]: cp arch/i386/boot/bzImage /boot/usbtest root@tbdev1[557]: lilo Added Linux * Added usbtest 
  9. Reboot and type usbtest at the lilo boot: prompt. Log in as root.

  10. Mount usbdevfs on /proc/bus/usb, using this command:

     root@tbdev1[501]: mount -t usbdevfs usbdevfs /proc/bus/usb/ 
Connecting the SanDisk USB SmartMedia Card Reader

Follow these steps to connect the SanDisk USB SmartMedia card reader and examine USB information provided by the kernel:

  1. Plug in the SmartMedia card reader and check the /proc/bus/usb/devices file:

     root@tbdev1[508]: cat /proc/bus/usb/devices S:  Product=USB UHCI-alt Root Hub S:  SerialNumber=e000 S:  Manufacturer=YAMAHA S:  Product=YAMAHA YST-MS35D USB Speaker S:  SerialNumber=Ser 00 em S:  Manufacturer=SanDisk S:  Product=USB SSFDC C:* #Ifs= 1 Cfg#= 1 Atr=a0 MxPwr=100mA I:  If#= 0 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=01 Prot=01 Driver=usb-storage 
  2. The USB subsystem finds the SmartMedia card reader, USB SSFDC, and loads the usb-storage driver for it. The /proc directory has several SCSI entries now, and the system log file also contains information:

     root@tbdev1[518]: cat /proc/scsi/scsi Attached devices: Host: scsi0 Channel: 00 Id: 00 Lun: 00   Vendor: Sandisk  Model: ImageMate SDDR-0 Rev: 0208   Type:   Direct-Access                    ANSI SCSI revision: 02 root@tbdev1[519]: cat /proc/scsi/usb-storage-0/0    Host scsi0: usb-storage        Vendor: SanDisk       Product: USB SSFDC Serial Number: None      Protocol: Transparent SCSI     Transport: EUSB/SDDR09          GUID: 078102000000000000000000      Attached: 1 root@tbdev1[523]: tail /var/log/messages Oct 8 00:13:01 tbdev1 kernel: hub.c: USB new device connect on bus1/2, assigned device number 4 Oct 8 00:13:02 tbdev1 kernel: Manufacturer: SanDisk Oct 8 00:13:02 tbdev1 kernel: Product: USB SSFDC Oct 8 00:13:02 tbdev1 kernel: scsi0 : SCSI emulation for USB Mass Storage devices Oct 8 00:13:02 tbdev1 kernel: Vendor: Sandisk Model: ImageMate SDDR-0 Rev: 0208 Oct 8 00:13:02 tbdev1 kernel:   Type: Direct-Access  ANSI SCSI revision: 02 Oct 8 00:13:02 tbdev1 kernel: Attached scsi cremovable disk sda at scsi0, channel 0, id 0, graphics/ccc.gif lun 0 Oct 8 00:13:02 tbdev1 kernel: SCSI device  sda: 32768 512-byte hdwr sectors (17 MB) Oct 8 00:13:02 tbdev1 kernel: sda: Write Protect is on Oct 8 00:13:02 tbdev1 kernel:  sda: sda1 

    This means that a removable SCSI disk partition exists on /dev/sda1.

Mounting and Testing the SanDisk USB SmartMedia Card Reader Operation

Follow these steps to mount the SCSI disk partition, /dev/sda1, and then test the operation of the card reader by copying files from its card to tbdev1:

  1. Mount the removable SCSI partition, remembering that SmartMedia cards contain MS-DOS filesystems:

     root@tbdev1[535]: mount -t msdos /dev/sda1 /mnt mount: block device /dev/sda1 is write-protected, mounting read-only root@tbdev1[536]: ls -lR /mnt /mnt: total 16 drwxr-xr-x  3 root  root   16384 Sep 23 18:08 dcim /mnt/dcim: total 16 drwxr-xr-x  2 root  root   16384 Sep 29 23:04 100olymp /mnt/dcim/100olymp: total 12688 -rwxr-xr-x  1 root  root  416207 Sep 30 13:14 p9301565.jpg -rwxr-xr-x  1 root  root  418108 Sep 30 13:16 p9301566.jpg -rwxr-xr-x  1 root  root  433757 Sep 30 13:18 p9301567.jpg 

    You can see that there is one image directory called dcim/100olymp, and it contains three JPEG image files.

  2. Copy these three JPEG files to the /tmp directory. Use the cmp command to compare the original files on the card to the new files in the /tmp directory:

     root@tbdev1[537]: cp -v /mnt/dcim/100olymp/* /tmp /mnt/dcim/100olymp/p9301565.jpg -> /tmp/p9301565.jpg /mnt/dcim/100olymp/p9301566.jpg -> /tmp/p9301566.jpg /mnt/dcim/100olymp/p9301567.jpg -> /tmp/p9301567.jpg root@tbdev1[538]: cmp /mnt/dcim/100olymp/p9301565.jpg /tmp/p9301565.jpg root@tbdev1[539]: 

    There's no difference between the SmartMedia file /mnt/dcim/100olymp/p9301565.jpg and the copy in the /tmp directory. This proves that the USB SmartMedia card reader is functioning correctly.

    TIP

    The card reader driver may not handle removable media correctly or gracefully. To avoid system problems, unmount the card reader drive with umount/dev/sda1 before removing the storage card.

You have now properly configured, compiled, and tested a USB mass storage device in addition to the music playback and image capture devices.


       
    Top


    Embedded LinuxR. Hardware, Software, and Interfacing
    Embedded LinuxR. Hardware, Software, and Interfacing
    ISBN: N/A
    EAN: N/A
    Year: 2001
    Pages: 103

    flylib.com © 2008-2017.
    If you may any questions please contact us: flylib@qtcs.net