mirror of
https://github.com/eried/portapack-mayhem.git
synced 2024-10-01 01:26:06 -04:00
Sd over usb macos (#1096)
* sd over usb works at least up to intel + big sur, not yet on m1 + ventura * style
This commit is contained in:
parent
c3264f0d15
commit
2fd3bf0136
@ -175,6 +175,22 @@ uint8_t mode_sense6(msd_cbw_t* msd_cbw_data) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
uint8_t mode_sense10(msd_cbw_t* msd_cbw_data) {
|
||||
(void)msd_cbw_data;
|
||||
|
||||
scsi_mode_sense10_response_t ret = {
|
||||
.byte = {
|
||||
cpu_to_be16(sizeof(scsi_mode_sense6_response_t) - 2),
|
||||
0,
|
||||
0,
|
||||
0}};
|
||||
|
||||
memcpy(&usb_bulk_buffer[0], &ret, sizeof(scsi_mode_sense10_response_t));
|
||||
usb_send_bulk(&usb_bulk_buffer[0], sizeof(scsi_mode_sense10_response_t));
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static data_request_t decode_data_request(const uint8_t* cmd) {
|
||||
data_request_t req;
|
||||
uint32_t lba;
|
||||
@ -254,6 +270,10 @@ void scsi_command(msd_cbw_t* msd_cbw_data) {
|
||||
status = mode_sense6(msd_cbw_data);
|
||||
break;
|
||||
|
||||
case SCSI_CMD_MODE_SENSE_10:
|
||||
status = mode_sense10(msd_cbw_data);
|
||||
break;
|
||||
|
||||
case SCSI_CMD_READ_FORMAT_CAPACITIES:
|
||||
status = read_format_capacities(msd_cbw_data);
|
||||
break;
|
||||
|
@ -35,13 +35,11 @@
|
||||
#include "hackrf_core.h"
|
||||
#include "usb_bulk_buffer.h"
|
||||
|
||||
#define MSD_CBW_SIGNATURE 0x43425355
|
||||
#define MSD_CSW_SIGNATURE 0x53425355
|
||||
|
||||
#define SCSI_CMD_TEST_UNIT_READY 0x00
|
||||
#define SCSI_CMD_REQUEST_SENSE 0x03
|
||||
#define SCSI_CMD_INQUIRY 0x12
|
||||
#define SCSI_CMD_MODE_SENSE_6 0x1A
|
||||
#define SCSI_CMD_MODE_SENSE_10 0x5A
|
||||
#define SCSI_CMD_START_STOP_UNIT 0x1B
|
||||
#define SCSI_CMD_SEND_DIAGNOSTIC 0x1D
|
||||
#define SCSI_CMD_PREVENT_ALLOW_MEDIUM_REMOVAL 0x1E
|
||||
@ -81,8 +79,8 @@
|
||||
#define SCSI_ASENSEQ_INIT_COMMAND_REQUIRED 0x02
|
||||
#define SCSI_ASENSEQ_OPERATION_IN_PROGRESS 0x07
|
||||
|
||||
#define MSD_CBW_SIGNATURE 0x43425355
|
||||
#define MSD_CSW_SIGNATURE 0x53425355
|
||||
#define MSD_CBW_SIGNATURE 0x43425355 // USBC
|
||||
#define MSD_CSW_SIGNATURE 0x53425355 // USBS
|
||||
|
||||
#define USB_TRANSFER_SIZE 0x2000
|
||||
|
||||
@ -136,6 +134,10 @@ typedef struct {
|
||||
uint8_t byte[4];
|
||||
} scsi_mode_sense6_response_t;
|
||||
|
||||
typedef struct {
|
||||
uint16_t byte[4];
|
||||
} scsi_mode_sense10_response_t;
|
||||
|
||||
typedef struct {
|
||||
uint32_t first_lba;
|
||||
uint16_t blk_cnt;
|
||||
|
Loading…
Reference in New Issue
Block a user