# CD Burning: ATAPI vs SCSI Emulation issues

## usrbinperl

I use the 2.6.5-gentoo-r1 kernel and a LiteOn LDW-811S with the latest firmware (HS0Q).  I have tried to burn CDs using the new 2.6 support for ATAPI CD burning without using the ide-scsi emulation module.  With the ide-cd module loaded, this is what happens:

```

ben@dah ben $ cdrecord -v dev=/dev/hdc -driveropts=burnfree -audio track*.wav

cdrecord: No write mode specified.

cdrecord: Asuming -tao mode.

cdrecord: Future versions of cdrecord may have different drive dependent defaults.

cdrecord: Continuing in 5 seconds...

Cdrecord-Clone 2.01a27 (i686-pc-linux-gnu) Copyright (C) 1995-2004 J�rg Schilling

TOC Type: 0 = CD-DA

scsidev: '/dev/hdc'

devname: '/dev/hdc'

scsibus: -2 target: -2 lun: -2

Warning: Open by 'devname' is unintentional and not supported.

Linux sg driver version: 3.5.27

Using libscg version 'schily-0.8'.

Driveropts: 'burnfree'

SCSI buffer size: 64512

atapi: 1

Device type    : Removable CD-ROM

Version        : 0

Response Format: 2

Capabilities   :

Vendor_info    : 'LITE-ON '

Identifikation : 'DVDRW LDW-811S  '

Revision       : 'HS0Q'

Device seems to be: Generic mmc2 DVD-ROM.

Current: 0x0009

Profile: 0x001B

Profile: 0x001A

Profile: 0x0014

Profile: 0x0013

Profile: 0x0011

Profile: 0x0010

Profile: 0x000A

Profile: 0x0009 (current)

Profile: 0x0008

Using generic SCSI-3/mmc   CD-R/CD-RW driver (mmc_cdr).

Driver flags   : MMC-3 SWABAUDIO BURNFREE FORCESPEED

Supported modes: TAO PACKET SAO SAO/R96P SAO/R96R RAW/R16 RAW/R96P RAW/R96R

Drive buf size : 1895168 = 1850 KB

FIFO size      : 4194304 = 4096 KB

Track 01: audio   38 MB (03:49.13) no preemp

Track 02: audio   40 MB (04:00.20) no preemp

Track 03: audio   48 MB (04:50.10) no preemp

Track 04: audio   41 MB (04:07.29) no preemp

Track 05: audio   24 MB (02:25.20) no preemp

Track 06: audio   31 MB (03:09.17) no preemp

Track 07: audio   64 MB (06:22.13) no preemp

Track 08: audio   25 MB (02:33.82) no preemp

Track 09: audio   20 MB (02:03.70) no preemp

Track 10: audio   55 MB (05:31.62) no preemp

Track 11: audio   12 MB (01:16.57) no preemp

Track 12: audio   16 MB (01:37.60) no preemp

Track 13: audio   53 MB (05:19.29) no preemp

Total size:      479 MB (47:29.86) = 213740 sectors

Lout start:      479 MB (47:31/65) = 213740 sectors

Current Secsize: 2048

ATIP info from disk:

  Indicated writing power: 5

  Is unrestricted

  Is not erasable

  Disk sub type: Medium Type A, high Beta category (A+) (3)

  ATIP start of lead in:  -11839 (97:24/11)

  ATIP start of lead out: 359849 (79:59/74)

Disk type:    Long strategy type (Cyanine, AZO or similar)

Manuf. index: 24

Manufacturer: SONY Corporation

Blocks total: 359849 Blocks current: 359849 Blocks remaining: 146109

Forcespeed is OFF.

Starting to write CD/DVD at speed 40 in real TAO mode for single session.

Last chance to quit, starting real write    0 seconds. Operation starts.

Waiting for reader process to fill input buffer ... input buffer ready.

BURN-Free is ON.

Performing OPC...

Starting new track at sector: 0

Track 01:   38 of   38 MB written (fifo  98%) [buf  99%]  19.6x.

Track 01: Total bytes read/written: 40419120/40419120 (17185 sectors).

Starting new track at sector: 17337

Track 02:   40 of   40 MB written (fifo  98%) [buf  41%]  20.2x.

Track 02: Total bytes read/written: 42371280/42371280 (18015 sectors).

Starting new track at sector: 35504

Track 03:   48 of   48 MB written (fifo 100%) [buf   4%]  11.7x.

Track 03: Total bytes read/written: 51174816/51174816 (21758 sectors).

Starting new track at sector: 57414

Track 04:   41 of   41 MB written (fifo  98%) [buf  73%]   5.1x.

Track 04: Total bytes read/written: 43622544/43622544 (18547 sectors).

Starting new track at sector: 76113

Track 05:   24 of   24 MB written (fifo 100%) [buf  32%]  10.9x.

Track 05: Total bytes read/written: 25613280/25613280 (10890 sectors).

Starting new track at sector: 87155

Track 06:   31 of   31 MB written (fifo  98%) [buf  16%]  11.5x.

Track 06: Total bytes read/written: 33370176/33370176 (14188 sectors).

Starting new track at sector: 101495

Track 07:   64 of   64 MB written (fifo 100%) [buf  16%]  11.6x.

Track 07: Total bytes read/written: 67408320/67408320 (28660 sectors).

Starting new track at sector: 130307

Track 08:   25 of   25 MB written (fifo  98%) [buf   2%]   5.2x.

Track 08: Total bytes read/written: 27135024/27135024 (11537 sectors).

Starting new track at sector: 141996

Track 09:   20 of   20 MB written (fifo 100%) [buf  40%]  10.3x.

Track 09: Total bytes read/written: 21821856/21821856 (9278 sectors).

Starting new track at sector: 151426

Track 10:   55 of   55 MB written (fifo 100%) [buf  56%]  10.4x.

Track 10: Total bytes read/written: 58498944/58498944 (24872 sectors).

Starting new track at sector: 176450

Track 11:   12 of   12 MB written (fifo 100%) [buf   9%]   5.5x.

Track 11: Total bytes read/written: 13507536/13507536 (5743 sectors).

Starting new track at sector: 182345

Track 12:   16 of   16 MB written (fifo  98%) [buf  36%]  10.9x.

Track 12: Total bytes read/written: 17216640/17216640 (7320 sectors).

Starting new track at sector: 189817

Track 13:   53 of   53 MB written (fifo 100%) [buf  17%]  20.7x.

Track 13: Total bytes read/written: 56323344/56323344 (23947 sectors).

Writing  time:  396.516s

Average write speed   7.4x.

Min drive buffer fill was 0%

Total of 25 possible drive buffer underruns predicted.

Fixating...

Fixating time:   13.974s

BURN-Free was never needed.

cdrecord: fifo had 7856 puts and 7856 gets.

cdrecord: fifo was 0 times empty and 3988 times full, min fill was 70%.

```

