NetBSD Problem Report #41043

From jmcneill@black.invisible.ca  Thu Mar 19 15:46:31 2009
Return-Path: <jmcneill@black.invisible.ca>
Received: from mail.netbsd.org (mail.netbsd.org [204.152.190.11])
	by www.NetBSD.org (Postfix) with ESMTP id 8146D63B8EC
	for <gnats-bugs@gnats.NetBSD.org>; Thu, 19 Mar 2009 15:46:31 +0000 (UTC)
Message-Id: <20090319154630.56F817D875B@black.invisible.ca>
Date: Thu, 19 Mar 2009 11:46:30 -0400 (EDT)
From: jmcneill@invisible.ca
Reply-To: jmcneill@invisible.ca
To: gnats-bugs@gnats.NetBSD.org
Subject: brasero-2.26.0's scsi-netbsd driver does not work
X-Send-Pr-Version: 3.95

>Number:         41043
>Category:       pkg
>Synopsis:       brasero-2.26.0's scsi-netbsd driver does not work
>Confidential:   no
>Severity:       critical
>Priority:       high
>Responsible:    pkg-manager
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu Mar 19 15:50:00 +0000 2009
>Closed-Date:    Sun Mar 22 09:30:54 +0000 2009
>Last-Modified:  Sun Mar 22 09:35:01 +0000 2009
>Originator:     Jared D. McNeill
>Release:        NetBSD 5.99.7
>Organization:

>Environment:


System: NetBSD black.invisible.ca 5.99.7 NetBSD 5.99.7 (GENERIC) #75: Mon Mar 9 08:19:45 EDT 2009 jmcneill@black.invisible.ca:/export/home/jmcneill/branches/HEAD/src/sys/arch/amd64/compile/GENERIC amd64
Architecture: x86_64
Machine: amd64
>Description:

When trying to burn a CD with brasero-2.26.0, the scsi-netbsd driver continually fails with:

(brasero:25684): BraseroMedia-DEBUG: At brasero-drive.c:831: Contents changed
(brasero:25684): BraseroMedia-DEBUG: At brasero-drive.c:846: Medium inserted
(brasero:25684): BraseroMedia-DEBUG: At brasero-medium.c:2967: Trying to open device /dev/cd0d
(brasero:25684): BraseroMedia-DEBUG: At brasero-medium.c:2988: Open () succeeded
(brasero:25684): BraseroMedia-DEBUG: At scsi-netbsd.c:116: SCSI command error: Invalid argument
(brasero:25684): BraseroMedia-DEBUG: At scsi-netbsd.c:116: SCSI command error: Invalid argument
(brasero:25684): BraseroMedia-DEBUG: At scsi-netbsd.c:116: SCSI command error: Invalid argument
(brasero:25684): BraseroMedia-DEBUG: At scsi-netbsd.c:116: SCSI command error: Invalid argument
(brasero:25684): BraseroMedia-DEBUG: At scsi-netbsd.c:116: SCSI command error: Invalid argument
[...]

EINVAL is coming from scsipi because scsireq->timeout == 0. Brasero should also communicate with /dev/rcd0d instead of /dev/cd0d, so the attached patch fixes that as well.

>How-To-Repeat:

>Fix:

Index: Makefile
===================================================================
RCS file: /cvsroot/pkgsrc/sysutils/brasero/Makefile,v
retrieving revision 1.1.1.1
diff -u -p -r1.1.1.1 Makefile
--- Makefile	16 Mar 2009 10:49:06 -0000	1.1.1.1
+++ Makefile	19 Mar 2009 15:42:44 -0000
@@ -2,6 +2,7 @@
 #

 DISTNAME=	brasero-2.26.0
+PKGREVISION=	1
 CATEGORIES=	sysutils gnome
 MASTER_SITES=	${MASTER_SITE_GNOME:=sources/brasero/2.26/}
 EXTRACT_SUFX=	.tar.bz2
