Skip to content

Commit d6d3879

Browse files
committed
- Fix FSP connection timeout behavior.
- Reduce timeout from 5 minutes to 10 seconds.
1 parent b232bc2 commit d6d3879

File tree

1 file changed

+13
-8
lines changed

1 file changed

+13
-8
lines changed

cube/swiss/source/devices/fsp/deviceHandler-FSP.c

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -226,19 +226,24 @@ s32 deviceHandler_FSP_init(file_handle* file) {
226226
file->status = E_CHECKCONFIG;
227227
return EFAULT;
228228
}
229+
fsp_session->timeout = 10000;
229230

230-
u8 dirpro;
231-
if(fsp_getpro(fsp_session, "swiss/patches", &dirpro) &&
232-
fsp_getpro(fsp_session, "swiss", &dirpro) &&
233-
fsp_getpro(fsp_session, "", &dirpro))
234-
dirpro = 0;
231+
u8 dirpro = 0;
232+
int ret;
233+
if ((ret = fsp_getpro(fsp_session, "swiss/patches", &dirpro)) == -1 && errno == ENOENT &&
234+
(ret = fsp_getpro(fsp_session, "swiss", &dirpro)) == -1 && errno == ENOENT)
235+
ret = fsp_getpro(fsp_session, "", &dirpro);
235236

236-
if((dirpro & (FSP_DIR_MKDIR|FSP_DIR_ADD|FSP_DIR_DEL|FSP_DIR_GET)) == (FSP_DIR_MKDIR|FSP_DIR_ADD|FSP_DIR_DEL) ||
237+
if (ret == -1 && errno != ENOENT) {
238+
file->status = 0;
239+
return errno;
240+
}
241+
242+
if ((dirpro & (FSP_DIR_MKDIR | FSP_DIR_ADD | FSP_DIR_DEL | FSP_DIR_GET)) == (FSP_DIR_MKDIR | FSP_DIR_ADD | FSP_DIR_DEL) ||
237243
(dirpro & FSP_DIR_OWNER)) {
238244
file->device->features |= FEAT_PATCHES;
239245
file->device->emulable |= EMU_ETHERNET;
240-
}
241-
else {
246+
} else {
242247
file->device->features &= ~FEAT_PATCHES;
243248
file->device->emulable &= ~EMU_ETHERNET;
244249
}

0 commit comments

Comments
 (0)