udftools

- Main Page
- Classes
- Files

- File List
- File Members

All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
ide-pc.c
Go to the documentation of this file.
1 /* ide-pc.c
2 *
3 * PURPOSE
4 * Execute most MMC commands on a ATAPI-Packet command CD(re)writer through IOCTL CDROM_SEND_PACKET
5 * Where similar routines and structures are defined in linux/ cdrom.h this program
6 * maintains structures strictly as defined MMC to facilitate the interface with the CDwriter
7 * at the expense of a simple user interface.
8 *
9 * COPYRIGHT
10 * This file is distributed under the terms of the GNU General Public
11 * License (GPL). Copies of the GPL can be obtained from:
12 * ftp://prep.ai.mit.edu/pub/gnu/GPL
13 * Each contributing author retains all rights to their own work.
14 *
15 * (C) 2001 Enno Fennema <e.fennema@dataweb.nl>
16 *
17 * HISTORY
18 *
19 * 16 Aug 01 ef Created.
20 */
21
22 #include "config.h"
23
24 #include <stdio.h>
25 #include <string.h>
26 #include <stdarg.h>
27 #include <errno.h>
28 #include <sys/ioctl.h>
29 #include <sys/types.h> /* for u_char etc. */
30 #include <linux/cdrom.h>
31 #include <unistd.h> /* sleep() */
32 #include <stdlib.h>
33
34 #include "bswap.h"
35 #include "ide-pc.h"
36
37 typedef struct cdrom_generic_command CGC;
38
39 static int rv; // -1 if ioctl failed, else equal stat
40 static struct request_sense sense_data;
41
42
43 void fail(char *fmt, ...) {
44 va_list args;
45
46 va_start(args, fmt);
47 vfprintf(stderr, fmt, args);
48 exit(1);
49 }
50
51 struct request_sense *
52 get_sense_data()
53 {
54 return &sense_data;
55 }
56
57 char*
58 get_sense_string()
59 {
60 static char str[128];
61
62 sprintf(str, "Stat %d Err %02X Key %02Xx; ASC %02Xx; ASCQ %02Xx; Info %02X%02X%02X%02Xx",
63 rv, sense_data.error_code, sense_data.sense_key, sense_data.asc, sense_data.ascq,
64 sense_data.information[0], sense_data.information[1], sense_data.information[2], sense_data.information[3]);
65 return str;
66 }
67
68 void initpc(CGC *pc) {
69 memset(pc,0,sizeof(*pc));
70 memset(&sense_data, 0 , sizeof(sense_data));
71 pc->sense=&sense_data;
72 pc->data_direction = CGC_DATA_NONE;
73 pc->timeout = 2500;
74 }
75
76 int
77 blank(int fd, int type, int start)
78 {
79 CGC pc;
80
81 initpc(&pc);
82 pc.cmd[0]=GPCMD_BLANK;
83 pc.cmd[1]= type & 7;
84 *(u_int*)&pc.cmd[2] = cpu_to_be32(start); /* blank track tail : lba to start blanking
85 * blank track : track number to blank */
86 return rv = ioctl(fd, CDROM_SEND_PACKET, &pc);
87 }
88
89 int
90 close_track_session(int fd, int close_track, int track)
91 {
92 CGC pc;
93
94 initpc(&pc);
95 pc.cmd[0] = GPCMD_CLOSE_TRACK;
96 pc.cmd[2] = close_track ? 0x01 : 0x02;
97 pc.cmd[5] = track;
98 return rv = ioctl(fd, CDROM_SEND_PACKET, &pc);
99 }
100
101 int
102 format(int fd, int session_grow, int size)
103 {
104 struct {
105 u_char flh_rsrv;
106 u_char flh_imm;
107 u_short flh_fdlen;
108 u_int id;
109 u_char fd_sg;
110 u_char fd_rsrv[3];
111 u_int fd_size;
112 } f;
113 CGC pc;
114
115 initpc(&pc);
116 pc.data_direction = CGC_DATA_WRITE;
117 memset(&f, 0, sizeof(f));
118 pc.buffer= (void*)&f;
119 pc.buflen= sizeof(f);
120 pc.cmd[0] = GPCMD_FORMAT_UNIT;
121 pc.cmd[1] = 0x17; /* Format Parameter List present; format 0x7 */
122 f.flh_fdlen = cpu_to_be16(8);
123 f.fd_sg = session_grow;
124 f.fd_size = cpu_to_be32(size);
125 return rv = ioctl(fd, CDROM_SEND_PACKET, &pc);
126 }
127
128
129 int
130 set_cdspeed(int fd, int readspeed, int writespeed)
131 {
132 CGC pc;
133
134 initpc(&pc);
135 pc.cmd[0]=GPCMD_SET_SPEED;
136 *(u_short*) &pc.cmd[2] = cpu_to_be16(readspeed);
137 *(u_short*) &pc.cmd[4] = cpu_to_be16(writespeed);
138
139 return rv = ioctl(fd, CDROM_SEND_PACKET, &pc);
140 }
141
142 int
143 synchronize_cache(int fd)
144 {
145 CGC pc;
146
147 initpc(&pc);
148 pc.cmd[0] = GPCMD_FLUSH_CACHE;
149 return rv = ioctl(fd, CDROM_SEND_PACKET, &pc);
150 }
151
152 int
153 test_unit_ready(int fd)
154 {
155 CGC pc;
156
157 initpc(&pc); /* Test Unit Ready command = 0x00 */
158 /* kernel returns -1 when CHECK_CONDITION status returned
159 * sense data is valid and gives further info
160 */
161 return rv = ioctl(fd, CDROM_SEND_PACKET, &pc);
162 }
163
164 int getDriveState(int fd ) {
165 int rv;
166
167 rv = test_unit_ready(fd);
168
169 if( rv ) sleep(2); /* wait a bit longer */
170
171 rv = test_unit_ready(fd);
172
173 if( rv < 0 )
174 return DS_NOT_READY;
175
176 if( rv == 0 )
177 return DS_OPERATIONAL;
178
179 if( sense_data.sense_key == 2 && sense_data.asc == 0x04 && sense_data.ascq == 0x04 )
180 return DS_OPERATIONAL;
181
182 if( sense_data.sense_key == 2 && sense_data.asc == 0x3A && sense_data.ascq == 2 )
183 return DS_TRAY_OPEN;
184
185 return DS_NO_DISC;
186 }
187
188 int
189 inquiry(int fd, struct cdrom_inquiry *inq)
190 {
191 CGC pc;
192
193 initpc(&pc);
194 pc.data_direction = CGC_DATA_READ;
195 pc.cmd[0]=GPCMD_INQUIRY;
196 pc.cmd[4]=sizeof(struct cdrom_inquiry);
197 pc.buffer= (void*)inq;
198 pc.buflen= sizeof(struct cdrom_inquiry);
199 return rv = ioctl(fd, CDROM_SEND_PACKET, &pc);
200 }
201
202 int
203 mediumRemoval(int fd, int allow)
204 {
205 CGC pc;
206
207 initpc(&pc);
208 pc.data_direction = CGC_DATA_NONE;
209 pc.cmd[0] = GPCMD_PREVENT_ALLOW_MEDIUM_REMOVAL;
210 pc.cmd[4] = allow;
211 return rv = ioctl(fd, CDROM_SEND_PACKET, &pc);
212 }
213
214 int
215 read_reccapacity(int fd, struct cdrom_reccapacity *reccap)
216 {
217 CGC pc;
218
219 initpc(&pc);
220 pc.data_direction = CGC_DATA_READ;
221 pc.cmd[0]=GPCMD_READ_CDVD_CAPACITY;
222 pc.buffer=(void*)reccap;
223 pc.buflen=sizeof(struct cdrom_reccapacity);
224 rv = ioctl(fd, CDROM_SEND_PACKET, &pc);
225 reccap->lastblock = be32_to_cpu(reccap->lastblock);
226 reccap->blocksize = be32_to_cpu(reccap->blocksize);
227 return rv;
228 }
229
230 int
231 read_buffercapacity(int fd, struct cdrom_buffercapacity *bufcap)
232 {
233 CGC pc;
234
235 initpc(&pc);
236 pc.data_direction = CGC_DATA_READ;
237 pc.cmd[0] = 0x5C; // READ BUFFER CAPACITY
238 *(u_short*)&pc.cmd[7] = cpu_to_be16(sizeof(struct cdrom_buffercapacity));
239 pc.buffer=(void*)bufcap;
240 pc.buflen=sizeof(struct cdrom_buffercapacity);
241 rv = ioctl(fd, CDROM_SEND_PACKET, &pc);
242 bufcap->totalBufferLength = be32_to_cpu(bufcap->totalBufferLength);
243 bufcap->freeBufferLength = be32_to_cpu(bufcap->freeBufferLength);
244 return rv;
245 }
246
247 int
248 reserve_track(int fd, int size)
249 {
250 CGC pc;
251
252 initpc(&pc);
253 pc.cmd[0]=GPCMD_RESERVE_RZONE_TRACK; /* 0x53 */
254 *(u_int*)&pc.cmd[5] = cpu_to_be32(size);
255 return rv = ioctl(fd, CDROM_SEND_PACKET, &pc);
256 }
257
258 int
259 startStopUnit(int fd, int action)
260 {
261 CGC pc;
262
263 initpc(&pc);
264 pc.cmd[0] = GPCMD_START_STOP_UNIT;
265 pc.cmd[4] = action;
266 return rv = ioctl(fd, CDROM_SEND_PACKET, &pc);
267 }
268
269 int
270 read_discinfo(int fd, struct cdrom_discinfo *di)
271 {
272 CGC pc;
273
274 initpc(&pc);
275 pc.data_direction = CGC_DATA_READ;
276
277 pc.cmd[0]=GPCMD_READ_DISC_INFO;
278 *(u_short*) &pc.cmd[7] = cpu_to_be16( sizeof(struct cdrom_discinfo) );
279 pc.buffer=(void*)di;
280 pc.buflen=sizeof(struct cdrom_discinfo);
281
282 rv = ioctl(fd, CDROM_SEND_PACKET, &pc);
283
284 di->data_length = be16_to_cpu(di->data_length);
285 di->disc_id = be32_to_cpu(di->disc_id);
286 return rv;
287 }
288
289 int
290 read_header(int fd, struct cdrom_header *hd, u_int block)
291 {
292 CGC pc;
293
294 initpc(&pc);
295 pc.data_direction = CGC_DATA_READ;
296 pc.cmd[0]=GPCMD_READ_HEADER;
297 *(u_int*)&pc.cmd[2] = cpu_to_be32( block);
298 *(u_short*)&pc.cmd[7] = cpu_to_be16( sizeof(struct cdrom_header) );
299 pc.buffer=(void*)hd;
300 pc.buflen=sizeof(struct cdrom_header);
301 rv = ioctl(fd, CDROM_SEND_PACKET, &pc);
302 hd->lba = be32_to_cpu(hd->lba);
303 return rv;
304 }
305
306
307 int
308 read_trackinfo(int fd, struct cdrom_trackinfo *ti, int trackno)
309 {
310 CGC pc;
311
312 initpc(&pc);
313 pc.data_direction = CGC_DATA_READ;
314 pc.cmd[0]=GPCMD_READ_TRACK_RZONE_INFO;
315 pc.cmd[1]=1;
316 *(u_int*)&pc.cmd[2] = cpu_to_be32( trackno );
317 *(u_short*)&pc.cmd[7] = cpu_to_be16( sizeof(struct cdrom_trackinfo) ); /* 28; if higher data underrun error */
318 pc.buffer=(void*)ti;
319 pc.buflen=sizeof(struct cdrom_trackinfo);
320 rv = ioctl(fd, CDROM_SEND_PACKET, &pc);
321 ti->data_length = be16_to_cpu(ti->data_length);
322 ti->trk_start = be32_to_cpu(ti->trk_start);
323 ti->nwa = be32_to_cpu(ti->nwa);
324 ti->free_blks = be32_to_cpu(ti->free_blks);
325 ti->fixpkt_size = be32_to_cpu(ti->fixpkt_size);
326 ti->trk_size = be32_to_cpu(ti->trk_size);
327 return rv;
328 }
329
330
331 int
332 readCD(int fd, int sectortype, int lba, int n, unsigned char* buf)
333 {
334 CGC pc;
335
336 initpc(&pc);
337 pc.data_direction = CGC_DATA_READ;
338 pc.cmd[0]=GPCMD_READ_CD;
339 pc.cmd[1]=sectortype << 2; /* Sector type per MCC table 31 */
340 *(int*) &pc.cmd[2] = cpu_to_be32(lba);
341 pc.cmd[8]=n; /* read n blocks */
342 pc.cmd[9]=0x10; /* user data only */
343 pc.buffer=buf;
344 pc.buflen=n * 2048;
345 return rv = ioctl(fd, CDROM_SEND_PACKET, &pc);
346 }
347
348 int
349 writeCD(int fd, int lba, int nblks, unsigned char* buf)
350 {
351 CGC pc;
352
353 initpc(&pc);
354 pc.data_direction = CGC_DATA_WRITE;
355 pc.cmd[0] = GPCMD_WRITE_10;
356 pc.cmd[1] = 0; /* DPO 0x10; FUA 0x08 */
357 *(u_int*) &pc.cmd[2] = cpu_to_be32(lba);
358 *(u_short*)&pc.cmd[7] = cpu_to_be16(nblks);
359 pc.buffer = buf;
360 pc.buflen = nblks * 2048;
361 return rv = ioctl(fd, CDROM_SEND_PACKET, &pc);
362 }
363
364
365 #ifdef MMC2 // VERIFY and WRITE_AND_VERIFY are new in MMC2 and not supported by my HP8100
366 int
367 verify(int fd, int lba, int nblocks)
368 {
369 CGC pc;
370
371 initpc(&pc);
372 pc.cmd[0] = GPCMD_VERIFY_10;
373 pc.cmd[1] = 0;
374 *(u_int*) &pc.cmd[2] = cpu_to_be32(lba);
375 pc.cmd[8] = (u_char) nblocks;
376 return rv = ioctl(fd, CDROM_SEND_PACKET, &pc);
377 }
378 #endif
379
380 /*
381 * mode_sense
382 * Returns 8 byte header followed by actual mode page. The HP 8100 recognizes:
383 * 1 - Read Error Recovery page
384 * In MtFuji this is called Read/Write Error recovery mode page
385 * The separate Verify Error Recovery Mode page of SCSI-2 draft has gone.
386 * The HP8100 recovers a change mask of 01 06 36 FF 00 00 00 00
387 * This would mean retry count 0 to 255 acceptable
388 * and TB, RC, PER and DTE bits settable. Not the DCR bit.
389 * Could these also affect a verify operation. MtFuji VERIFY says no.
390 * 5 - Write parameters page
391 * 8 - Media supported mode page
392 * D - CD-ROM page: Inactivity time, seconds/minute, frames/second
393 * E - CD-ROM Audio Control page
394 * 1D - Timeout and protect (MtFuji 12.11.3.5)
395 * 2A - CD Capabilities mode page
396 * 2F - ASCII message ? : '(c) 1997-1998 HP, license available'
397 */
398
399 int
400 mode_select(int fd, u_char *buffer)
401 {
402 CGC pc;
403 int len = 2 + be16_to_cpu(((mode_hdr*)buffer)->data_length);
404
405 initpc(&pc);
406 pc.data_direction = CGC_DATA_WRITE;
407 pc.cmd[0] = GPCMD_MODE_SELECT_10;
408 pc.cmd[1] = 0x10; // PF bit
409 pc.buffer = buffer;
410 pc.buflen = len;
411 *(u_short*) &pc.cmd[7] = cpu_to_be16(len);
412 return rv = ioctl(fd, CDROM_SEND_PACKET, &pc);
413 }
414
415 int
416 mode_sense(int fd, u_char **buffer, u_char **mode, u_char pageno, int pgctl)
417 {
418 CGC pc;
419 mode_hdr h;
420 int len, offset;
421
422 memset(&h, 0x00, sizeof(mode_hdr));
423
424 initpc(&pc);
425 pc.data_direction = CGC_DATA_READ;
426 pc.cmd[0] = GPCMD_MODE_SENSE_10;
427 pc.cmd[2] = (pgctl<<6) + (pageno & 0x3F);
428 *(u_short*) &pc.cmd[7] = cpu_to_be16(sizeof(mode_hdr));
429 pc.buffer = (void *)&h;
430 pc.buflen = sizeof(mode_hdr);
431 rv = ioctl(fd, CDROM_SEND_PACKET, &pc);
432
433 if( rv ) {
434 printf("mode_sense(1): stat %d\n", rv);
435 return rv;
436 }
437
438 len = 2 + be16_to_cpu(h.data_length);
439 offset = 8 + be16_to_cpu(h.block_desc_length);
440
441 *buffer = (u_char*) calloc(len, sizeof(u_char));
442 *mode = &(*buffer)[offset];
443 pc.buffer = *buffer;
444
445 pc.buflen = len;
446 *(u_short*) &pc.cmd[7] = cpu_to_be16(len);
447 return ioctl(fd, CDROM_SEND_PACKET, &pc);
448 }
449
450
451 // MMC-2 feature not supported by my HP 8100 CD-Writer
452 #ifdef MMC2
453 int
454 get_configuration(int fd, u_char* buffer, int size, u_char feature)
455 {
456 int i, realsize;
457 CGC pc;
458
459 initpc(&pc);
460 pc.data_direction = CGC_DATA_READ;
461 pc.cmd[0] = 0x46; // GET CONFIGURATION
462 *(u_short*) &pc.cmd[2] = cpu_to_be16(feature);
463 *(u_short*) &pc.cmd[7] = cpu_to_be16(8); // only to see how much will be returned
464 pc.buffer=(void*)buffer;
465 if( size < 8 ) return -EINVAL;
466 pc.buflen = 8;
467 rv = ioctl(fd, CDROM_SEND_PACKET, &pc);
468
469 if( rv )
470 return rv;
471
472 realsize = be32_to_cpu((int)buffer[0]) + 4;
473 if( realsize < size ) {
474 pc.buflen = realsize;
475 *(u_short*) &pc.cmd[7] = cpu_to_be16(realsize);
476 } else {
477 pc.buflen = size;
478 *(u_short*) &pc.cmd[7] = cpu_to_be16(size);
479 }
480 return rv = ioctl(fd, CDROM_SEND_PACKET, &pc);
481 }
482 #endif // MMC2
483
484
485 int
486 get_writeparams(int fd, u_char **buffer, struct cdrom_writeparams **wp, int pgctl)
487 {
488 rv = mode_sense(fd, buffer, (u_char**) wp, 0x05, pgctl);
489 (*wp)->pkt_size = be32_to_cpu((*wp)->pkt_size);
490 (*wp)->audio_pause = be16_to_cpu((*wp)->audio_pause);
491 return rv;
492 }
493
494 int
495 set_writeparams(int fd, u_char *buffer, struct cdrom_writeparams *wp)
496 {
497 wp->pkt_size = cpu_to_be32(wp->pkt_size);
498 wp->audio_pause = cpu_to_be16(wp->audio_pause);
499
500 rv = mode_select(fd, buffer);
501
502 wp->pkt_size = be32_to_cpu(wp->pkt_size);
503 wp->audio_pause = be16_to_cpu(wp->audio_pause);
504 return rv;
505 }
506
507
508 int
509 get_capabilities(int fd, u_char **buffer, struct cdrom_capabilities **cap, int pgctl)
510 {
511 rv = mode_sense(fd, buffer, (u_char**) cap, GPMODE_CAPABILITIES_PAGE, pgctl);
512
513 (*cap)->max_read_speed = be16_to_cpu((*cap)->max_read_speed);
514 (*cap)->num_vol_levels = be16_to_cpu((*cap)->num_vol_levels);
515 (*cap)->buffer_size = be16_to_cpu((*cap)->buffer_size);
516 (*cap)->cur_read_speed = be16_to_cpu((*cap)->cur_read_speed);
517 (*cap)->max_write_speed = be16_to_cpu((*cap)->max_write_speed);
518 (*cap)->cur_write_speed = be16_to_cpu((*cap)->cur_write_speed);
519 return rv;
520 }
521
cdrom_trackinfo::trk_size
u_int trk_size
Definition: ide-pc.h:115
set_writeparams
int set_writeparams(int fd, u_char *buffer, struct cdrom_writeparams *wp)
Definition: ide-pc.c:495
read_buffercapacity
int read_buffercapacity(int fd, struct cdrom_buffercapacity *bufcap)
Definition: ide-pc.c:231
get_writeparams
int get_writeparams(int fd, u_char **buffer, struct cdrom_writeparams **wp, int pgctl)
Definition: ide-pc.c:486
cdrom_header::lba
int lba
Definition: ide-pc.h:133
cdrom_discinfo::data_length
u_short data_length
Definition: ide-pc.h:63
close_track
int close_track(int fd, unsigned int track)
Definition: cdrwtool.c:528
cdrom_inquiry
Definition: ide-pc.h:24
synchronize_cache
int synchronize_cache(int fd)
Definition: ide-pc.c:143
be32_to_cpu
#define be32_to_cpu(x)
Definition: cdrwtool.h:106
cdrom_buffercapacity::freeBufferLength
u_int freeBufferLength
Definition: ide-pc.h:122
blank
int blank(int fd, int type, int start)
Definition: ide-pc.c:77
sectortype
int sectortype
Definition: wrudf-cdrw.c:63
cdrom_trackinfo::nwa
u_int nwa
Definition: ide-pc.h:112
DS_NO_DISC
#define DS_NO_DISC
Definition: ide-pc.h:332
get_sense_string
char * get_sense_string()
Definition: ide-pc.c:58
cdrom_reccapacity::blocksize
u_int blocksize
Definition: ide-pc.h:127
mode_header::block_desc_length
u_short block_desc_length
Definition: ide-pc.h:146
cpu_to_be16
#define cpu_to_be16(x)
Definition: bswap.h:262
cdrom_capabilities
Definition: ide-pc.h:232
cdrom_trackinfo::trk_start
u_int trk_start
Definition: ide-pc.h:111
ide-pc.h
cdrom_writeparams::audio_pause
u_short audio_pause
Definition: ide-pc.h:223
DS_NOT_READY
#define DS_NOT_READY
Definition: ide-pc.h:334
set_cdspeed
int set_cdspeed(int fd, int readspeed, int writespeed)
Definition: ide-pc.c:130
mode_hdr
struct mode_header mode_hdr
mode_header::data_length
u_short data_length
Definition: ide-pc.h:142
mediumRemoval
int mediumRemoval(int fd, int allow)
Definition: ide-pc.c:203
cdrom_trackinfo::fixpkt_size
u_int fixpkt_size
Definition: ide-pc.h:114
mode_select
int mode_select(int fd, u_char *buffer)
Definition: ide-pc.c:400
cdrom_header
Definition: ide-pc.h:130
read_discinfo
int read_discinfo(int fd, struct cdrom_discinfo *di)
Definition: ide-pc.c:270
cdrom_discinfo::disc_id
u_int disc_id
Definition: ide-pc.h:87
cdrom_trackinfo::free_blks
u_int free_blks
Definition: ide-pc.h:113
writeCD
int writeCD(int fd, int lba, int nblks, unsigned char *buf)
Definition: ide-pc.c:349
fail
void fail(char *fmt,...)
Definition: ide-pc.c:43
test_unit_ready
int test_unit_ready(int fd)
Definition: ide-pc.c:153
DS_OPERATIONAL
#define DS_OPERATIONAL
Definition: ide-pc.h:331
reserve_track
int reserve_track(int fd, int size)
Definition: ide-pc.c:248
CGC
struct cdrom_generic_command CGC
Definition: ide-pc.c:37
format
int format(int fd, int session_grow, int size)
Definition: ide-pc.c:102
read_trackinfo
int read_trackinfo(int fd, struct cdrom_trackinfo *ti, int trackno)
Definition: ide-pc.c:308
cpu_to_be32
#define cpu_to_be32(x)
Definition: bswap.h:263
rv
static int rv
Definition: ide-pc.c:39
get_capabilities
int get_capabilities(int fd, u_char **buffer, struct cdrom_capabilities **cap, int pgctl)
Definition: ide-pc.c:509
inquiry
int inquiry(int fd, struct cdrom_inquiry *inq)
Definition: ide-pc.c:189
be16_to_cpu
#define be16_to_cpu(x)
Definition: cdrwtool.h:99
close_track_session
int close_track_session(int fd, int close_track, int track)
Definition: ide-pc.c:90
bswap.h
sense_data
static struct request_sense sense_data
Definition: ide-pc.c:40
DS_TRAY_OPEN
#define DS_TRAY_OPEN
Definition: ide-pc.h:333
readCD
int readCD(int fd, int sectortype, int lba, int n, unsigned char *buf)
Definition: ide-pc.c:332
verify
int verify(int fd, int sectortype, int lba, int nblocks, char *buf)
read_header
int read_header(int fd, struct cdrom_header *hd, u_int block)
Definition: ide-pc.c:290
cdrom_buffercapacity
Definition: ide-pc.h:118
cdrom_buffercapacity::totalBufferLength
u_int totalBufferLength
Definition: ide-pc.h:121
read_reccapacity
int read_reccapacity(int fd, struct cdrom_reccapacity *reccap)
Definition: ide-pc.c:215
get_sense_data
struct request_sense * get_sense_data()
Definition: ide-pc.c:52
cdrom_reccapacity
Definition: ide-pc.h:125
cdrom_writeparams
Definition: ide-pc.h:179
cdrom_trackinfo::data_length
u_short data_length
Definition: ide-pc.h:96
mode_sense
int mode_sense(int fd, u_char **buffer, u_char **mode, u_char pageno, int pgctl)
Definition: ide-pc.c:416
initpc
void initpc(CGC *pc)
Definition: ide-pc.c:68
mode_header
Definition: ide-pc.h:141
cdrom_trackinfo
Definition: ide-pc.h:95
getDriveState
int getDriveState(int fd)
Definition: ide-pc.c:164
cdrom_reccapacity::lastblock
u_int lastblock
Definition: ide-pc.h:126
startStopUnit
int startStopUnit(int fd, int action)
Definition: ide-pc.c:259
ti
struct cdrom_trackinfo ti
Definition: wrudf-cdrw.c:50
cdrom_discinfo
Definition: ide-pc.h:62