mirror of
https://github.com/fhgwright/SCSI2SD.git
synced 2025-04-10 01:37:07 +00:00
Fix input of size fieds and CDROM sector length in scsi2sd-util
This commit is contained in:
parent
6e10264827
commit
124ccf1d64
@ -167,8 +167,11 @@ void process_Status()
|
||||
message = MSG_COMMAND_COMPLETE;
|
||||
}
|
||||
|
||||
// TODO OMTI ENABLE VIA CONFIG
|
||||
// scsiDev.status |= (scsiDev.target->targetId & 0x03) << 5 ;
|
||||
|
||||
if (scsiDev.target->cfg->quirks == CONFIG_QUIRKS_OMTI)
|
||||
{
|
||||
scsiDev.status |= (scsiDev.target->targetId & 0x03) << 5;
|
||||
}
|
||||
|
||||
scsiWriteByte(scsiDev.status);
|
||||
|
||||
|
@ -84,6 +84,7 @@ ifeq ($(TARGET),Darwin)
|
||||
all: $(BUILD)/scsi2sd-util.dmg
|
||||
|
||||
$(BUILD)/scsi2sd-util.dmg: $(BUILD)/scsi2sd-util $(BUILD)/scsi2sd-monitor
|
||||
rm -rf $(dir $@)/dmg $@
|
||||
mkdir -p $(dir $@)/dmg
|
||||
cp $(BUILD)/scsi2sd-util $(BUILD)/scsi2sd-monitor $(dir $@)/dmg
|
||||
chmod a+rx $(dir $@)/dmg/*
|
||||
@ -92,7 +93,7 @@ endif
|
||||
|
||||
export CC CXX
|
||||
|
||||
all: $(BUILD)/scsi2sd-util$(EXE) $(BUILD)/scsi2sd-monitor$(EXE)
|
||||
all: $(BUILD)/scsi2sd-util$(EXE) $(BUILD)/scsi2sd-monitor$(EXE) $(BUILD)/scsi2sd-bulk$(EXE)
|
||||
|
||||
CYAPI = \
|
||||
$(BUILD)/cybtldr_api2.o \
|
||||
@ -107,16 +108,20 @@ HIDAPI = \
|
||||
endif
|
||||
|
||||
|
||||
OBJ = \
|
||||
CONSOLEOBJ = \
|
||||
$(CYAPI) $(HIDAPI) \
|
||||
$(BUILD)/ConfigUtil.o \
|
||||
$(BUILD)/Firmware.o \
|
||||
$(BUILD)/BoardPanel.o \
|
||||
$(BUILD)/TargetPanel.o \
|
||||
$(BUILD)/SCSI2SD_Bootloader.o \
|
||||
$(BUILD)/SCSI2SD_HID.o \
|
||||
$(BUILD)/hidpacket.o \
|
||||
|
||||
OBJ = \
|
||||
${CONSOLEOBJ} \
|
||||
$(BUILD)/ConfigUtil.o \
|
||||
$(BUILD)/BoardPanel.o \
|
||||
$(BUILD)/TargetPanel.o \
|
||||
$(BUILD)/hidpacket.o \
|
||||
|
||||
EXEOBJ = \
|
||||
$(BUILD)/scsi2sd-util.o \
|
||||
$(BUILD)/scsi2sd-monitor.o \
|
||||
@ -193,6 +198,10 @@ $(BUILD)/scsi2sd-monitor$(EXE): $(OBJ) $(BUILD)/scsi2sd-monitor.o
|
||||
mkdir -p $(dir $@)
|
||||
$(CXX) $(CXXFLAGS) $^ $(LDFLAGS_WX) $(LDFLAGS) -o $@
|
||||
|
||||
$(BUILD)/scsi2sd-bulk$(EXE): $(CONSOLEOBJ) $(BUILD)/scsi2sd-bulk.o
|
||||
mkdir -p $(dir $@)
|
||||
$(CXX) $(CXXFLAGS) $^ $(LDFLAGS) -o $@
|
||||
|
||||
clean:
|
||||
rm $(BUILD)/scsi2sd-util$(EXE) $(OBJ) $(BUILD)/libzipper/buildstamp
|
||||
|
||||
|
@ -18,14 +18,6 @@
|
||||
#include "scsi2sd.h"
|
||||
#include "hidpacket.h"
|
||||
|
||||
// For compilers that support precompilation, includes "wx/wx.h".
|
||||
#include <wx/wxprec.h>
|
||||
#ifndef WX_PRECOMP
|
||||
#include <wx/wx.h>
|
||||
#endif
|
||||
|
||||
#include <wx/utils.h>
|
||||
|
||||
#include <cassert>
|
||||
#include <stdexcept>
|
||||
#include <sstream>
|
||||
|
@ -310,10 +310,6 @@ TargetPanel::evaluate()
|
||||
|
||||
switch (myDeviceTypeCtrl->GetSelection())
|
||||
{
|
||||
case CONFIG_OPTICAL:
|
||||
mySectorSizeCtrl->ChangeValue("2048");
|
||||
mySectorSizeCtrl->Enable(true); // Enable override
|
||||
break;
|
||||
case CONFIG_FLOPPY_14MB:
|
||||
mySectorSizeCtrl->ChangeValue("512");
|
||||
mySectorSizeCtrl->Enable(false);
|
||||
@ -321,9 +317,9 @@ TargetPanel::evaluate()
|
||||
myNumSectorCtrl->Enable(false);
|
||||
mySizeUnitCtrl->Enable(false);
|
||||
mySizeCtrl->Enable(false);
|
||||
evaluateSize();
|
||||
break;
|
||||
};
|
||||
evaluateSize();
|
||||
|
||||
if (myAutoStartSectorCtrl->IsChecked())
|
||||
{
|
||||
@ -420,6 +416,16 @@ TargetPanel::evaluate()
|
||||
template<typename EvtType> void
|
||||
TargetPanel::onInput(EvtType& event)
|
||||
{
|
||||
if (event.GetId() == ID_deviceTypeCtrl)
|
||||
{
|
||||
switch (myDeviceTypeCtrl->GetSelection())
|
||||
{
|
||||
case CONFIG_OPTICAL:
|
||||
mySectorSizeCtrl->ChangeValue("2048");
|
||||
evaluateSize();
|
||||
break;
|
||||
}
|
||||
}
|
||||
wxCommandEvent changeEvent(ConfigChangedEvent);
|
||||
wxPostEvent(myParent, changeEvent);
|
||||
}
|
||||
@ -429,11 +435,18 @@ TargetPanel::onSizeInput(wxCommandEvent& event)
|
||||
{
|
||||
if (event.GetId() != ID_numSectorCtrl)
|
||||
{
|
||||
std::stringstream ss;
|
||||
ss << convertUnitsToSectors().first;
|
||||
myNumSectorCtrl->ChangeValue(ss.str());
|
||||
std::pair<uint32_t, bool> sec = convertUnitsToSectors();
|
||||
if (sec.second)
|
||||
{
|
||||
std::stringstream ss;
|
||||
ss << sec.first;
|
||||
myNumSectorCtrl->ChangeValue(ss.str());
|
||||
}
|
||||
}
|
||||
if (event.GetId() != ID_sizeCtrl)
|
||||
{
|
||||
evaluateSize();
|
||||
}
|
||||
evaluateSize();
|
||||
onInput(event); // propagate
|
||||
}
|
||||
|
||||
|
101
software/scsi2sd-util/scsi2sd-bulk.cc
Normal file
101
software/scsi2sd-util/scsi2sd-bulk.cc
Normal file
@ -0,0 +1,101 @@
|
||||
#include "SCSI2SD_Bootloader.hh"
|
||||
#include "SCSI2SD_HID.hh"
|
||||
#include "Firmware.hh"
|
||||
|
||||
#include <iostream>
|
||||
#include <algorithm>
|
||||
#include <iomanip>
|
||||
#include <vector>
|
||||
#include <set>
|
||||
#include <sstream>
|
||||
|
||||
#if __cplusplus >= 201103L
|
||||
#include <cstdint>
|
||||
#include <memory>
|
||||
using std::shared_ptr;
|
||||
#else
|
||||
#include <stdint.h>
|
||||
#include <tr1/memory>
|
||||
using std::tr1::shared_ptr;
|
||||
#endif
|
||||
|
||||
#include <unistd.h>
|
||||
|
||||
|
||||
#define MIN_FIRMWARE_VERSION 0x0400
|
||||
|
||||
using namespace SCSI2SD;
|
||||
|
||||
extern "C"
|
||||
void ProgressUpdate(unsigned char arrayId, unsigned short rowNum)
|
||||
{
|
||||
std::cout << "." << std::flush;
|
||||
}
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
if (argc < 2)
|
||||
{
|
||||
std::cerr << "Usage: " << argv[0] << " {firmware.cyacd}" << std::endl;
|
||||
exit(1);
|
||||
}
|
||||
std::string filename(argv[1]);
|
||||
|
||||
std::cout << "Searching for SCSI2SD device ..." << std::endl;
|
||||
|
||||
while (true)
|
||||
{
|
||||
shared_ptr<Bootloader> bootloader;
|
||||
try
|
||||
{
|
||||
shared_ptr<HID> hid(HID::Open());
|
||||
if (hid)
|
||||
{
|
||||
std::cout << "Resetting SCSI2SD into bootloader" << std::endl;
|
||||
usleep(100000);
|
||||
hid->enterBootloader();
|
||||
usleep(100000);
|
||||
}
|
||||
|
||||
bootloader.reset(Bootloader::Open());
|
||||
} catch (...) {}
|
||||
|
||||
if (bootloader)
|
||||
{
|
||||
std::cout << "Upgrading firmware from file: " << filename << std::endl;
|
||||
|
||||
try
|
||||
{
|
||||
bootloader->load(filename, &ProgressUpdate);
|
||||
usleep(2000000);
|
||||
std::cerr << "\nFirmware update successful" << std::endl;
|
||||
|
||||
|
||||
// Wait for disconnect
|
||||
shared_ptr<HID> hid(HID::Open());
|
||||
|
||||
while (bootloader || hid)
|
||||
{
|
||||
usleep(100000);
|
||||
try {
|
||||
hid.reset(HID::Open());
|
||||
usleep(100000);
|
||||
bootloader.reset(Bootloader::Open());
|
||||
usleep(100000);
|
||||
} catch (...) {}
|
||||
}
|
||||
std::cout << "Searching for SCSI2SD device ..." << std::endl;
|
||||
}
|
||||
catch (std::exception& e)
|
||||
{
|
||||
std::cerr << "Firmware update failed: " << e.what() << std::endl;
|
||||
abort();
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
usleep(100000);
|
||||
}
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user