superg / redumper

Low level CD dumper utility
GNU General Public License v3.0
179 stars 16 forks source link

Handling asus/lg cache in KiBs instead of MiB? #160

Open thegawin opened 1 month ago

thegawin commented 1 month ago

Not sure if super important, but I've noticed that:

1) Some drives are using less than 1MiB (Those with MT1862 are interesting as they support scrabbled mode and are cheap dvd, but have low quality firmware.) 2) JB8 boards have weird amount of cache (4064 kiB not 4096 kiB)

https://forum.cdrinfo.pl/attachments/f15/77911d1461421554-encyklopedia-hitachi-lg-hlds-hlds_table_v1.1.pdf

superg commented 1 month ago

Not immediately clear on what do you mean by handling exactly?

thegawin commented 1 month ago

This function: https://github.com/superg/redumper/blob/main/drive.ixx#L495

Basically with using MiB and integer, we cannot use values 0.512 or 4.064. I was wondering, if not matching real cache size can cause some problems.

superg commented 1 month ago

Hmm, the sizes from the table you linked (Buffer column) imply that flash still might be aligned to MiB as 4064 is very close to 4096 (4 MiB). My assumption is that hardware flash size can still be 4 MiB. I prefer not to trust some table from internets because I don't know how this data was acquired.

Overall, ASUS cache structure is complicated. There are 2 parts, part #1 is sectors cache, part #2 is the area that is allocated for internal drive use. If you look at the 2nd structure member in https://github.com/superg/redumper/blob/main/drive.ixx#L254 - this is number of sectors that drive buffers and that defines the size of the part #2. For the same flash size, there can be different "partition" schemes, for 8Mb cache for instance, there are 3 known schemes.

The table you linked might define part #1 but total cache size can still be aligned to Megabytes. Ideally, if you could get me a cache dump (redumper .asus file that gets generated when you dump using --drive-type=LG_ASU8A) - I could tell the partition and real cache size and if it's indeed in KiB - I will change that.

thegawin commented 1 month ago

You mean .scram file? With this argument I'm getting this:

LG/ASUS: searching lead-out in cache (LBA: 133457)            
error: read cache failed, SCSI (SC: CHECK CONDITION, SK: ILLEGAL REQUEST, ASC: INVALID FIELD IN CDB)

Edit: It's BW-16D1HT with ribshark's firmware. Edit2: But should be adaptable for all jb8 boards.

superg commented 1 month ago

As I've said, get me a cache dump from the drives where cache size is not multiple of MiB.