-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rerun the setup after USB MSC device is ejected
Rerun setup once the USB mass storage device is ejected. This is done because the `zuluscsi.ini` file may be edited over the mass storage interface on the USB host computer. Or SCSI device images may have been renamed, deleted, or uploaded. Added the Copyright headers for zigzagjoe contributions. Renamed card reader function names and log entries to mass storage device.
- Loading branch information
Showing
6 changed files
with
75 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,35 @@ | ||
/* TODO - Header. By ZZJ. */ | ||
#ifdef PLATFORM_CARDREADER | ||
/** | ||
* Copyright (c) 2023 zigzagjoe | ||
* | ||
* ZuluSCSI™ firmware is licensed under the GPL version 3 or any later version. | ||
* | ||
* https://www.gnu.org/licenses/gpl-3.0.html | ||
* ---- | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with this program. If not, see <https://www.gnu.org/licenses/>. | ||
**/ | ||
#ifdef PLATFORM_MASS_STORAGE | ||
#ifndef RP_MSC_READER_H | ||
#define RP_MSC_READER_H | ||
|
||
// wait up to this long during init sequence for USB enumeration to enter card reader | ||
#define CR_ENUM_TIMEOUT 1000 | ||
|
||
// true if we should enter cardreader mode | ||
bool shouldEnterReader(); | ||
// true if we should start the mass storage device mode | ||
bool shouldStartMassStorage(); | ||
|
||
// run cardreader mode. does not return currently | ||
void runCardReader(); | ||
// exposed the SD card as a mass storage device. does not return currently | ||
void startMassStorage(); | ||
|
||
#endif | ||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,6 +9,7 @@ | |
* | ||
* This work incorporates work by following | ||
* Copyright (c) 2023 joshua stein <[email protected]> | ||
* Copyright (c) 2023 zigzagjoe | ||
* | ||
* This file is free software: you may copy, redistribute and/or modify it | ||
* under the terms of the GNU General Public License as published by the | ||
|
@@ -751,19 +752,6 @@ extern "C" void zuluscsi_setup(void) | |
ini_gets("SCSI", "System", "", presetName, sizeof(presetName), CONFIGFILE); | ||
scsi_system_settings_t *cfg = g_scsi_settings.initSystem(presetName); | ||
|
||
#ifdef PLATFORM_CARDREADER | ||
if (g_scsi_settings.getSystem()->enableUSBMassStorage) | ||
{ | ||
// right now, we initialize early to allow config file edits to take effect immediately on eject | ||
// perform checks (USB power, have we been enumerated, etc?) and waits up to a second for enumeration | ||
if (shouldEnterReader()) | ||
{ | ||
logmsg("SD Card opened as a mass storage device"); | ||
runCardReader(); | ||
} | ||
} | ||
#endif | ||
|
||
int boot_delay_ms = cfg->initPreDelay; | ||
if (boot_delay_ms > 0) | ||
{ | ||
|
@@ -802,6 +790,23 @@ extern "C" void zuluscsi_main_loop(void) | |
static uint32_t sd_card_check_time = 0; | ||
static uint32_t last_request_time = 0; | ||
|
||
#ifdef PLATFORM_MASS_STORAGE | ||
static bool check_mass_storage = true; | ||
if (check_mass_storage && g_scsi_settings.getSystem()->enableUSBMassStorage) | ||
{ | ||
check_mass_storage = false; | ||
// right now, we initialize early to allow config file edits to take effect immediately on eject | ||
// perform checks (USB power, have we been enumerated, etc?) and waits up to a second for enumeration | ||
if (shouldStartMassStorage()) | ||
{ | ||
logmsg("SD Card opened as a mass storage device"); | ||
startMassStorage(); | ||
zuluscsi_setup(); | ||
} | ||
} | ||
#endif | ||
|
||
|
||
platform_reset_watchdog(); | ||
platform_poll(); | ||
diskEjectButtonUpdate(true); | ||
|