You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As soon as the device is disconnected client will be NULL so before sending a file or a command, we just need to check if client is NULL or not. if client == NULL we will proceed reconnect, so i think sendFile() will be something like this:
int DFUDevice::sendFile(const char* filename) {
if(!(this -> client)) {
this -> freeDevice();
usleep(500000);
if (this -> openConnection(5) != 0) {
printf("error connecting to device, stopping here\n");
return 2;
}
usleep(500000);
this -> setAllDeviceInfo();
usleep(500000);
}
usleep(500000);
irecv_error_t stat = irecv_send_file(this -> client, filename, 1);
usleep(500000);
/* for some reason it returns USB upload error even though it uploads
the file just fine, so we're only worried about IRECV_E_UNABLE_TO_CONNECT here */
if (stat == IRECV_E_SUCCESS) {
return 0;
} else if (stat == IRECV_E_USB_UPLOAD) {
if (strcmp(filename, "/dev/null") == 0) return 0;
else return 2;
}
return 1;
}
i'll open a PR if you agree
The text was updated successfully, but these errors were encountered:
I think I already handle this with the withReconnect parameter of the sendFile method. The only time device gets nulled is after uploading iBSS and iBEC, which the main viewcontroller already assumes by calling the sendFile method with the bool parameter set to true.
As soon as the device is disconnected
client
will beNULL
so before sending a file or a command, we just need to check ifclient
isNULL
or not. ifclient == NULL
we will proceed reconnect, so i thinksendFile()
will be something like this:i'll open a PR if you agree
The text was updated successfully, but these errors were encountered: