From e7b26bd4dfdd4dcb04a5a339e1ed87206fc9e83e Mon Sep 17 00:00:00 2001 From: Arne Meyer Date: Sat, 1 Oct 2022 10:35:19 +0000 Subject: cdfs: handle block sizes correctly The Readblock enum does not work when you try to read audio cds. 4 cdda blocks are lager than 8192 and the command fails (at least when using an usb cd drive). This sets the block count according to the track block size. With this and the fix for libdisk I can rip audio cds on my el cheapo usb dvd drive. Tested with "Midnight Oil - Blue Sky Mining" --- sys/src/cmd/cdfs/dat.h | 7 ++++--- sys/src/cmd/cdfs/mmc.c | 4 ++-- 2 files changed, 6 insertions(+), 5 deletions(-) (limited to 'sys/src') diff --git a/sys/src/cmd/cdfs/dat.h b/sys/src/cmd/cdfs/dat.h index 2dca92b24..5418a6164 100644 --- a/sys/src/cmd/cdfs/dat.h +++ b/sys/src/cmd/cdfs/dat.h @@ -133,10 +133,11 @@ enum { DVDNblock = 16, /* DVD ECC block is 16 sectors */ BDNblock = 32, /* BD ECC block (`cluster') is 32 sectors */ /* - * make a single transfer fit in a 9P rpc. if we don't do this, - * remote access (e.g., via /mnt/term/dev/sd*) fails mysteriously. + * number of blocks read/written must fit in this. if we don't do this, + * remote access (e.g., via /mnt/term/dev/sd* or nusb/disk) fails mysteriously. + * see /sys/src/9/port/devmnt.c MAXRPC. */ - Readblock = 8192/BScdrom, + Maxrpc = 8192, }; typedef struct Buf Buf; diff --git a/sys/src/cmd/cdfs/mmc.c b/sys/src/cmd/cdfs/mmc.c index cd0585c53..f749c4d78 100644 --- a/sys/src/cmd/cdfs/mmc.c +++ b/sys/src/cmd/cdfs/mmc.c @@ -1171,7 +1171,7 @@ mmcopenrd(Drive *drive, int trackno) o->track = &drive->track[trackno]; o->nchange = drive->nchange; o->omode = OREAD; - o->buf = bopen(mmcread, OREAD, o->track->bs, Readblock); + o->buf = bopen(mmcread, OREAD, o->track->bs, Maxrpc/o->track->bs); o->buf->otrack = o; aux->nropen++; @@ -1395,7 +1395,7 @@ mmccreate(Drive *drive, int type) o->nchange = drive->nchange; o->omode = OWRITE; o->track = t; - o->buf = bopen(mmcwrite, OWRITE, bs, Readblock); + o->buf = bopen(mmcwrite, OWRITE, bs, Maxrpc/bs); o->buf->otrack = o; aux->nwopen++; -- cgit v1.2.3