From owner-freebsd-gnome@FreeBSD.ORG Sun Feb 3 16:16:05 2008 Return-Path: Delivered-To: gnome@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A4A5A16A468 for ; Sun, 3 Feb 2008 16:16:05 +0000 (UTC) (envelope-from kabaev@gmail.com) Received: from hs-out-2122.google.com (hs-out-0708.google.com [64.233.178.245]) by mx1.freebsd.org (Postfix) with ESMTP id 4DC3413C4EE for ; Sun, 3 Feb 2008 16:16:05 +0000 (UTC) (envelope-from kabaev@gmail.com) Received: by hs-out-2122.google.com with SMTP id h53so1900177hsh.11 for ; Sun, 03 Feb 2008 08:16:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:date:to:subject:message-id:x-mailer:mime-version:content-type:from; bh=ZoyRhyn1VSQsSGnCdnTrUFD36mYbOb0nQTizC8frKHw=; b=gJwq82bbxuQ+o7AJ9drZk5OQi3EsQVNDTwNpg3QzIt6b5BcxZy48yEIOdCDODJX7e5BkXJWFqSXNoqVAXYWHbpf16Qd75dKWudNPl5GrQPKgCSk42VOV9smSZ5oXfpTfz5DCkLZRtJzOnzRcKs6m8PwR4guC13se+koyabJhss0= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=date:to:subject:message-id:x-mailer:mime-version:content-type:from; b=A6ZItOc6RxCOg2iaCTVBBhqPRT1ji0Xbznv/KSAJTLeMyz+2Ey/sh0KeqdnGNCZ1804E8/PUeAjpzWYDz2ckHVkrYq6RooEiQgg134pWVbqM2RK8hsOsR7qTdN523TZgfQSkOo2a2Qlw9dobJTxQlSnUcCp86ZiRfft6QRYXLi4= Received: by 10.150.96.10 with SMTP id t10mr2464132ybb.1.1202055364582; Sun, 03 Feb 2008 08:16:04 -0800 (PST) Received: from kan.dnsalias.net ( [24.218.183.247]) by mx.google.com with ESMTPS id 31sm14988374wri.24.2008.02.03.08.16.03 (version=SSLv3 cipher=OTHER); Sun, 03 Feb 2008 08:16:03 -0800 (PST) Date: Sun, 3 Feb 2008 11:15:58 -0500 To: gnome@freebsd.org Message-ID: <20080203111558.21f8cc0f@kan.dnsalias.net> X-Mailer: Claws Mail 3.0.2 (GTK+ 2.12.5; i386-portbld-freebsd8.0) Mime-Version: 1.0 Content-Type: multipart/signed; boundary="Sig_/06RgttVlDmj83Tb3GtiFQHC"; protocol="application/pgp-signature"; micalg=PGP-SHA1 From: kabaev@gmail.com Cc: Subject: [PATCH] HAL is broken with real SCSI CD-ROM /CD-RW devices X-BeenThere: freebsd-gnome@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: GNOME for FreeBSD -- porting and maintaining List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 03 Feb 2008 16:16:05 -0000 --Sig_/06RgttVlDmj83Tb3GtiFQHC Content-Type: multipart/mixed; boundary="MP_/5aXzT+NvCg3nw4aZ/YwpNb5" --MP_/5aXzT+NvCg3nw4aZ/YwpNb5 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Hi, this a reserve copy in case one poseted to mainling lists gets lost somehow. You seem to be the one doing majority of Gnome porting where CAM is involved these days, so I thought direct message is warranted. -- Alexander Kabaev =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D Hi, hal port as it exists on today's ports CVS works very badly with my Plextor CD-RW, which hapens to be a generic SCSI-3/MMC2 device. Hal hangs the drive firmware and sometimes oven freezes the whole SCSI bus when probing for CDROM. It turns out that whoever did the initial hal port did not know that CDB length parameter passed to CAM is significant and just hardcoded it to 16. This causes 16 bytes of command to be DMA's to the drive even for SCSI 6 and 10 byte commands and that is not received warmly by at least some real SCSI targets. Attached patch (also at http://people.freebsd.org/~kan/hal-patch-scsi.diff) fixes this to renaming unused timeout parameter in hfp_cdfrom_send_ccb function to be ccb_len and passing proper command length where necessary. --=20 Alexander Kabaev --MP_/5aXzT+NvCg3nw4aZ/YwpNb5 Content-Type: text/x-patch; name=patch-scsi.diff Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename=patch-scsi.diff --- hald/freebsd/libprobe/hfp-cdrom.h.orig 2008-02-03 10:35:35.000000000 -0= 500 +++ hald/freebsd/libprobe/hfp-cdrom.h 2008-02-03 10:39:13.000000000 -0500 @@ -149,8 +149,8 @@ HFPCDROM *hfp_cdrom_new_from_fd (int fd, const char *path, const char *par= ent); =20 boolean hfp_cdrom_send_ccb (HFPCDROM *cdrom, - char ccb[16], - int timeout, + const char *ccb, + int ccb_len, HFPCDROMDirection direction, void *data, int len, --- hald/freebsd/libprobe/hfp-cdrom.c.orig 2008-02-03 10:36:09.000000000 -0= 500 +++ hald/freebsd/libprobe/hfp-cdrom.c 2008-02-03 10:39:13.000000000 -0500 @@ -124,13 +124,14 @@ =20 boolean hfp_cdrom_send_ccb (HFPCDROM *cdrom, - char ccb[16], - int timeout, + const char *ccb, + int ccb_len, HFPCDROMDirection direction, void *data, int len, char **err) { + int timeout =3D 10; assert(cdrom !=3D NULL); assert(ccb !=3D NULL); assert(direction =3D=3D HFP_CDROM_DIRECTION_NONE @@ -227,7 +228,7 @@ data, len, sizeof(cam_ccb.csio.sense_data), - 16, + ccb_len, timeout * 1000); =20 memcpy(cam_ccb.csio.cdb_io.cdb_bytes, ccb, 16); @@ -255,7 +256,7 @@ =20 assert(cdrom !=3D NULL); =20 - return hfp_cdrom_send_ccb(cdrom, ccb, 10, HFP_CDROM_DIRECTION_NONE, NULL= , 0, NULL); + return hfp_cdrom_send_ccb(cdrom, ccb, 6, HFP_CDROM_DIRECTION_NONE, NULL,= 0, NULL); } =20 void --- hald/freebsd/probing/freebsd_dvd_rw_utils.c.orig 2008-02-03 10:35:14.00= 0000000 -0500 +++ hald/freebsd/probing/freebsd_dvd_rw_utils.c 2008-02-03 10:39:27.0000000= 00 -0500 @@ -28,6 +28,7 @@ struct ScsiCommand { HFPCDROM *cdrom; char ccb[16]; + int len; }; =20 static ScsiCommand * @@ -51,13 +52,14 @@ scsi_command_init (ScsiCommand * cmd, size_t i, int arg) { cmd->ccb[i] =3D arg; + cmd->len =3D i + 1; } =20 static int scsi_command_transport (ScsiCommand * cmd, Direction dir, void *buf, size_t sz) { - if (hfp_cdrom_send_ccb(cmd->cdrom, cmd->ccb, 10, dir, buf, sz, NULL)) + if (hfp_cdrom_send_ccb(cmd->cdrom, cmd->ccb, cmd->len, dir, buf, sz, NULL= )) return 0; else return -1; --MP_/5aXzT+NvCg3nw4aZ/YwpNb5-- --Sig_/06RgttVlDmj83Tb3GtiFQHC Content-Type: application/pgp-signature; name=signature.asc Content-Disposition: attachment; filename=signature.asc -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.8 (FreeBSD) iD8DBQFHpei+Q6z1jMm+XZYRAmwnAJwIw2hspnhPfa5ttv64gDhKebC9bACeMRkA py85g+Umz0sF6qPU5yfCy4M= =ZqHA -----END PGP SIGNATURE----- --Sig_/06RgttVlDmj83Tb3GtiFQHC--