From e5632de786f9f7dce249e92eccba521c97d9d83d Mon Sep 17 00:00:00 2001 From: Thomas Schmitt Date: Thu, 30 Apr 2009 07:08:23 +0000 Subject: [PATCH] Bug fix: Device scan stalled on FreeBSD. Ticket 148 jwele --- cdrskin/cdrskin_timestamp.h | 2 +- libburn/sg-freebsd.c | 20 +++++++++++++++++--- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/cdrskin/cdrskin_timestamp.h b/cdrskin/cdrskin_timestamp.h index 472d3dc..b67f4be 100644 --- a/cdrskin/cdrskin_timestamp.h +++ b/cdrskin/cdrskin_timestamp.h @@ -1 +1 @@ -#define Cdrskin_timestamP "2009.04.30.065918" +#define Cdrskin_timestamP "2009.04.30.070813" diff --git a/libburn/sg-freebsd.c b/libburn/sg-freebsd.c index 9f232dc..cc5ab4e 100644 --- a/libburn/sg-freebsd.c +++ b/libburn/sg-freebsd.c @@ -1,6 +1,5 @@ /* -*- indent-tabs-mode: t; tab-width: 8; c-basic-offset: 8; -*- */ -#include #include #include #include @@ -553,11 +552,26 @@ int sg_issue_command(struct burn_drive *d, struct command *c) if (c->page) { ccb->csio.data_ptr = c->page->data; if (c->dir == FROM_DRIVE) { - ccb->csio.dxfer_len = BUFFER_SIZE; + + /* ts A90430 : Ticket 148 , by jwehle : + "On ... FreeBSD 6.4 which has a usb memory reader in + addition to a ATAPI DVD burner sg_issue_command + will hang while the SCSI bus is being scanned" + */ + if (c->dxfer_len >= 0) + ccb->csio.dxfer_len = c->dxfer_len; + else + ccb->csio.dxfer_len = BUFFER_SIZE; + /* touch page so we can use valgrind */ memset(c->page->data, 0, BUFFER_SIZE); } else { - assert(c->page->bytes > 0); + /* ts A90430 */ + /* a ssert(c->page->bytes > 0); */ + if (c->page->bytes <= 0) { + c->error = 1; + return 0; + } ccb->csio.dxfer_len = c->page->bytes; } } else {