Исправлена опечатка

master
rust3028 8 years ago committed by GitHub
parent 8462dad8fb
commit c56d6b700e

@ -66,31 +66,31 @@ for (i=0;i<len;i+=16) {
}
}
#ifdef WIN32
int read(int siofd, void* buf, unsigned int len)
{
DWORD bytes_read = 0;
//DWORD t = GetTickCount();
ReadFile(hSerial, buf, len, &bytes_read, NULL);
/*do {
ReadFile(hSerial, buf, len, &bytes_read, NULL);
} while (bytes_read == 0 && (GetTickCount() - t < 1000));*/
return bytes_read;
}
int write(int siofd, void* buf, unsigned int len)
{
DWORD bytes_written = 0;
WriteFile(hSerial, buf, len, &bytes_written, NULL);
return bytes_written;
}
#endif
#ifdef WIN32
int read(int siofd, void* buf, unsigned int len)
{
DWORD bytes_read = 0;
//DWORD t = GetTickCount();
ReadFile(hSerial, buf, len, &bytes_read, NULL);
/*do {
ReadFile(hSerial, buf, len, &bytes_read, NULL);
} while (bytes_read == 0 && (GetTickCount() - t < 1000));*/
return bytes_read;
}
int write(int siofd, void* buf, unsigned int len)
{
DWORD bytes_written = 0;
WriteFile(hSerial, buf, len, &bytes_written, NULL);
return bytes_written;
}
#endif
//*************************************************
//* Вычисление CRC-16
@ -147,8 +147,8 @@ unsigned int send_unframed_buf(char* outcmdbuf, unsigned int outlen) {
#ifndef WIN32
tcflush(siofd,TCIOFLUSH); // сбрасываем недочитанный буфер ввода
#else
PurgeComm(hSerial, PURGE_RXCLEAR);
#else
PurgeComm(hSerial, PURGE_RXCLEAR);
#endif
write(siofd,"\x7e",1); // отсылаем префикс
@ -156,8 +156,8 @@ write(siofd,"\x7e",1); // отсылаем префикс
if (write(siofd,outcmdbuf,outlen) == 0) { printf("\n Ошибка записи команды");return 0; }
#ifndef WIN32
tcdrain(siofd); // ждем окончания вывода блока
#else
FlushFileBuffers(hSerial);
#else
FlushFileBuffers(hSerial);
#endif
return 1;
@ -365,8 +365,8 @@ if (!SetCommTimeouts(hSerial, &CommTimeouts))
CloseHandle(hSerial);
return -1;
}
PurgeComm(hSerial, PURGE_RXCLEAR);
PurgeComm(hSerial, PURGE_RXCLEAR);
#endif
@ -441,7 +441,7 @@ if ((dentry->d_name[2] != '-') || (dentry->d_name[11] != '-')) {
// проверяем цифровое поле ID раздела
if (strspn(dentry->d_name+3,"0123456789AaBbCcDdEeFf") != 8) {
printf("\n Ошибка в идентификаторе раздела - нецифрвой знак - %s\n",filename);
printf("\n Ошибка в идентификаторе раздела - нецифровой знак - %s\n",filename);
exit(1);
}
sscanf(dentry->d_name+3,"%8x",id);
@ -553,8 +553,8 @@ port_timeout(100);
// Вычищаем буфер приемника и передатчика
#ifndef WIN32
tcflush(siofd,TCIOFLUSH);
#else
PurgeComm(hSerial, PURGE_RXCLEAR);
#else
PurgeComm(hSerial, PURGE_RXCLEAR);
#endif
// отправка команды

Loading…
Cancel
Save