Index: files/scsi-netbsd.c
===================================================================
RCS file: /cvsroot/pkgsrc/sysutils/brasero/files/scsi-netbsd.c,v
retrieving revision 1.1.1.1
diff -u -p -r1.1.1.1 scsi-netbsd.c
--- files/scsi-netbsd.c	16 Mar 2009 10:49:06 -0000	1.1.1.1
+++ files/scsi-netbsd.c	19 Mar 2009 15:42:44 -0000
@@ -67,7 +67,8 @@ typedef struct _BraseroScsiCmd BraseroSc
 #define BRASERO_SCSI_CMD_OPCODE_OFF			0
 #define BRASERO_SCSI_CMD_SET_OPCODE(command)		(command->cmd [BRASERO_SCSI_CMD_OPCODE_OFF] = command->info->opcode)

-#define OPEN_FLAGS			O_RDWR /*|O_EXCL */|O_NONBLOCK
+#define OPEN_FLAGS			(O_RDWR|O_NONBLOCK)
+#define SCSIREQ_TIMEOUT			(30 * 1000)

 /**
  * This is to send a command
@@ -85,6 +86,7 @@ brasero_sg_command_setup (scsireq_t *req
 	memcpy(req->cmd, cmd->cmd, req->cmdlen);
 	req->databuf = buffer;
 	req->datalen = size;
+	req->timeout = SCSIREQ_TIMEOUT;

 	/* where to output the scsi sense buffer */
 	req->senselen = BRASERO_SENSE_DATA_SIZE;
@@ -112,7 +114,7 @@ brasero_scsi_command_issue_sync (gpointe
 				  size);

 	res = ioctl (cmd->handle->fd, SCIOCCOMMAND, &req);
-	if (res) {
+	if (res == -1) {
 		BRASERO_SCSI_SET_ERRCODE (error, BRASERO_SCSI_ERRNO);
 		return BRASERO_SCSI_FAILURE;
 	}
@@ -162,11 +164,14 @@ brasero_device_handle_open (const gchar 
 	int fd;
 	int flags = OPEN_FLAGS;
 	BraseroDeviceHandle *handle;
+	gchar *rdevnode;

 	if (exclusive)
 		flags |= O_EXCL;

-	fd = open (path, flags);
+	rdevnode = g_strdup_printf ("/dev/r%s", path + strlen ("/dev/"));
+	fd = open (rdevnode, flags);
+	g_free (rdevnode);
 	if (fd < 0) {
 		if (code) {
 			if (errno == EAGAIN

>Release-Note:

>Audit-Trail:
From: "OBATA Akio" <obache@netbsd.org>
To: gnats-bugs@netbsd.org
Cc: 
Subject: Re: pkg/41043: brasero-2.26.0's scsi-netbsd driver does not work
Date: Fri, 20 Mar 2009 16:44:52 +0900

 This package was imported by yourself and you are copyright holder of the driver file.
 Why not commit by yourself?  Or what type of response do you expect?

State-Changed-From-To: open->closed
State-Changed-By: wiz@NetBSD.org
State-Changed-When: Sun, 22 Mar 2009 09:30:54 +0000
State-Changed-Why:
Applied, thank you!


From: Thomas Klausner <wiz@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/41043 CVS commit: pkgsrc/sysutils/brasero
Date: Sun, 22 Mar 2009 09:30:39 +0000

 Module Name:	pkgsrc
 Committed By:	wiz
 Date:		Sun Mar 22 09:30:39 UTC 2009

 Modified Files:
 	pkgsrc/sysutils/brasero: Makefile
 	pkgsrc/sysutils/brasero/files: scsi-netbsd.c

 Log Message:
 Fix CD burning handling on NetBSD. From Jared McNeill in PR 41043.
 Bump PKGREVISION.


 To generate a diff of this commit:
 cvs rdiff -u -r1.2 -r1.3 pkgsrc/sysutils/brasero/Makefile
 cvs rdiff -u -r1.1.1.1 -r1.2 pkgsrc/sysutils/brasero/files/scsi-netbsd.c

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.51 2026/08/10 02:28:17 riastradh Exp $
$NetBSD: gnats_config.sh,v 1.10 2026/05/13 22:00:09 riastradh Exp $
Copyright © 1994-2026 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.