Display USB waiting message.

This commit is contained in:
sorgelig
2017-06-16 05:22:37 +08:00
parent 80347f4be7
commit 9d08b29e0f
4 changed files with 24 additions and 8 deletions

View File

@@ -17,4 +17,4 @@ binary
put MiSTer /media/fat/MiSTer
EOF
plink root@192.168.1.75 -pw 1 'PATH=/media/fat:$PATH;MiSTer >/dev/ttyS0 2>/dev/ttyS0 </dev/null &'
plink root@192.168.1.75 -pw 1 'sync;PATH=/media/fat:$PATH;MiSTer >/dev/ttyS0 2>/dev/ttyS0 </dev/null &'

View File

@@ -13,6 +13,7 @@
#include <linux/magic.h>
#include "osd.h"
#include "fpga_io.h"
#include "menu.h"
int nDirEntries = 0;
struct dirent DirItem[1000];
@@ -357,6 +358,7 @@ int isPathMounted(int n)
printf("%s is FS: 0x%08X\n", path, fs_stat.f_type);
if (fs_stat.f_type != EXT4_SUPER_MAGIC)
{
printf("%s is not EXT2/3/4.\n", path);
return 1;
}
}
@@ -381,20 +383,26 @@ int isUSBMounted()
void FindStorage(void)
{
char str[128];
printf("Looking for root device...\n");
device = 0;
FileLoad("device.bin", &device, sizeof(int));
orig_device = device;
if (device)
if(device && !isUSBMounted())
{
printf("Waiting for USB...\n");
int btn = 0;
int done = 0;
for (int i = 0; i < 10; i++)
for (int i = 30; i >= 0; i--)
{
if (isUSBMounted()) done = 1;
if (done) break;
sprintf(str, "\n\n Waiting for USB...\n\n %d \n", i);
InfoMessage(str);
if (isUSBMounted())
{
done = 1;
break;
}
for (int i = 0; i < 10; i++)
{
@@ -402,15 +410,23 @@ void FindStorage(void)
if (btn)
{
printf("Button has been pressed %d\n", btn);
InfoMessage("\n\n Canceled!\n");
usleep(500000);
device = 0;
done = 1;
break;
}
usleep(100000);
}
if (done) break;
}
if (!done) device = 0;
if (!done)
{
InfoMessage("\n\n No USB storage found\n Falling back to SD card\n");
usleep(2000000);
device = 0;
}
}
if (device)

2
menu.c
View File

@@ -3586,7 +3586,7 @@ static void set_text(const char *message, unsigned char code)
OsdWrite(l++, s, 0, 0);
}
while (l <= 7) OsdWrite(l++, "", 0, 0);
while (l <= OsdGetSize()-1) OsdWrite(l++, "", 0, 0);
}
/* Error Message */

2
spi.c
View File

@@ -14,7 +14,7 @@
static void spi_en(uint32_t mask, uint32_t en)
{
uint32_t gpo = fpga_gpo_read();
uint32_t gpo = fpga_gpo_read() | 0x80000000;
fpga_gpo_write(en ? gpo | mask : gpo & ~mask);
}