message = MSG_COMMAND_COMPLETE;\r
}\r
\r
-// TODO OMTI ENABLE VIA CONFIG\r
-// scsiDev.status |= (scsiDev.target->targetId & 0x03) << 5 ;\r
+\r
+ if (scsiDev.target->cfg->quirks == CONFIG_QUIRKS_OMTI)\r
+ {\r
+ scsiDev.status |= (scsiDev.target->targetId & 0x03) << 5;\r
+ }\r
\r
scsiWriteByte(scsiDev.status);\r
\r
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/*
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 \
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 \
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
#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>
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);
myNumSectorCtrl->Enable(false);
mySizeUnitCtrl->Enable(false);
mySizeCtrl->Enable(false);
+ evaluateSize();
break;
};
- evaluateSize();
if (myAutoStartSectorCtrl->IsChecked())
{
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);
}
{
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
}
--- /dev/null
+#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);
+ }
+ }
+}