当前位置:Linux教程 - Linux - USB-CD Writer HOWTO

USB-CD Writer HOWTO



        
    USB-CD Writer HOWTO

    内容: 如何在linux下使用 HP CD-Writer Plus 8210e (USB-接口)刻录机
    作者: Thomas Jaeger 翻译SuperStar
    Email: <[email protected]>
    Version: V1.1


    目录
    1.0 介绍
    1.1 先决条件
    1.2 第一步
    1.3 给Linux做准备工作
    1.4 下面的步骤
    1.5 试一下热插拔
    1.6 测试
    1.7 准备好了吗?刻录了
    1.8 链接

    1.0 介绍
    这是一篇详细描述如何在linux下安装使用HP CD-Writer Plus 8210e(USB-interface)这个刻录机的文章。你会看到所有安装所必须
    的步骤。

    1.1 先决条件
    a. linux内核 >=V2.4.0-test8
    b. cdrecord V1.10a4 (http://www.fokus.gmd.de/research/cc/glone/employees/joerg.schilling/private/cdrecord.html)
    c. usbmgr V0.3.5 (http://www.wonder.ne.jp/~shuu/usbmgr/)
    d. modutils-2.3.15 或者更新的版本 (非常重要!)
    e. 装有HP CD-Writer Plus 8210e刻录机的电脑

    1.2 第一步
    请先查看你的BIOS里面的设置,看是否已经允许使用usb接口。如果你用同一台电脑,并且在MS Win下面可以正常得使用这个刻录机,
    那你可以省去检查BIOS这一步。

    1.3 给Linux做准备工作
    你必须对编译和升级内核100%的熟悉。如果你对此是个新手的话,那你要当心。因为你可能造成旧内核的丢失或者不能引导等问题。
    我建议使用模块化的内核配置,因此你要对"insmod","lsmod","modprobe","depmod"等命令非常的熟悉。

    1.3.1 menuconfig
    下面的是我配置内核时所选的选项:
    Code maturity level options -->-
    [*] Prompt for development and/or incomplete code/drivers
    Loadable module support --->
    [*] Enable loadable module support
    [*] Set version information on all module symbols
    [*] Kernel module loader
    Block devices --->
    Loopback device support
    SCSI support --->
    SCSI support
    SCSI disk support
    SCSI CD-ROM support
    [*] Enable vendor-specific extensions (for SCSI CDROM)
    (2) Maximum number of CDROM devices that can be loaded as modules
    SCSI generic support
    [*] Enable extra checks in new queueing code
    [*] Verbose SCSI error reporting (kernel size +=12K)
    [*] SCSI logging facility
    SCSI low-level drivers --->
    deactivate any SCSI-Device you don have!
    File systems --->
    ISO 9660 CDROM file system support
    [*] Microsoft Joliet CDROM extensions
    [*] /proc file system support
    UDF file system support (read only)
    USB support --->
    Support for USB
    [*] USB verbose debug messages
    [*] Preliminary USB device filesystem
    [*] Enforce USB bandwidth allocation (EXPERIMENTAL)
    --- USB Controllers
    UHCI (Intel PIIX4, VIA, ...) support
    <> OHCI (Compaq, iMacs, OPTi, SiS, ALi, ...) support
    Select the correct USB Controller for your System!!!!!!
    USB Mass Storage support

    这些就是所以和配置使用我的HP CD-Writer Plus 8210e刻录机有关的选项。我用的是V2.4.0-test8的内核。
    编译的时候会有大量的编译调试信息,如果正常的话他们可以不管他们,但如果发生问题的时候,他们可以帮助你查找的原因。
    再次警告:如果你对配置和安装新内核不是很熟悉的话建议要当心,这样是有一定风险的。

    1.3.2安装模块
    当你的新内核和模块编译完成后,你会在modules目录下面发现下面这些模块文件:
    cd /lib/modules/2.4.0-test8
    cd kernel
    ls fs/isofs
    isofs.o
    ls drivers/cdrom
    cdrom.o
    ls drivers/scsi
    scsi_mod.o sd.o sg.o sr_mod.o
    ls drivers/usb
    storage usb-uhci.o usbcore.o
    ls drivers/usb/storage
    usb-storage.o

    重新启动!

    1.4 下面的步骤
    下载usbmgr包,解压缩并阅读README文件。在解压后的目录里用make进行编译。然后make install。现在我们配置usbmgr的
    配置文件usbmgr.conf,它放在/etc/usbmgr目录下。编辑这个文件,进行下面几步:
    a) 去掉在HOST CONTROLLER这节里面的某个host选项前面的注释符"#".在我的计算机上是这样设置的: host usb-uhci
    b) 把下面三行加到STORAGE一节里的vendor 0x3f0 product 0x107这个模块的最后。
    scsi_mod, sr_mod, usb-storage
    现在你要运行"update_usbdb"这个命令:update_usedb usbmgr.conf
    接下去运行"usbmgr"命令。这个命令在后台执行,所以你看不到任何结果输出。但是你可以通过查看messages文件来查看运行情况:
    tail -n50 /var/log/messages
    正常的输出应该像这样的:
    Sep 15 12:55:28 usbmgr[326]: start 0.3.5
    Sep 15 12:55:28 usbmgr[328]: open error "/etc/usbmgr/preload.conf"
    Sep 15 12:55:28 kernel: usb.c: registered new driver usbdevfs
    Sep 15 12:55:28 kernel: usb.c: registered new driver hub
    Sep 15 12:55:28 kernel: usb-uhci.c: $Revision: 1.237 $ time 11:07:02 Sep 10 2000
    Sep 15 12:55:28 kernel: usb-uhci.c: High bandwidth mode enabled
    Sep 15 12:55:28 kernel: usb-uhci.c: USB UHCI at I/O 0xfce0, IRQ 10
    Sep 15 12:55:28 kernel: usb-uhci.c: Detected 2 ports
    Sep 15 12:55:28 kernel: usb.c: new USB bus registered, assigned bus number 1
    Sep 15 12:55:28 kernel: usb.c: USB new device connect, assigned device number 1
    Sep 15 12:55:28 kernel: usb.c: kmalloc IF c2e1f760, numif 1
    Sep 15 12:55:28 kernel: usb.c: new device strings: Mfr=0, Product=2, SerialNumber=1
    Sep 15 12:55:28 kernel: usb.c: USB device number 1 default language ID 0x0
    Sep 15 12:55:28 kernel: Product: USB UHCI Root Hub
    Sep 15 12:55:28 kernel: SerialNumber: fce0
    Sep 15 12:55:28 kernel: hub.c: USB hub found
    Sep 15 12:55:28 kernel: hub.c: 2 ports detected
    Sep 15 12:55:28 kernel: hub.c: ganged power switching
    Sep 15 12:55:28 kernel: hub.c: standalone hub
    Sep 15 12:55:28 kernel: hub.c: global over-current protection
    Sep 15 12:55:28 kernel: hub.c: power on to power good time: 2ms
    Sep 15 12:55:28 kernel: hub.c: hub controller current requirement: 0mA
    Sep 15 12:55:28 kernel: hub.c: port 1 is removable
    Sep 15 12:55:28 kernel: hub.c: port 2 is removable
    Sep 15 12:55:28 kernel: hub.c: local power source is good
    Sep 15 12:55:28 kernel: hub.c: no over-current condition exists
    Sep 15 12:55:28 kernel: hub.c: enabling power on all ports
    Sep 15 12:55:28 kernel: usb.c: hub driver claimed interface c2e1f760
    Sep 15 12:55:28 kernel: usb.c: kusbd: /sbin/hotplug add 1
    Sep 15 12:55:28 kernel: usb.c: kusbd policy returned 0x0
    Sep 15 12:55:28 usbmgr[328]: "usb-uhci" was loaded
    Sep 15 12:55:28 usbmgr[332]: mount /proc/bus/usb
    Sep 15 12:55:28 usbmgr[328]: USB device is matched the configuration
    Sep 15 12:55:28 usbmgr[328]: "none" isn loaded

    这里还有两个文件需要查看:
    a) cat /proc/interrupts

    CPU0
    0: 991954 XT-PIC timer
    1: 19880 XT-PIC keyboard
    2: 0 XT-PIC cascade
    8: 2 XT-PIC rtc
    9: 14 XT-PIC Cirrus Logic PD 6832, Cirrus Logic PD 6832 (#2)
    10: 42 XT-PIC usb-uhci
    12: 243881 XT-PIC PS/2 Mouse
    13: 0 XT-PIC fpu
    14: 16314 XT-PIC ide0
    NMI: 0
    ERR: 0

    结果:可以看到usb-uchi已经起来了,并且被分配了一个中断:这里是:int10

    b) lsmod

    usb-uhci 21708 0 (unused)
    usbcore 49856 1 [usb-uhci]
    nfsd 69928 4 (autoclean)
    lockd 49340 1 (autoclean) [nfsd]
    sunrpc 58244 1 (autoclean) [nfsd lockd]
    unix 14372 37 (autoclean)

    结果:模块"usb-uhci"和"usbcore"应该在这里罗列。

    1.5. 试一下热插拔
    把带电的HP CD-Writer Plus 8210e 刻录机插到你主机的USB接口上。这样就会触动usbmgr程序来引导必须的模块。让我们
    先查看一下:tail -n50 /var/log/messages。新的输出应该是报告热插拔这个事件的,所以显示像下面这样:
    Sep 15 13:13:07 kernel: hub.c: port 1 connection change
    Sep 15 13:13:07 kernel: hub.c: portstatus 101, change 1, 12 Mb/s
    Sep 15 13:13:08 kernel: hub.c: portstatus 103, change 0, 12 Mb/s
    Sep 15 13:13:08 kernel: usb.c: USB new device connect, assigned device number 2
    Sep 15 13:13:08 kernel: usb.c: kmalloc IF c2e1f660, numif 1
    Sep 15 13:13:08 kernel: usb.c: new device strings: Mfr=1, Product=2, SerialNumber=0
    Sep 15 13:13:08 kernel: usb.c: USB device number 2 default language ID 0x409
    Sep 15 13:13:08 kernel: Manufacturer: Shuttle Technology Inc.
    Sep 15 13:13:08 kernel: Product: HP USB CD-Writer Plus
    Sep 15 13:13:08 kernel: usb.c: unhandled interfaces on device
    Sep 15 13:13:08 kernel: usb.c: USB device 2 (prod/vend 0x3f0/0x107) is not claimed [..]
    Sep 15 13:13:08 kernel: Length = 18
    Sep 15 13:13:08 kernel: DescriptorType = 01
    Sep 15 13:13:08 kernel: USB version = 1.00
    Sep 15 13:13:08 kernel: Vendor:Product = 03f0:0107
    Sep 15 13:13:08 kernel: MaxPacketSize0 = 64
    Sep 15 13:13:08 kernel: NumConfigurations = 1
    Sep 15 13:13:08 kernel: Device version = 2.00
    Sep 15 13:13:08 kernel: Device Class:SubClass:Protocol = 00:00:00
    Sep 15 13:13:08 kernel: Per-interface classes
    Sep 15 13:13:08 kernel: Configuration:
    Sep 15 13:13:08 kernel: bLength = 9
    Sep 15 13:13:08 kernel: bDescriptorType = 02
    Sep 15 13:13:08 kernel: wTotalLength = 0027
    Sep 15 13:13:08 kernel: bNumInterfaces = 01
    Sep 15 13:13:08 kernel: bConfigurationValue = 01
    Sep 15 13:13:08 kernel: iConfiguration = 03
    Sep 15 13:13:08 kernel: bmAttributes = 40
    Sep 15 13:13:08 kernel: MaxPower = 0mA
    Sep 15 13:13:08 kernel:
    Sep 15 13:13:08 kernel: Interface: 0
    Sep 15 13:13:08 kernel: Alternate Setting: 0
    Sep 15 13:13:08 kernel: bLength = 9
    Sep 15 13:13:08 kernel: bDescriptorType = 04
    Sep 15 13:13:08 kernel: bInterfaceNumber = 00
    Sep 15 13:13:08 kernel: bAlternateSetting = 00
    Sep 15 13:13:08 kernel: bNumEndpoints = 03
    Sep 15 13:13:08 kernel: bInterface Class:SubClass:Protocol = ff:00:00
    Sep 15 13:13:08 kernel: iInterface = 04
    Sep 15 13:13:08 kernel: Endpoint:
    Sep 15 13:13:08 kernel: bLength = 7
    Sep 15 13:13:08 kernel: bDescriptorType = 05
    Sep 15 13:13:08 kernel: bEndpointAddress = 01 (out)
    Sep 15 13:13:08 kernel: bmAttributes = 02 (Bulk)
    Sep 15 13:13:08 kernel: wMaxPacketSize = 0040
    Sep 15 13:13:08 kernel: bInterval = 00
    Sep 15 13:13:08 kernel: Endpoint:
    Sep 15 13:13:08 kernel: bLength = 7
    Sep 15 13:13:08 kernel: bDescriptorType = 05
    Sep 15 13:13:08 kernel: bEndpointAddress = 82 (in)
    Sep 15 13:13:08 kernel: bmAttributes = 02 (Bulk)
    Sep 15 13:13:08 kernel: wMaxPacketSize = 0040
    Sep 15 13:13:08 kernel: bInterval = 00
    Sep 15 13:13:08 kernel: Endpoint:
    Sep 15 13:13:08 kernel: bLength = 7
    Sep 15 13:13:08 kernel: bDescriptorType = 05
    Sep 15 13:13:08 kernel: bEndpointAddress = 83 (in)
    Sep 15 13:13:08 kernel: bmAttributes = 03 (Interrupt)
    Sep 15 13:13:08 kernel: wMaxPacketSize = 0002
    Sep 15 13:13:08 kernel: bInterval = 20
    Sep 15 13:13:08 kernel: usb.c: kusbd: /sbin/hotplug add 2
    Sep 15 13:13:08 kernel: usb.c: kusbd policy returned 0x0
    Sep 15 13:13:08 usbmgr[328]: USB device is matched the configuration
    Sep 15 13:13:08 kernel: usb.c: registered new driver usb-storage
    Sep 15 13:13:08 kernel: scsi0 : SCSI emulation for USB Mass Storage devices
    Sep 15 13:13:08 kernel: scsi : 1 host.
    Sep 15 13:15:55 kernel: Vendor: HP Model: CD-Writer+ 8200 Rev: 1.0f
    Sep 15 13:15:55 kernel: Type: CD-ROM ANSI SCSI revision: 02
    Sep 15 13:15:55 kernel: Detected scsi CD-ROM sr0 at scsi0, channel 0, id 0, lun 0
    Sep 15 13:15:55 kernel: sr0: scsi3-mmc drive: 8x/24x writer cd/rw xa/form2 cdda tray
    Sep 15 13:15:55 kernel: Uniform CD-ROM driver Revision: 3.11
    Sep 15 13:13:08 kernel: WARNING: USB Mass Storage data integrity not assured
    Sep 15 13:13:08 kernel: USB Mass Storage device found at 2
    Sep 15 13:13:08 kernel: usb.c: usb-storage driver claimed interface c2e1f660
    Sep 15 13:13:08 kernel: USB Mass Storage support registered.
    Sep 15 13:13:08 usbmgr[328]: "scsi_mod" was loaded
    Sep 15 13:13:08 usbmgr[328]: "sr_mod" was loaded
    Sep 15 13:13:08 usbmgr[328]: "usb-storage" was loaded

    请先检查这行:USB device 2 (prod/vend 0x3f0/0x107)...,如果你得到的是同样的ID号(0x3f0/0x107),那就说明你安装
    的是HP8210e,如果你得到的ID是(0x3f0/0x207),那么说明你安装的是HP8230e,它还没有被支持。
    下面的12行十分重要。在"scsi: 1 host:"之后显示的是这个刻录机的有关信息。
    "Detected scsi CD-ROM sr0 at scsi0, channel 0, id 0, lun 0"这行告诉你你的刻录机已经被系统发现,并且设备名称是
    /dev/sr0。在其他的linux版本里可能会是/dev/scd0。这两个是没有区别的。看messages文件里面显示的什么就是什么了。
    可能是我的电脑太旧了,有的时候这个过程不一定成功,如果你发现信息里面没有出现供应商的名称,那你就需要重新插拔一次。两三次
    后应该就没有问题了。

    1.6 测试
    初次的测试可以是放一张普通的光盘到刻录机里,然后mount上去:mount -r -t iso9660 /dev/sr0。
    接下去就是测试刻录了:(cdrtools-1.10a04 这个包应该事先已经装好),用cdrecord -scanbus 可以查看刻录机信息:
    Cdrecord 1.10a04 (i586-pc-linux-gnu) Copyright (C) 1995-2000 J??Schilling
    Linux sg driver version: 3.1.16
    Using libscg version schily-0.4
    scsibus0:
    0,0,0 0) HP CD-Writer+ 8200 1.0f Removable CD-ROM
    0,1,0 1) *
    0,2,0 2) *
    0,3,0 3) *
    0,4,0 4) *
    0,5,0 5) *
    0,6,0 6) *
    0,7,0 7) *
    如果想看更多的信息,可以用:cdrecord -prcap -inq dev=0,0,0 返回的是:
    Cdrecord 1.10a04 (i586-pc-linux-gnu) Copyright (C) 1995-2000 J??Schilling
    scsidev: ,0,0
    scsibus: 0 target: 0 lun: 0
    Linux sg driver version: 3.1.16
    Using libscg version schily-0.4
    Device type : Removable CD-ROM
    Version : 2
    Response Format: 1
    Vendor_info : HP
    Identifikation : CD-Writer+ 8200
    Revision : 1.0f
    Device seems to be: Generic mmc CD-RW.
    Drive capabilities, per page 2A:
    Does read CD-R media
    Does write CD-R media
    Does read CD-RW media
    Does write CD-RW media
    Does not read DVD-ROM media
    Does not read DVD-R media
    Does not write DVD-R media
    Does not read DVD-RAM media
    Does not write DVD-RAM media
    Does support test writing
    Does read Mode 2 Form 1 blocks
    Does read Mode 2 Form 2 blocks
    Does read digital audio blocks
    Does restart non-streamed digital audio reads accurately
    Does not support BURN-Proof (Sanyo)
    Does read multi-session CDs
    Does read fixed-packet CD media using Method 2
    Does not read CD bar code
    Does not read R-W subcode information
    Does read raw P-W subcode data from lead in
    Does return CD media catalog number
    Does return CD ISRC information
    Does not support C2 error pointers
    Does not deliver composite A/V data
    Does play audio CDs
    Number of volume control levels: 256
    Does support individual volume control setting for each channel
    Does support independent mute setting for each channel
    Does not support digital output on port 1
    Does not support digital output on port 2
    Loading mechanism type: tray
    Does support ejection of CD via START/STOP command
    Does not lock media on power up via prevent jumper
    Does allow media to be locked in the drive via PREVENT/ALLOW command
    Is not currently in a media-locked state
    Does not support changing side of disk
    Does not have load-empty-slot-in-changer feature
    Does not support Individual Disk Present feature
    Maximum read speed in kB/s: 4234
    Current read speed in kB/s: 4234
    Maximum write speed in kB/s: 706
    Current write speed in kB/s: 706
    Buffer size in KB: 2048

    现在我们准备刻录了。我用的是cdrtools-1.10a04软件包。当然事先要看一下README文件。做的第一个测试是:(先放一张新的刻录盘)
    mkisofs -L -l -J -r file1 file2 dir1 dir2 | cdrecord -v -pad -eject -dummy -nofix fs=4m speed=4 dev=0,0,0 -
    这个命令把file1,file2,dir1,dir2做成一个iso9660格式的镜像文件,它使用了-J,-r参数,并通过管道直接传给cdrecord程序。
    cdrecord程序会按照冗余模式测试写完整个光盘。但这个只是测试,并没有真正的写到刻录盘上。这个命令使用了4M的RAM作为buff,
    并使用了4速刻录,使用的设备是scsi-device 0,0,0.请注意最后的那个破折号"-",它告诉cdrecord数据是来自于管道的。请查看这个
    测试刻录是不是有问题。请记住一点:一张光盘的最大容量是650M,在你刻录前请先查看要刻录的容量。

    真正的刻录命令应该是:
    mkisofs -L -l -J -r file1 file2 dir1 dir2 | cdrecord -v -pad -eject fs=4m speed=4 dev=0,0,0 -
    你要把-dummy -nofix 这两个参数去掉。
    如果你用新的CD-RW光盘就需要用下面这个命令:
    mkisofs -L -l -J -r file1 file2 dir1 dir2 | cdrecord -v -pad -eject blank=fast fs=4m speed=4 dev=0,0,0 -
    这个命令中的blank=fast参数将把CD-RW上的数据全部抹去,所以要当心使用。还要注意:千万不要在刻录的时候进行热插拔。
    这样会造成光盘甚至你的linux系统的破坏。所以记住在拔掉前一定要先取出光盘,以防万一。

    1.8 链接
    Linux USB-ProjectLinux-CD-Writing-HOWTO



    发布人:superstar 来自: