1
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
4
* Copyright (C) Philippe Rouquier 2005-2009 <bonfire-app@wanadoo.fr>
6
* Libbrasero-media is free software; you can redistribute it and/or modify
7
* it under the terms of the GNU General Public License as published by
8
* the Free Software Foundation; either version 2 of the License, or
9
* (at your option) any later version.
11
* The Libbrasero-media authors hereby grant permission for non-GPL compatible
12
* GStreamer plugins to be used and distributed together with GStreamer
13
* and Libbrasero-media. This permission is above and beyond the permissions granted
14
* by the GPL license by which Libbrasero-media is covered. If you modify this code
15
* you may extend this exception to your version of the code, but you are not
16
* obligated to do so. If you do not wish to do so, delete this exception
17
* statement from your version.
19
* Libbrasero-media is distributed in the hope that it will be useful,
20
* but WITHOUT ANY WARRANTY; without even the implied warranty of
21
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22
* GNU Library General Public License for more details.
24
* You should have received a copy of the GNU General Public License
25
* along with this program; if not, write to:
26
* The Free Software Foundation, Inc.,
27
* 51 Franklin Street, Fifth Floor
28
* Boston, MA 02110-1301, USA.
37
#include "scsi-error.h"
38
#include "scsi-utils.h"
39
#include "scsi-base.h"
40
#include "scsi-command.h"
41
#include "scsi-opcodes.h"
42
#include "scsi-read-cd.h"
44
#if G_BYTE_ORDER == G_LITTLE_ENDIAN
46
struct _BraseroReadCDCDB {
72
struct _BraseroReadCDCDB {
98
typedef struct _BraseroReadCDCDB BraseroReadCDCDB;
100
BRASERO_SCSI_COMMAND_DEFINE (BraseroReadCDCDB,
105
brasero_mmc1_read_block (BraseroDeviceHandle *handle,
107
BraseroScsiBlockType type,
108
BraseroScsiBlockHeader header,
109
BraseroScsiBlockSubChannel channel,
112
unsigned char *buffer,
114
BraseroScsiErrCode *error)
116
BraseroReadCDCDB *cdb;
117
BraseroScsiResult res;
119
cdb = brasero_scsi_command_new (&info, handle);
120
BRASERO_SET_32 (cdb->start_lba, start);
122
/* NOTE: if we just want to test if block is readable len can be 0 */
123
BRASERO_SET_24 (cdb->len, size);
125
/* reladr should be O */
126
/* no sync field included */
130
cdb->sec_type = type;
133
cdb->header = header;
135
/* returns user data ?*/
136
cdb->user_data = user_data;
139
/* no error/C2 error */
142
cdb->subchannel = channel;
145
memset (buffer, 0, buffer_len);
147
res = brasero_scsi_command_issue_sync (cdb,
151
brasero_scsi_command_free (cdb);