Skip to content

Commit

Permalink
Added code to shut down USB devices before the PS2 is powered off.
Browse files Browse the repository at this point in the history
  • Loading branch information
sp193 committed Jan 3, 2019
1 parent 3bc1603 commit 1c8a005
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions main.c
Original file line number Diff line number Diff line change
Expand Up @@ -1167,6 +1167,8 @@ void loadHdlInfoModule(void)
//---------------------------------------------------------------------------
static void closeAllAndPoweroff(void)
{
int i;

if (ps2dev9_loaded) {
/* Close all files */
fileXioDevctl("pfs:", PDIOC_CLOSEALL, NULL, 0, NULL, 0);
Expand All @@ -1175,6 +1177,13 @@ static void closeAllAndPoweroff(void)
};
}

// As required by some (typically 2.5") HDDs, issue the SCSI STOP UNIT command to avoid causing an emergency park.
for (i = 0; i < USB_mass_max_drives; i++) {
char device[7];
sprintf(device, "mass%d:", i);
fileXioDevctl(device, USBMASS_DEVCTL_STOP_UNIT, NULL, 0, NULL, 0);
}

/* Power-off the PlayStation 2 console. */
poweroffShutdown();
}
Expand Down

0 comments on commit 1c8a005

Please sign in to comment.