It reports 25 possible buffer underruns, and, sure enough, the CD-R is now a coaster.  I've also tried dev=ATAPI:0,0,0 but it yielded similar results.  In addition, I've tried with and without the driveropts argument; it seems to be mostly irrelevant but harmless as cdrecord may need to use BURN-Free sometime.  It burns coasters either way.  I've never had success with ATAPI CD burning using this and similar methods, but once I burned a semi-playable disc (the first track played perfectly but the next 11 contained a lot of static noise and the music was barely audible at times).  Perhaps I have something misconfigured or maybe either the kernel or cdrecord is not actually ready for emulation-less burning.  Maybe somebody knows....

When I use the ide-scsi module, I get similar output:

```

ben@dah ben $ cdrecord -v dev=0,0,0 -driveropts=burnfree -audio track*.wav

cdrecord: No write mode specified.

cdrecord: Asuming -tao mode.

cdrecord: Future versions of cdrecord may have different drive dependent defaults.

cdrecord: Continuing in 5 seconds...

Cdrecord-Clone 2.01a27 (i686-pc-linux-gnu) Copyright (C) 1995-2004 J�rg Schilling

TOC Type: 0 = CD-DA

scsidev: '0,0,0'

scsibus: 0 target: 0 lun: 0

Linux sg driver version: 3.5.30

Using libscg version 'schily-0.8'.

Driveropts: 'burnfree'

SCSI buffer size: 64512

atapi: 1

Device type    : Removable CD-ROM

Version        : 2

Response Format: 2

Capabilities   :

Vendor_info    : 'LITE-ON '

Identifikation : 'DVDRW LDW-811S  '

Revision       : 'HS0Q'

Device seems to be: Generic mmc2 DVD-ROM.

Current: 0x0009

Profile: 0x001B

Profile: 0x001A

Profile: 0x0014

Profile: 0x0013

Profile: 0x0011

Profile: 0x0010

Profile: 0x000A

Profile: 0x0009 (current)

Profile: 0x0008

Using generic SCSI-3/mmc   CD-R/CD-RW driver (mmc_cdr).

Driver flags   : MMC-3 SWABAUDIO BURNFREE FORCESPEED

Supported modes: TAO PACKET SAO SAO/R96P SAO/R96R RAW/R16 RAW/R96P RAW/R96R

Drive buf size : 1895168 = 1850 KB

FIFO size      : 4194304 = 4096 KB

Track 01: audio   38 MB (03:49.13) no preemp

Track 02: audio   40 MB (04:00.20) no preemp

Track 03: audio   48 MB (04:50.10) no preemp

Track 04: audio   41 MB (04:07.29) no preemp

Track 05: audio   24 MB (02:25.20) no preemp

Track 06: audio   31 MB (03:09.17) no preemp

Track 07: audio   64 MB (06:22.13) no preemp

Track 08: audio   25 MB (02:33.82) no preemp

Track 09: audio   20 MB (02:03.70) no preemp

Track 10: audio   55 MB (05:31.62) no preemp

Track 11: audio   12 MB (01:16.57) no preemp

Track 12: audio   16 MB (01:37.60) no preemp

Track 13: audio   53 MB (05:19.29) no preemp

Total size:      479 MB (47:29.86) = 213740 sectors

Lout start:      479 MB (47:31/65) = 213740 sectors

Current Secsize: 2048

ATIP info from disk:

  Indicated writing power: 4

  Is not unrestricted

  Is not erasable

  Disk sub type: Medium Type A, high Beta category (A+) (3)

  ATIP start of lead in:  -11849 (97:24/01)

  ATIP start of lead out: 359847 (79:59/72)

Disk type:    Long strategy type (Cyanine, AZO or similar)

Manuf. index: 25

Manufacturer: Taiyo Yuden Company Limited

Blocks total: 359847 Blocks current: 359847 Blocks remaining: 146107

Forcespeed is OFF.

Starting to write CD/DVD at speed 40 in real TAO mode for single session.

Last chance to quit, starting real write    0 seconds. Operation starts.

Waiting for reader process to fill input buffer ... input buffer ready.

BURN-Free is ON.

Performing OPC...

Starting new track at sector: 0

Track 01:   38 of   38 MB written (fifo  98%) [buf  99%]  19.6x.

Track 01: Total bytes read/written: 40419120/40419120 (17185 sectors).

Starting new track at sector: 17337

Track 02:   40 of   40 MB written (fifo 100%) [buf  34%]  20.1x.

Track 02: Total bytes read/written: 42371280/42371280 (18015 sectors).

Starting new track at sector: 35504

Track 03:   48 of   48 MB written (fifo  96%) [buf  25%]   8.1x.

Track 03: Total bytes read/written: 51174816/51174816 (21758 sectors).

Starting new track at sector: 57414

Track 04:   41 of   41 MB written (fifo  95%) [buf  24%]  41.9x.

Track 04: Total bytes read/written: 43622544/43622544 (18547 sectors).

Starting new track at sector: 76113

Track 05:   24 of   24 MB written (fifo 100%) [buf   0%]   7.7x.

Track 05: Total bytes read/written: 25613280/25613280 (10890 sectors).

Starting new track at sector: 87155

Track 06:   31 of   31 MB written (fifo  85%) [buf  46%]   8.8x.

Track 06: Total bytes read/written: 33370176/33370176 (14188 sectors).

Starting new track at sector: 101495

Track 07:   64 of   64 MB written (fifo  90%) [buf  19%]   8.8x.

Track 07: Total bytes read/written: 67408320/67408320 (28660 sectors).

Starting new track at sector: 130307

Track 08:   25 of   25 MB written (fifo 100%) [buf  74%]   7.8x.

Track 08: Total bytes read/written: 27135024/27135024 (11537 sectors).

Starting new track at sector: 141996

Track 09:   20 of   20 MB written (fifo  92%) [buf  64%]   8.7x.

Track 09: Total bytes read/written: 21821856/21821856 (9278 sectors).

Starting new track at sector: 151426

Track 10:   55 of   55 MB written (fifo  85%) [buf  53%]   8.3x.

Track 10: Total bytes read/written: 58498944/58498944 (24872 sectors).

Starting new track at sector: 176450

Track 11:   12 of   12 MB written (fifo 100%) [buf  16%]   8.2x.

Track 11: Total bytes read/written: 13507536/13507536 (5743 sectors).

Starting new track at sector: 182345

Track 12:   16 of   16 MB written (fifo  96%) [buf  52%]  38.8x.

Track 12: Total bytes read/written: 17216640/17216640 (7320 sectors).

Starting new track at sector: 189817

Track 13:   53 of   53 MB written (fifo 100%) [buf  68%]   9.1x.

Track 13: Total bytes read/written: 56323344/56323344 (23947 sectors).

Writing  time:  243.008s

Average write speed  12.1x.

Min drive buffer fill was 0%

Total of 21 possible drive buffer underruns predicted.

Fixating...

Fixating time:   13.965s

BURN-Free was never needed.

cdrecord: fifo had 7856 puts and 7856 gets.

cdrecord: fifo was 0 times empty and 1938 times full, min fill was 67%.

```

