This commit is contained in:
iceman1001 2023-07-06 22:37:34 +02:00
commit e43f6804a1
5 changed files with 775 additions and 771 deletions

View file

@ -407,9 +407,9 @@ static int bitparse_find_section(int bitstream_version, char section_name, uint3
current_length += get_from_fpga_stream(bitstream_version, compressed_fpga_stream, output_buffer) << 8; current_length += get_from_fpga_stream(bitstream_version, compressed_fpga_stream, output_buffer) << 8;
current_length += get_from_fpga_stream(bitstream_version, compressed_fpga_stream, output_buffer) << 0; current_length += get_from_fpga_stream(bitstream_version, compressed_fpga_stream, output_buffer) << 0;
numbytes += 4; numbytes += 4;
if (current_length > 300*1024) { if (current_length > 300 * 1024) {
/* section e should never exceed about 300KB, if the length is too big limit it but still send the bitstream just in case */ /* section e should never exceed about 300KB, if the length is too big limit it but still send the bitstream just in case */
current_length = 300*1024; current_length = 300 * 1024;
} }
break; break;
default: /* Two byte length field */ default: /* Two byte length field */

View file

@ -947,7 +947,7 @@ static int CmdTimeout(const char *Cmd) {
uint32_t oldTimeout = uart_get_timeouts(); uint32_t oldTimeout = uart_get_timeouts();
// timeout is not given/invalid, just show the current timeout then return // timeout is not given/invalid, just show the current timeout then return
if(arg < 0) { if (arg < 0) {
PrintAndLogEx(INFO, "Current communication timeout: %ums", oldTimeout); PrintAndLogEx(INFO, "Current communication timeout: %ums", oldTimeout);
return PM3_SUCCESS; return PM3_SUCCESS;
} }
@ -956,8 +956,7 @@ static int CmdTimeout(const char *Cmd) {
// UART_USB_CLIENT_RX_TIMEOUT_MS is considered as the minimum required timeout. // UART_USB_CLIENT_RX_TIMEOUT_MS is considered as the minimum required timeout.
if (newTimeout < UART_USB_CLIENT_RX_TIMEOUT_MS) { if (newTimeout < UART_USB_CLIENT_RX_TIMEOUT_MS) {
PrintAndLogEx(WARNING, "Timeout less than %ums might cause errors.", UART_USB_CLIENT_RX_TIMEOUT_MS); PrintAndLogEx(WARNING, "Timeout less than %ums might cause errors.", UART_USB_CLIENT_RX_TIMEOUT_MS);
} } else if (newTimeout > 5000) {
else if(newTimeout > 5000) {
PrintAndLogEx(WARNING, "Timeout greater than 5000ms makes the client unresponsive."); PrintAndLogEx(WARNING, "Timeout greater than 5000ms makes the client unresponsive.");
} }
uart_reconfigure_timeouts(newTimeout); uart_reconfigure_timeouts(newTimeout);

File diff suppressed because it is too large Load diff

View file

@ -213,9 +213,14 @@ clean:
help: help:
@echo "################################################################" @echo "################################################################"
@echo "# Valid targets are: $(TARGETS)" @echo "#"
@echo "# <target> - Builds only one of the above listed targets" @echo "# <target> - Builds only one of the above listed targets"
@echo "# all - Builds the FPGA bitstreams for all targets" @echo "# all - Builds the FPGA bitstreams for all targets"
@echo "# clean - Keeps .bit files but cleans intermediate build files for all targets" @echo "# clean - Keeps .bit files but cleans intermediate build files for all targets"
@echo "#"
@echo "#"
@echo "# Valid targets are:"
@echo "# $(TARGETS)"
@echo "#"
@echo "################################################################" @echo "################################################################"

View file

@ -283,7 +283,7 @@ static int bitparse_find_section(FILE *infile, char section_name, unsigned int *
for (int i = 0; i < 4; i++) { for (int i = 0; i < 4; i++) {
tmp = fgetc(infile); tmp = fgetc(infile);
/* image length sanity check, should be under 300KB */ /* image length sanity check, should be under 300KB */
if ( (tmp < 0) || (tmp > 300*1024) ) { if ((tmp < 0) || (tmp > 300 * 1024)) {
break; break;
} }
current_length += tmp << (24 - (i * 8)); current_length += tmp << (24 - (i * 8));
@ -294,7 +294,7 @@ static int bitparse_find_section(FILE *infile, char section_name, unsigned int *
for (int i = 0; i < 2; i++) { for (int i = 0; i < 2; i++) {
tmp = fgetc(infile); tmp = fgetc(infile);
/* if name, date or time fields are too long, we probably shouldn't parse them */ /* if name, date or time fields are too long, we probably shouldn't parse them */
if ( (tmp < 0) || (tmp > 64) ){ if ((tmp < 0) || (tmp > 64)) {
break; break;
} }
current_length += tmp << (8 - (i * 8)); current_length += tmp << (8 - (i * 8));
@ -345,7 +345,7 @@ static int FpgaGatherVersion(FILE *infile, char *infile_name, char *dst, int len
} }
strncat(dst, tempstr, len - strlen(dst) - 1); strncat(dst, tempstr, len - strlen(dst) - 1);
} }
strncat(dst, " image ", len - strlen(dst) - 1); strncat(dst, " image ", len - strlen(dst) - 1);
if (bitparse_find_section(infile, 'b', &fpga_info_len)) { if (bitparse_find_section(infile, 'b', &fpga_info_len)) {