Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

ports/127608: [patch] sysutils/cdrecord: fix device enumeration via -scanbus

4 views
Skip to first unread message

Eygene Ryabinkin

unread,
Sep 24, 2008, 8:20:39 AM9/24/08
to FreeBSD-gn...@freebsd.org

>Number: 127608
>Category: ports
>Synopsis: [patch] sysutils/cdrecord: fix device enumeration via -scanbus
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: freebsd-ports-bugs
>State: open
>Quarter:
>Keywords:
>Date-Required:
>Class: sw-bug
>Submitter-Id: current-users
>Arrival-Date: Wed Sep 24 12:30:02 UTC 2008
>Closed-Date:
>Last-Modified:
>Originator: Eygene Ryabinkin
>Release: FreeBSD 7.1-PRERELEASE i386
>Organization:
Code Labs
>Environment:

System: FreeBSD XXX 7.1-PRERELEASE FreeBSD 7.1-PRERELEASE #19: Tue Sep 23 13:21:48 MSD 2008 root@XXX:/usr/src/sys/i386/compile/XXX i386

>Description:

With the yesterday's (September 23rd, 2008) FreeBSD 7.1-PRERELEASE I was
unable to use cdrecord (compiled from port sysutils/cdrecord): it was
refusing to open SCSI device:
-----
cdrecord: Invalid argument. Cannot open SCSI driver.
-----

Digged through the code, I had found that the first problem lies in the
bus scanning: it does not set ccb_h.path_id to CAM_XPT_PATH_ID during
the call to the XPT_DEV_MATCH routine of ioctl(CAMIOCOMMAND).

Another problem was in the libcam code that has the simular problem:
it is now filed under bin/127605 and contains the patch.

>How-To-Repeat:

Spawn 'cdrecord -scanbus'. I will output something like
-----
$ cdrecord -scanbus
cdrecord: Invalid argument. CAMIOCOMMAND ioctl failed. Cannot open SCSI driver.
cdrecord: For possible targets try 'cdrecord -scanbus'. Make sure you are root.
cdrecord: For possible transport specifiers try 'cdrecord dev=help'.
Cdrecord-Clone 2.01 (i386-unknown-freebsd7.1) Copyright (C) 1995-2004 J�rg Schilling
-----
My device is the IDE CD/DVD unit PIONEER DVD-RW DVR-108 1.14 emulated
as SCSI device via the atapicam(4) layer. Running this command under
root does not change the things ;))

>Fix:

The following patch fixes the '-scanbus' issue:
--- patch-libscg::scsi-bsd.c begins here ---
--- libscg/scsi-bsd.c.orig 2008-09-24 14:03:04.000000000 +0400
+++ libscg/scsi-bsd.c 2008-09-24 14:04:03.000000000 +0400
@@ -674,6 +674,9 @@
* system.
*/
ccb.ccb_h.func_code = XPT_DEV_MATCH;
+ ccb.ccb_h.path_id = CAM_XPT_PATH_ID;
+ ccb.ccb_h.target_id = CAM_TARGET_WILDCARD;
+ ccb.ccb_h.target_lun = CAM_LUN_WILDCARD;

/*
* Setup the result buffer.
--- patch-libscg::scsi-bsd.c ends here ---
I am not very much sure that one should set target_id and target_lun as
well (without these XPT_DEV_MATCH works too), but these fields are set
in the FreeBSD's camcontrol(8) utility when it performs enumeration, so
I think that these will not hurt, at least on FreeBSD.

In order to successfully burn images with cdrecord I also need the patch
for libcam, as described in bin/127605. With these two, burning works
without any noticed problems: CD-R and CD-RW disks are toasted fine.

For the record: latest cdrecord alpha from
ftp://ftp.berlios.de/pub/cdrecord/alpha/cdrtools-2.01.01a49.tar.bz2
still misses the ccb_h.path_id manipulations.
>Release-Note:
>Audit-Trail:
>Unformatted:

0 new messages