It also reports possible buffer underruns, yet the audio disc plays correctly on my CD player.  It seems to sound fine and seek correctly.  However, the very low buffer fills (0% after burning one of the tracks) worries me quite a bit.  This disc worked fine, but maybe future discs (or even this disc if I haven't noticed yet) will not work correctly or have deteriorated sound quality (as in the one ATAPI-burned disc that semi-worked).

DMA (on the CD-RW drive)is another issue.  It doesn't seem like I can enable it when SCSI emulation is used and burning currently doesn't work with ide-cd (where I can enable DMA).  It seems like I need it to view DVDs without skipping and for running dvdbackup and growisofs successfully.  Is there something (DMA-related) that I can do if I am not able to get ATAPI burning working and I need to use SCSI emulation?

Any advice would be greatly appreciated.  I would really like to get ATAPI burning working.

----------

## NeddySeagoon

usrbinperl,

Both SCSI and ATAPI should be OK. You can turn on DMA for all your drives, including emulated SCSI ones by setting some options in the kernel.

Since your drive supporys burnproof, it should handle buffer underruns and not produce coasters for that reason. Some (older) players will see the join though. Can you play any of your coasters  in the writer?

To turn on DMA in the kernel goto

Device Drivers->ATA/ATAPI/MFM/RLL support->PCI IDE chipset support

then choose the following:-

Generic PCI bus-master DMA support

Use PCI DMA by default when available

Turn off Enable DMA only for disks

Lastly, choose your chipset from the list that follows.

Rebuild your kernel. If you have X installed, make xconfig or much nicer than make menuconfig

----------

## usrbinperl

Thanks for your reply.

I enabled the kernel options that you listed yet a look at /proc/ide/hdc/settings still shows no DMA.  I tried to enable it manually by unloading the ide-scsi, sr_mod, and sg modules and loading the ide-cd.  Then I did an hdparm -d 1 /dev/hdc.  It said that it was unable to set DMA for that drive.  

Meanwhile, I've been burning coasters even with ide-scsi emulation.  The last burn occupied about 100% of my CPU usage for an extended period of time and listed 56 possible buffer underruns.  

At this point, all I want to do is burn CDs under linux.  My friend has the exact same LiteOn drive and he burns fine with no emulation.  His machine is not more powerful than mine and it also runs Gentoo.  He doesn't know what my problem is because his burner worked right after installation with the simple dev=ATAPI:0,0,0 argument.

----------

## NeddySeagoon

usrbinperl,

Post detials of your chipset, lspci will give the info, and the Device Drivers->ATA/ATAPI/MFM/RLL support section of your kernel .config file so your readers can check your settings.

Now some daft questions. 

You did nount boot when you installed your kernel?

You are really running the kernel you think you are?

Have a look at uname -a and make sure it what you expect.

----------

## usrbinperl

 *NeddySeagoon wrote:*   

> usrbinperl,
> 
> Post detials of your chipset, lspci will give the info, and the Device Drivers->ATA/ATAPI/MFM/RLL support section of your kernel .config file so your readers can check your settings.
> 
> 

 

```

root@dah dvd # lspci

00:00.0 Host bridge: VIA Technologies, Inc. VT8366/A/7 [Apollo KT266/A/333]

00:01.0 PCI bridge: VIA Technologies, Inc. VT8366/A/7 [Apollo KT266/A/333 AGP]

00:0b.0 Ethernet controller: Accton Technology Corporation SMC2-1211TX (rev 10)

00:11.0 ISA bridge: VIA Technologies, Inc. VT8233A ISA Bridge

00:11.1 IDE interface: VIA Technologies, Inc. VT82C586A/B/VT82C686/A/B/VT8233/A/C/VT8235 PIPC Bus Master IDE (rev 06)

00:11.2 USB Controller: VIA Technologies, Inc. USB (rev 23)

00:11.3 USB Controller: VIA Technologies, Inc. USB (rev 23)

00:11.5 Multimedia audio controller: VIA Technologies, Inc. VT8233/A/8235 AC97 Audio Controller (rev 40)

01:00.0 VGA compatible controller: 3Dfx Interactive, Inc. Voodoo 3 (rev 01)

```

And here's part of my .config:

```

# ATA/ATAPI/MFM/RLL support

#

CONFIG_IDE=y

CONFIG_BLK_DEV_IDE=y

                                                                                                                                                            

#

# Please see Documentation/ide.txt for help/info on IDE drives

#

# CONFIG_BLK_DEV_HD_IDE is not set

CONFIG_BLK_DEV_IDEDISK=y

# CONFIG_IDEDISK_MULTI_MODE is not set

# CONFIG_IDEDISK_STROKE is not set

CONFIG_BLK_DEV_IDECD=m

# CONFIG_BLK_DEV_IDETAPE is not set

# CONFIG_BLK_DEV_IDEFLOPPY is not set

CONFIG_BLK_DEV_IDESCSI=m

# CONFIG_IDE_TASK_IOCTL is not set

CONFIG_IDE_TASKFILE_IO=y

#

# IDE chipset support/bugfixes

#

CONFIG_IDE_GENERIC=y

# CONFIG_BLK_DEV_CMD640 is not set

CONFIG_BLK_DEV_IDEPCI=y

# CONFIG_IDEPCI_SHARE_IRQ is not set

# CONFIG_BLK_DEV_OFFBOARD is not set

# CONFIG_BLK_DEV_GENERIC is not set

# CONFIG_BLK_DEV_OPTI621 is not set

# CONFIG_BLK_DEV_RZ1000 is not set

CONFIG_BLK_DEV_IDEDMA_PCI=y

# CONFIG_BLK_DEV_IDEDMA_FORCED is not set

CONFIG_IDEDMA_PCI_AUTO=y

# CONFIG_IDEDMA_ONLYDISK is not set

CONFIG_BLK_DEV_ADMA=y

# CONFIG_BLK_DEV_AEC62XX is not set

# CONFIG_BLK_DEV_ALI15X3 is not set

# CONFIG_BLK_DEV_AMD74XX is not set

# CONFIG_BLK_DEV_ATIIXP is not set

# CONFIG_BLK_DEV_CMD64X is not set

# CONFIG_BLK_DEV_TRIFLEX is not set

# CONFIG_BLK_DEV_CY82C693 is not set

# CONFIG_BLK_DEV_CS5520 is not set

# CONFIG_BLK_DEV_CS5530 is not set

# CONFIG_BLK_DEV_HPT34X is not set

# CONFIG_BLK_DEV_HPT366 is not set

# CONFIG_BLK_DEV_SC1200 is not set

# CONFIG_BLK_DEV_PIIX is not set

# CONFIG_BLK_DEV_NS87415 is not set

# CONFIG_BLK_DEV_PDC202XX_OLD is not set

# CONFIG_BLK_DEV_PDC202XX_NEW is not set

# CONFIG_BLK_DEV_SVWKS is not set

# CONFIG_BLK_DEV_SIIMAGE is not set

# CONFIG_BLK_DEV_SIS5513 is not set

# CONFIG_BLK_DEV_SLC90E66 is not set

# CONFIG_BLK_DEV_TRM290 is not set

CONFIG_BLK_DEV_VIA82CXXX=m

CONFIG_BLK_DEV_IDEDMA=y

# CONFIG_IDEDMA_IVB is not set

CONFIG_IDEDMA_AUTO=y

# CONFIG_BLK_DEV_HD is not set

                                                                                                                                                            

#

# SCSI device support

#

CONFIG_SCSI=m

# CONFIG_SCSI_PROC_FS is not set

                                                                                                                                                            

#

# SCSI support type (disk, tape, CD-ROM)

#

# CONFIG_BLK_DEV_SD is not set

# CONFIG_CHR_DEV_ST is not set

# CONFIG_CHR_DEV_OSST is not set

CONFIG_BLK_DEV_SR=m

CONFIG_BLK_DEV_SR_VENDOR=y

CONFIG_CHR_DEV_SG=m

```

 *NeddySeagoon wrote:*   

> Now some daft questions. 
> 
> You did nount boot when you installed your kernel?

 

Yes, sir.

 *NeddySeagoon wrote:*   

> 
> 
> You are really running the kernel you think you are?
> 
> Have a look at uname -a and make sure it what you expect.

 

```

root@dah dvd # ls /usr/src/

linux  linux-2.6.5-gentoo-r1

root@dah dvd # uname -a

Linux dah 2.6.5-gentoo-r1 #5 Fri May 21 09:22:46 Local time zone must be set--see zic manu i686 AMD Athlon(tm) XP 1900+ AuthenticAMD GNU/Linux

```

Looks correct to me.

----------

## NeddySeagoon

usrbinperl,

I have a few other options turned on too.

- Use Mult Mode By Default

- IDE Task File Access

- IDE Task File (I/O) Exprimenmtal

- Sharing PCI IDE Interrupts Support

- Generic PCI IDE Chipset Support 

I dont think any will make a difference though.

Try saying Y to CONFIG_BLK_DEV_VIA82CXXX because if that module is not loaded, the system will not be able to set up DMA. It  may be that the kerenl tries to do this before it is able to load modules. You need to load it for hdparm to work. The kerenl help does not give the module name either.

----------

