4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
22 * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
23 * Use is subject to license terms.
26 #include <sys/types.h>
37 #include <dbus/dbus.h>
38 #include <hal/libhal.h>
40 #include "transport.h"
45 #include "misc_scsi.h"
50 * Old sun drives have a vendor specific mode page for setting/getting speed.
51 * Also they use a different method for extracting audio.
52 * We have the device inquiry strings at this time. This is used to enable
53 * us to use older sun drives to extract audio.
56 is_old_sun_drive(cd_device
*dev
)
59 * If we have a SONY CDU 561, CDU 8012, or TOSHIBA model with XMa we
60 * need to handle these drives a bit differently.
62 if (strncmp("SONY", (const char *)&dev
->d_inq
[8], 4) == 0) {
63 if (strncmp("CDU 561", (const char *)&dev
->d_inq
[16], 7) == 0)
65 if (strncmp("CDU-8012", (const char *)&dev
->d_inq
[16], 8) == 0)
69 if ((strncmp("TOSHIBA", (const char *)&dev
->d_inq
[8], 7) == 0) &&
70 (strncmp("XM", (const char *)&dev
->d_inq
[16], 2) == 0)) {
74 /* Changing speed is not allowed for 32X TOSHIBA drives */
75 if (strncmp("SUN32XCD", (const char *)&dev
->d_inq
[24], 8) == 0)
76 dev
->d_cap
|= DEV_CAP_SETTING_SPEED_NOT_ALLOWED
;
77 (void) strncpy(product_id
, (const char *)&dev
->d_inq
[16], 16);
79 if (strstr(product_id
, "SUN") != NULL
)
86 * returns a cd_device handle for a node returned by lookup_device()
87 * also takes the user supplied name and stores it inside the node
90 get_device(char *user_supplied
, char *node
)
95 char devnode
[PATH_MAX
];
97 struct dk_minfo mediainfo
;
101 * we need to resolve any link paths to avoid fake files
102 * such as /dev/rdsk/../../export/file.
105 TRACE(traceall_msg("get_device(%s, %s)\n", user_supplied
?
106 user_supplied
: "<nil>", node
? node
: "<nil>"));
108 size
= resolvepath(node
, devnode
, PATH_MAX
);
109 if ((size
<= 0) || (size
>= (PATH_MAX
- 1)))
112 /* resolvepath may not return a null terminated string */
113 devnode
[size
] = '\0';
116 /* the device node must be in /devices/ or /vol/dev/rdsk */
118 if ((strncmp(devnode
, "/devices/", 9) != 0) &&
119 (strncmp(devnode
, "/vol/dev/rdsk", 13) != 0))
122 * Since we are currently running with the user euid it is
123 * safe to try to open the file without checking access.
126 fd
= open(devnode
, O_RDONLY
|O_NDELAY
);
129 TRACE(traceall_msg("Cannot open %s: %s\n", node
,
134 dev
= (cd_device
*)my_zalloc(sizeof (cd_device
));
136 dev
->d_node
= (char *)my_zalloc(strlen(devnode
) + 1);
137 (void) strcpy(dev
->d_node
, devnode
);
141 dev
->d_inq
= (uchar_t
*)my_zalloc(INQUIRY_DATA_LENGTH
);
143 if (!inquiry(fd
, dev
->d_inq
)) {
144 TRACE(traceall_msg("Inquiry failed on device %s\n", node
));
146 (void) printf("USCSI ioctl failed %d\n",
151 (void) close(dev
->d_fd
);
157 cap
= (uchar_t
*)my_zalloc(18);
158 (void) printf("Checking device type\n");
159 if (get_mode_page(fd
, 0x2A, 0, 8, cap
)) {
161 (void) printf("DVD-R read support\n");
163 (void) printf("DVD-R write support\n");
165 (void) printf("R-W supported\n");
167 (void) printf("DVD-RAM read supported\n");
169 (void) printf("DVD-RAM write supported\n");
171 (void) printf("Could not read mode page 2A! \n");
176 /* Detect if it's a Lite-ON drive with a streaming CD problem */
177 if ((strncmp("LITE-ON", (const char *)&dev
->d_inq
[8], 7) == 0) &&
178 (strncmp("LTR-48", (const char *)&dev
->d_inq
[16], 6) == 0)) {
183 * a workaround for the firmware problem in LITE-ON COMBO drives.
184 * streaming for these drives sets it only to max speed regardless
185 * of requested speed. cd_speed_ctrl allow speeds less than max
186 * to be set but not max thus the code below. (x48 is max speed
189 if ((strncmp("LITE-ON", (const char *)&dev
->d_inq
[8], 7) == 0) &&
190 (strncmp("COMBO SOHC-4836VS",
191 (const char *)&dev
->d_inq
[16], 17) == 0))
192 if (requested_speed
< 48)
195 cap
= (uchar_t
*)my_zalloc(8);
196 if (is_old_sun_drive(dev
)) {
197 dev
->d_read_audio
= toshiba_read_audio
;
198 dev
->d_speed_ctrl
= toshiba_speed_ctrl
;
201 * If the CD Read Feature is supported, READ CD will work
202 * and will return jitter free audio data. Otherwise, look
203 * at Page Code 2A for this information.
205 if (ftr_supported(fd
, MMC_FTR_CD_READ
) == 1) {
206 dev
->d_read_audio
= read_audio_through_read_cd
;
207 dev
->d_cap
|= DEV_CAP_ACCURATE_CDDA
;
208 } else if (get_mode_page(fd
, 0x2A, 0, 8, cap
)) {
210 dev
->d_read_audio
= read_audio_through_read_cd
;
212 dev
->d_cap
|= DEV_CAP_ACCURATE_CDDA
;
216 * If the Real Time Streaming Feature is supported then
217 * Real-time streaming commands can be used for speed control
218 * (except when we want to use cd_speed_ctrl explicitly which
219 * is specified by setting use_cd_speed to 1).
220 * Otherwise try SET CD SPEED.
222 if ((ftr_supported(fd
, MMC_FTR_RT_STREAM
) == 1) &&
224 dev
->d_speed_ctrl
= rt_streaming_ctrl
;
226 (void) printf("using rt speed ctrl\n");
228 dev
->d_speed_ctrl
= cd_speed_ctrl
;
230 (void) printf("using cd speed ctrl\n");
233 if (dev
->d_read_audio
!= NULL
)
234 dev
->d_cap
|= DEV_CAP_EXTRACT_CDDA
;
239 * Find the block size of the device so we can translate
240 * the reads/writes to the device blocksize.
243 if (ioctl(fd
, DKIOCGMEDIAINFO
, &mediainfo
) < 0) {
245 * If DKIOCGMEDIAINFO fails we'll try to get
246 * the blocksize from the device itself.
249 (void) printf("DKIOCGMEDIAINFO failed\n");
250 if (read_capacity(fd
, cap
))
251 dev
->d_blksize
= read_scsi32(cap
+ 4);
254 dev
->d_blksize
= mediainfo
.dki_lbsize
;
260 (void) printf("blocksize = %d\n", dev
->d_blksize
);
261 (void) printf("read_format_capacity = %d \n",
262 read_format_capacity(fd
, &bsize
));
266 * Some devices will return invalid blocksizes. ie. Toshiba
267 * drives will return 2352 when an audio CD is inserted.
268 * Older Sun drives will use 512 byte block sizes. All newer
269 * drives should have 2k blocksizes.
271 if (((dev
->d_blksize
!= 512) && (dev
->d_blksize
!= 2048))) {
272 if (is_old_sun_drive(dev
)) {
273 dev
->d_blksize
= 512;
275 dev
->d_blksize
= 2048;
278 (void) printf(" switching to %d\n", dev
->d_blksize
);
283 dev
->d_name
= (char *)my_zalloc(strlen(user_supplied
) + 1);
284 (void) strcpy(dev
->d_name
, user_supplied
);
286 TRACE(traceall_msg("Got device %s\n", node
));
291 fini_device(cd_device
*dev
)
295 (void) close(dev
->d_fd
);
302 * Given a /dev path resolve that path to a symbolic
303 * name such as cdrom0 if hald is running. If hald is
304 * not running, or does not have a symbolic name for the
305 * the specified /dev path return NULL.
308 hald_symname(char *path
)
310 LibHalContext
*ctx
= NULL
;
313 char **udi
, *p
= NULL
;
316 /* Make sure hald is running */
317 if (vol_running
== 0)
320 dbus_error_init(&error
);
322 if ((ctx
= attach_to_hald()) == NULL
)
325 if ((udi
= libhal_manager_find_device_string_match(ctx
,
326 HAL_RDSK_PROP
, path
, &ndevs
, &error
)) == NULL
)
329 /* Look for the node that contains the valid (non-null) symdev */
330 for (i
= 0; i
< ndevs
; i
++) {
331 if ((p
= libhal_device_get_property_string(ctx
, udi
[i
],
332 HAL_SYMDEV_PROP
, NULL
)) != NULL
)
335 libhal_free_string(p
);
340 libhal_free_string_array(udi
);
341 if (dbus_error_is_set(&error
))
342 dbus_error_free(&error
);
343 detach_from_hald(ctx
, HAL_INITIALIZED
);
348 * Given a name resolve that name to a raw device in the case
349 * that it is a symbolic name or just return what is given if
350 * we are given a /dev path or hald is not running.
353 hald_findname(char *symname
)
355 LibHalContext
*ctx
= NULL
;
358 char **udi
, *path
= NULL
;
362 * We already have a raw path lets return it in a copied buffer
363 * as our caller assumes that they need to free memory.
365 if (symname
[0] == '/') {
366 path
= my_zalloc(strlen(symname
) + 1);
367 (void) strlcpy(path
, symname
, (strlen(symname
) + 1));
371 /* Get the raw device from the hal record */
372 if (vol_running
!= 0) {
373 dbus_error_init(&error
);
375 if ((ctx
= attach_to_hald()) == NULL
)
378 if ((udi
= libhal_manager_find_device_string_match(ctx
,
379 HAL_SYMDEV_PROP
, symname
, &ndevs
,
384 * Loop over the returned UDIs to access the raw
387 for (i
= 0; i
< ndevs
; i
++) {
388 if ((path
= libhal_device_get_property_string(ctx
,
389 udi
[i
], HAL_RDSK_PROP
, NULL
)) != NULL
)
392 libhal_free_string(path
);
397 libhal_free_string_array(udi
);
398 if (dbus_error_is_set(&error
))
399 dbus_error_free(&error
);
400 detach_from_hald(ctx
, HAL_INITIALIZED
);
408 vol_name_to_dev_node(char *vname
, char *found
)
417 p1
= hald_findname(vname
);
421 if (stat(p1
, &statbuf
) < 0) {
422 libhal_free_string(p1
);
425 if (S_ISDIR(statbuf
.st_mode
)) {
426 for (i
= 0; i
< 16; i
++) {
427 (void) snprintf(found
, PATH_MAX
, "%s/s%d", p1
, i
);
428 if (access(found
, F_OK
) >= 0)
432 libhal_free_string(p1
);
436 (void) strlcpy(found
, p1
, PATH_MAX
);
438 libhal_free_string(p1
);
443 * Builds an open()able device path from a user supplied node which can be
444 * of the * form of /dev/[r]dsk/cxtxdx[sx] or cxtxdx[sx] or volmgt-name like
446 * returns the path found in 'found' and returns 1. Otherwise returns 0.
449 lookup_device(char *supplied
, char *found
)
453 char tmpstr
[PATH_MAX
];
455 /* If everything is fine and proper, no need to analyze */
456 if ((stat(supplied
, &statbuf
) == 0) && S_ISCHR(statbuf
.st_mode
) &&
457 ((fd
= open(supplied
, O_RDONLY
|O_NDELAY
)) >= 0)) {
459 (void) strlcpy(found
, supplied
, PATH_MAX
);
464 * Hal only allows access to a device when the user is
465 * on the console, therefore if hal is running and we can't
466 * open the /dev/rdsk or /dev/removable-media/rdsk device
467 * file we will return 0 marking this device as not avaiable.
469 if (fd
< 0 && ((strncmp(supplied
, "/dev/rdsk/", 10) == 0) ||
470 (strncmp(supplied
, "/dev/removable-media/rdsk/", 26) == 0)))
473 if ((strncmp(supplied
, "/dev/dsk/", 9) == 0) ||
474 (strncmp(supplied
, "/dev/removable-media/dsk/", 25) == 0)) {
475 (void) snprintf(tmpstr
, PATH_MAX
, "/dev/rdsk/%s",
476 (char *)strrchr(supplied
, '/'));
478 if ((fd
= open(tmpstr
, O_RDONLY
|O_NDELAY
)) >= 0) {
480 (void) strlcpy(found
, supplied
, PATH_MAX
);
484 /* This device can't be opened mark it as unavailable. */
487 if ((strncmp(supplied
, "cdrom", 5) != 0) &&
488 (strlen(supplied
) < 32)) {
489 (void) snprintf(tmpstr
, sizeof (tmpstr
), "/dev/rdsk/%s",
491 if (access(tmpstr
, F_OK
) < 0) {
492 (void) strcat(tmpstr
, "s2");
494 if ((fd
= open(tmpstr
, O_RDONLY
|O_NDELAY
)) >= 0) {
496 (void) strlcpy(found
, tmpstr
, PATH_MAX
);
500 /* This device can't be opened mark it as unavailable. */
503 return (vol_name_to_dev_node(supplied
, found
));
507 * Opens the device node name passed and returns 1 (true) if the
515 struct dk_cinfo cinfo
;
518 fd
= open(node
, O_RDONLY
|O_NDELAY
);
521 } else if (ioctl(fd
, DKIOCINFO
, &cinfo
) < 0) {
523 } else if (cinfo
.dki_ctype
!= DKC_CDROM
) {
536 /* l10n_NOTE : Column spacing should be kept same */
537 (void) printf(gettext(" Node Connected Device"));
538 /* l10n_NOTE : Column spacing should be kept same */
539 (void) printf(gettext(" Device type\n"));
541 "----------------------+--------------------------------");
542 (void) printf("+-----------------\n");
546 * returns the number of writers or CD/DVD-roms found and the path of
547 * the first device found depending on the mode argument.
548 * possible mode values are:
549 * SCAN_ALL_CDS Scan all CD/DVD devices. Return first CD-RW found.
550 * SCAN_WRITERS Scan all CD-RW devices. Return first one found.
551 * SCAN_LISTDEVS List all devices found.
554 scan_for_cd_device(int mode
, cd_device
**found
)
557 struct dirent
*dirent
;
558 char sdev
[PATH_MAX
], dev
[PATH_MAX
];
560 int writers_found
= 0;
561 int header_printed
= 0;
563 int total_devices_found
;
565 TRACE(traceall_msg("scan_for_cd_devices (mode=%d) called\n", mode
));
568 (void) printf(gettext("Looking for CD devices...\n"));
571 dir
= opendir("/dev/rdsk");
576 total_devices_found
= 0;
577 while ((dirent
= readdir(dir
)) != NULL
) {
578 if (dirent
->d_name
[0] == '.')
580 (void) snprintf(sdev
, PATH_MAX
, "/dev/rdsk/%s",
582 if (strcmp("s2", (char *)strrchr(sdev
, 's')) != 0)
584 if (!lookup_device(sdev
, dev
))
588 if ((t_dev
= get_device(NULL
, dev
)) == NULL
) {
591 total_devices_found
++;
593 is_writer
= !(check_device(t_dev
, CHECK_DEVICE_NOT_WRITABLE
));
598 if ((writers_found
== 1) && (mode
!= SCAN_LISTDEVS
)) {
602 } else if ((mode
== SCAN_ALL_CDS
) && (writers_found
== 0) &&
603 (total_devices_found
== 1) && found
) {
605 /* We found a CD-ROM or DVD-ROM */
609 if (mode
== SCAN_LISTDEVS
) {
612 sn
= hald_symname(sdev
);
613 if (!header_printed
) {
617 /* show vendor, model, firmware rev and device type */
618 (void) printf(" %-21.21s| %.8s %.16s %.4s | %s%s\n",
619 sn
? sn
: sdev
, &t_dev
->d_inq
[8],
620 &t_dev
->d_inq
[16], &t_dev
->d_inq
[32],
621 gettext("CD Reader"),
622 is_writer
? gettext("/Writer") : "");
626 if ((found
!= NULL
) && ((*found
) != t_dev
))
630 (void) closedir(dir
);
632 if ((mode
& SCAN_WRITERS
) || writers_found
)
633 return (writers_found
);
635 return (total_devices_found
);
639 * Check device for various conditions/capabilities
640 * If EXIT_IF_CHECK_FAILED set in cond then it will also exit after
641 * printing a message.
644 check_device(cd_device
*dev
, int cond
)
646 uchar_t
*disc_info
, disc_status
= 0, erasable
= 0;
647 uchar_t page_code
[4];
650 if ((errmsg
== NULL
) && (cond
& CHECK_TYPE_NOT_CDROM
) &&
651 ((dev
->d_inq
[0] & 0x1f) != 5)) {
653 gettext("Specified device does not appear to be a CDROM");
656 if ((errmsg
== NULL
) && (cond
& CHECK_DEVICE_NOT_READY
) &&
657 !test_unit_ready(dev
->d_fd
)) {
658 errmsg
= gettext("Device not ready");
661 /* Look at the capabilities page for this information */
662 if ((errmsg
== NULL
) && (cond
& CHECK_DEVICE_NOT_WRITABLE
)) {
663 if (!get_mode_page(dev
->d_fd
, 0x2a, 0, 4, page_code
) ||
664 ((page_code
[3] & 1) == 0)) {
665 errmsg
= gettext("Target device is not a CD writer");
669 if ((errmsg
== NULL
) && (cond
& CHECK_NO_MEDIA
)) {
670 if (!test_unit_ready(dev
->d_fd
) && (uscsi_status
== 2) &&
671 ((RQBUFLEN
- rqresid
) >= 14) &&
672 ((SENSE_KEY(rqbuf
) & 0x0f) == 2) && (ASC(rqbuf
) == 0x3A) &&
673 ((ASCQ(rqbuf
) == 0) || (ASCQ(rqbuf
) == 1) ||
674 (ASCQ(rqbuf
) == 2))) {
675 /* medium not present */
676 errmsg
= gettext("No media in device");
682 /* Issue READ DISC INFORMATION mmc command */
683 if ((errmsg
== NULL
) && ((cond
& CHECK_MEDIA_IS_NOT_BLANK
) ||
684 (cond
& CHECK_MEDIA_IS_NOT_WRITABLE
) ||
685 (cond
& CHECK_MEDIA_IS_NOT_ERASABLE
))) {
687 disc_info
= (uchar_t
*)my_zalloc(DISC_INFO_BLOCK_SIZE
);
688 if (!read_disc_info(dev
->d_fd
, disc_info
)) {
689 errmsg
= gettext("Cannot obtain disc information");
691 disc_status
= disc_info
[2] & 0x03;
692 erasable
= disc_info
[2] & 0x10;
695 if (errmsg
== NULL
) {
696 if (!erasable
&& (cond
& CHECK_MEDIA_IS_NOT_ERASABLE
))
698 "Media in the device is not erasable");
699 else if ((disc_status
!= 0) &&
700 (cond
& CHECK_MEDIA_IS_NOT_BLANK
))
702 "Media in the device is not blank");
703 else if ((disc_status
== 2) &&
704 (cond
& CHECK_MEDIA_IS_NOT_WRITABLE
) &&
705 ((device_type
!= DVD_PLUS_W
) &&
706 (device_type
!= DVD_PLUS
)))
708 "Media in the device is not writable");
713 if (cond
& EXIT_IF_CHECK_FAILED
) {
714 err_msg("%s.\n", errmsg
);
723 * Generic routine for writing whatever the next track is and taking
724 * care of the progress bar. Mode tells the track type (audio or data).
725 * Data from track is taken from the byte stream h
728 write_next_track(int mode
, bstreamhandle h
)
730 struct track_info
*ti
;
731 struct trackio_error
*te
;
734 ti
= (struct track_info
*)my_zalloc(sizeof (*ti
));
735 if ((build_track_info(target
, -1, ti
) == 0) ||
736 ((ti
->ti_flags
& TI_NWA_VALID
) == 0)) {
737 if ((device_type
== DVD_PLUS
) || (device_type
==
739 ti
->ti_flags
|= TI_NWA_VALID
;
742 "Cannot get writable address for the media.\n"));
746 if (ti
->ti_nwa
!= ti
->ti_start_address
) {
748 "Media state is not suitable for this write mode.\n"));
751 if (mode
== TRACK_MODE_DATA
) {
752 if (!(ti
->ti_track_mode
& 4)) {
753 /* Write track depends upon this bit */
754 ti
->ti_track_mode
|= TRACK_MODE_DATA
;
758 h
->bstr_size(h
, &size
);
760 te
= (struct trackio_error
*)my_zalloc(sizeof (*te
));
762 print_n_flush(gettext("Writing track %d..."), (int)ti
->ti_track_no
);
764 if (!write_track(target
, ti
, h
, progress
, size
, te
)) {
765 if (te
->err_type
== TRACKIO_ERR_USER_ABORT
) {
766 (void) str_print(gettext("Aborted.\n"), progress_pos
);
768 if (device_type
!= DVD_PLUS_W
) {
769 /* l10n_NOTE : 'failed' as in Writing Track...failed */
770 (void) str_print(gettext("failed.\n"),
775 /* l10n_NOTE : 'done' as in "Writing track 1...done" */
776 (void) str_print(gettext("done.\n"), progress_pos
);
784 if (scan_for_cd_device(SCAN_LISTDEVS
, NULL
) == 0) {
787 "No CD writers found, no media in the drive "
788 "or not on the console.\n"));
792 "Volume manager is not running.\n"));
794 "Please start volume manager or run cdrw as root to access all devices.\n"));
796 err_msg(gettext("No CD writers found.\n"));
804 get_media_type(int fd
)
806 uchar_t
*cap
= (uchar_t
*)my_zalloc(MMC_FTR_HDR_LEN
);
808 if (get_configuration(fd
, MMC_FTR_PRFL_LIST
,
809 MMC_FTR_HDR_LEN
, cap
)) {
811 (void) print_profile_list(fd
);
812 switch (read_scsi16(&cap
[6])) {
813 case 0x8: /* CD-ROM */
815 (void) printf("CD-ROM found\n");
817 * To avoid regression issues, treat as
818 * A cdrw, we will check the writable
819 * mode page to see if the media is
827 (void) printf("CD-R found\n");
831 case 0x10: /* DVD-ROM */
833 * Have seen drives return DVD+RW media
834 * DVD-ROM, so try treating it as a DVD+RW
835 * profile. checking for writable media
836 * is done through mode page 5.
839 (void) printf("DVD-ROM found\n");
840 device_type
= DVD_PLUS_W
;
843 case 0xA: /* CD-RW */
845 (void) printf("CD-RW found\n");
849 case 0x11: /* DVD-R */
851 (void) printf("DVD-R found\n");
852 device_type
= DVD_MINUS
;
855 case 0x12: /* DVD-RAM */
857 (void) printf("DVD-RAM found\n");
858 /* treat as CD-RW, may be a legacy drive */
862 case 0x13: /* DVD-RW restricted overwrite */
863 case 0x14: /* DVD-RW sequential */
865 (void) printf("DVD-RW found\n");
866 device_type
= DVD_MINUS
;
869 case 0x15: /* DVD-R Dual Layer Sequential Recording */
870 case 0x16: /* DVD-R Dual Layer Jump Recording */
872 (void) printf("DVD-R DL found\n");
873 device_type
= DVD_MINUS
;
876 case 0x17: /* DVD-RW Dual Layer */
878 (void) printf("DVD-RW DL found\n");
879 device_type
= DVD_MINUS
;
882 case 0x1A: /* DVD+RW */
884 (void) printf("DVD+RW found\n");
886 device_type
= DVD_PLUS_W
;
889 case 0x1B: /* DVD+R */
891 (void) printf("DVD+R found\n");
892 device_type
= DVD_PLUS
;
895 case 0x2A: /* DVD+RW Dual Layer */
897 (void) printf("DVD+RW DL found\n");
898 device_type
= DVD_PLUS_W
;
901 case 0x2B: /* DVD+R Dual Layer */
903 (void) printf("DVD+R DL found\n");
904 device_type
= DVD_PLUS
;
910 "unknown drive found\n type = 0x%x",
913 * Treat as CD_RW to avoid regression, may
922 /* Translate a transfer rate (eg, KB/s) into a Speed (eg, "2X") */
924 cdrw_bandwidth_to_x(uint_t rate
)
926 switch (device_type
) {
930 return (DVD_RATE_TO_X(rate
));
934 return (CD_RATE_TO_X(rate
));
938 /* Translate a Speed (eg, "2X") into a transfer rate (eg, KB/s) */
940 cdrw_x_to_bandwidth(uint_t x
)
942 switch (device_type
) {
946 return (DVD_X_TO_RATE(x
));
950 return (CD_X_TO_RATE(x
));