Re: cdu31a.c patch in 2.0.23 and 2.1.5

Corey Minyard (minyard@metronet.com)
22 Oct 1996 06:28:06 -0500


Chris Buchanan <csbuchan@undergrad.math.uwaterloo.ca> writes:
>
> The patch for the cdu31a driver that was included in 2.0.23 and
> 2.1.5 broke my system; well, that's a bit of an over-statement.
> It broke the ability to play audio-cds. Basically, it looks like
> the drive is reporting the first and last track numbers in
> BCD form (which makes a certain amount of sense) and not in
> integer form (which is what the change assumes). I am a little
> curious if this change actually works for anybody. Reports are
> welcome.
>

Sorry for the problem. There was a bug and someone suggested a fix
that I did, but I couldn't test it because my interface card broke. I
didn't consider the fix very carfully and it was incorrect. I am
including a fix.

-- 
Corey Minyard               Internet:  minyard@metronet.com
  Work: minyard@nortel.ca       UUCP:  minyard@wf-rch.cirr.com

--- linux/drivers/cdrom/cdu31a.c.old Sun Oct 20 22:25:06 1996 +++ linux/drivers/cdrom/cdu31a.c Sun Oct 20 22:30:31 1996 @@ -1915,7 +1915,9 @@ int num_tracks; - num_tracks = sony_toc.last_track_num - sony_toc.first_track_num + 1; + num_tracks = ( bcd_to_int(sony_toc.last_track_num) + - bcd_to_int(sony_toc.first_track_num) + + 1); for (i = 0; i < num_tracks; i++) { if (sony_toc.tracks[i].track == track) @@ -2486,8 +2488,8 @@ i=verify_area(VERIFY_WRITE, hdr, sizeof(*hdr)); if(i<0) return i; - loc_hdr.cdth_trk0 = sony_toc.first_track_num; - loc_hdr.cdth_trk1 = sony_toc.last_track_num; + loc_hdr.cdth_trk0 = bcd_to_int(sony_toc.first_track_num); + loc_hdr.cdth_trk1 = bcd_to_int(sony_toc.last_track_num); memcpy_tofs(hdr, &loc_hdr, sizeof(*hdr)); } return 0; @@ -2567,8 +2569,8 @@ return i; memcpy_fromfs(&ti, (char *) arg, sizeof(ti)); - if ( (ti.cdti_trk0 < sony_toc.first_track_num) - || (ti.cdti_trk0 > sony_toc.last_track_num) + if ( (ti.cdti_trk0 < bcd_to_int(sony_toc.first_track_num)) + || (ti.cdti_trk0 > bcd_to_int(sony_toc.last_track_num)) || (ti.cdti_trk1 < ti.cdti_trk0)) { return -EINVAL; @@ -2587,7 +2589,7 @@ * If we want to stop after the last track, use the lead-out * MSF to do that. */ - if (ti.cdti_trk1 >= sony_toc.last_track_num) + if (ti.cdti_trk1 >= bcd_to_int(sony_toc.last_track_num)) { log_to_msf(msf_to_log(sony_toc.lead_out_start_msf)-1, &(params[4]));