Date: Sun, 3 Feb 2008 11:15:58 -0500 From: kabaev@gmail.com To: gnome@freebsd.org Subject: [PATCH] HAL is broken with real SCSI CD-ROM /CD-RW devices Message-ID: <20080203111558.21f8cc0f@kan.dnsalias.net>
next in thread | raw e-mail | index | archive | help
--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--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20080203111558.21f8cc0f>