From owner-freebsd-hackers Mon Aug 5 2: 6: 4 2002 Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.FreeBSD.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id DB1C237B400 for ; Mon, 5 Aug 2002 02:05:58 -0700 (PDT) Received: from homer.futureuse.net (c17994.randw1.nsw.optusnet.com.au [210.49.31.95]) by mx1.FreeBSD.org (Postfix) with SMTP id 8B7E643E5E for ; Mon, 5 Aug 2002 02:05:57 -0700 (PDT) (envelope-from fbsdlist@futureuse.net) Received: (qmail 52841 invoked from network); 5 Aug 2002 09:03:54 -0000 Received: from unknown (HELO futureuse.net) (127.0.0.1) by localhost with SMTP; 5 Aug 2002 09:03:54 -0000 Received: from 192.168.60.20 (SquirrelMail authenticated user fbsdlist) by 192.168.60.1 with HTTP; Mon, 5 Aug 2002 19:03:54 +1000 (EST) Message-ID: <1225.192.168.60.20.1028538234.squirrel@192.168.60.1> Date: Mon, 5 Aug 2002 19:03:54 +1000 (EST) Subject: How to modify usb code for unrecognised CDRW? From: "Aaron Hill" To: X-Priority: 3 Importance: Normal X-MSMail-Priority: Normal X-Mailer: SquirrelMail (version 1.2.7) MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG Hello, I posted this earlier to freebsd-questions, it probably should have gone to the hackers list. Please CC me on any answers, I'm not subscribed to this list. I've recently purchased a Benq (used to be part of 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 (CDW 2410MR). 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-hackers" in the body of the message