Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 5 Aug 2002 15:46:12 +1000 (EST)
From:      "Aaron Hill" <fbsdlist@futureuse.net>
To:        <questions@freebsd.org>
Subject:   How to modify usb code for unrecognised CDRW?
Message-ID:  <37906.203.11.225.5.1028526372.squirrel@www.futureuse.net>

next in thread | raw e-mail | index | archive | help
Hello,

I've recently got a Benq (used to be called Acer) portable CDRW drive, it
connects to the system via USB 1.1 or 2.0. Here's a rough link to the
product ...

http://www.benq.com.au/products/cdrw_index.htm

... mine is the 24x10x32 model.

A 4.6-STABLE machine will only see the device as a generic USB device -
ugen0. So I've jumped into modifying the FreeBSD USB code to get it to
work as a umass device. Here's what I've done ...

# pwd
/usr/src/sys/dev/usb

# diff -u usbdevs.org46 usbdevs
--- usbdevs.org46       Mon Aug  5 10:37:42 2002
+++ usbdevs     Mon Aug  5 10:42:23 2002
@@ -385,6 +385,7 @@
 product ACERP ACERSCAN_320U    0x2022  Acerscan 320U
 product ACERP ACERSCAN_640U    0x2040  Acerscan 640U
 product ACERP ACERSCAN_620U    0x2060  Acerscan 620U
+product ACERP ACERCRW_2410     0x6003  AcerCRW 2410

 /* ActiveWire, Inc. products */
 product ACTIVEWIRE IOBOARD     0x0100  I/O Board


# diff -u umass.c.org46 umass.c
--- umass.c.org46       Mon Aug  5 11:01:30 2002
+++ umass.c     Mon Aug  5 15:27:26 2002
@@ -152,6 +152,7 @@
 #define UMASS_DEFAULT_TRANSFER_SPEED   150     /* in kb/s, conservative
est. */
 #define UMASS_FLOPPY_TRANSFER_SPEED    20
 #define UMASS_ZIP100_TRANSFER_SPEED    650
+#define UMASS_CD32X_TRANSFER_SPEED     4800

 #define UMASS_TIMEOUT                  5000 /* msecs */

@@ -278,6 +279,8 @@
 #      define ZIP_250                  2
 #      define SHUTTLE_EUSB             3
 #      define INSYSTEM_USBCABLE        4
+#      define ACER_CRW2410             5
+

        unsigned char           quirks;
        /* The drive does not support Test Unit Ready. Convert to
@@ -577,6 +580,18 @@
        sc->transfer_speed = UMASS_DEFAULT_TRANSFER_SPEED;

        dd = usbd_get_device_descriptor(udev);
+
+       /* Acer / Benq 2410 External CDRW drive */
+       if (UGETW(dd->idVendor) == USB_VENDOR_ACERP
+           && UGETW(dd->idProduct) == USB_PRODUCT_ACERP_ACERCRW_2410) {
+               sc->drive = ACER_CRW2410;
+               sc->proto = PROTO_SCSI;
+               /* sc->proto = PROTO_ATAPI; */
+               /* sc->proto = PROTO_ATAPI | PROTO_CBI; */
+               /* sc->quirks = 0; */
+               sc->transfer_speed = UMASS_CD32X_TRANSFER_SPEED;
+               return(UMATCH_VENDOR_PRODUCT);
+       }

 #if 0
        /* XXX ATAPI support is untested. Don't use it for the moment */



I can roughly see what I should be doing but obviously I'm not doing it
correctly. As you can see in the umass.c code I've experiment with running
the SCSI protocol, the ATAPI protocol and a few other variations including
quirks, transfer speeds etc.

I have remade the make file as per the instructions in the top of usbdevs ...

 *      # edit usbdevs
 *      make -f Makefile.usbdevs



What happens when the machine runs my modified USB code is I get a "Fatal
trap 12" error, "interrupt mask = cam" after the usbd daemon picks up the
device as umass0. This happens if I leave the device connected to the
machine when I reboot or if I plug it in after the system boots up. The
machine has both a USB 1.1 (onboard) controller and a USB 2.0 (add on
card) controller - the trap happens with the device attached to either
controller.

I've got the relevant ATAPI, USB and SCSI bits in my kernel config file ...

# ATA and ATAPI devices
device          ata0    at isa? port IO_WD1 irq 14
device          ata1    at isa? port IO_WD2 irq 15
device          ata
device          atadisk                 # ATA disk drives
device          atapicd                 # ATAPI CDROM drives
device          atapifd                 # ATAPI floppy drives
options         ATA_STATIC_ID           #Static device numbering

# SCSI options
device          scbus                   #base SCSI code
device          ch                      #SCSI media changers
device          da                      #SCSI direct access devices (aka
disks)
device          cd                      #SCSI CD-ROMs
device          pass                    #CAM passthrough driver
device          pt                      #SCSI processor type

# USB support
device          uhci            # UHCI controller
device          ohci            # OHCI controller
device          usb             # General USB code (mandatory for USB)
device          ugen            # Generic USB device driver
device          uhid    # Human Interface Device (anything with buttons
and dials)
device          umass           # USB Iomega Zip 100 Drive (Requires scbus
and da)



Help!


Can anyone help with suggestions on what I should be coding? If you have
any codes diffs for similar devices (CDRW's or plain CDRs) I'd love to see
them. I feel like I'm close but there's obviously something I'm missing.

Maybe the device has a few quirks I need to have in umass.c  - if so, how
would I find what they are?


Thanks for anything you can offer.

Aaron




To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?37906.203.11.225.5.1028526372.squirrel>