|
|
@ -105,11 +105,11 @@ void PandaPigeon::send(const std::string &s) { |
|
|
|
|
|
|
|
|
|
|
|
std::string PandaPigeon::receive() { |
|
|
|
std::string PandaPigeon::receive() { |
|
|
|
std::string r; |
|
|
|
std::string r; |
|
|
|
|
|
|
|
r.reserve(0x1000 + 0x40); |
|
|
|
while (true){ |
|
|
|
unsigned char dat[0x40]; |
|
|
|
unsigned char dat[0x40]; |
|
|
|
while (r.length() < 0x1000){ |
|
|
|
int len = panda->usb_read(0xe0, 1, 0, dat, sizeof(dat)); |
|
|
|
int len = panda->usb_read(0xe0, 1, 0, dat, sizeof(dat)); |
|
|
|
if (len <= 0 || r.length() > 0x1000) break; |
|
|
|
if (len <= 0) break; |
|
|
|
r.append((char*)dat, len); |
|
|
|
r.append((char*)dat, len); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -190,13 +190,13 @@ void TTYPigeon::send(const std::string &s) { |
|
|
|
|
|
|
|
|
|
|
|
std::string TTYPigeon::receive() { |
|
|
|
std::string TTYPigeon::receive() { |
|
|
|
std::string r; |
|
|
|
std::string r; |
|
|
|
|
|
|
|
r.reserve(0x1000 + 0x40); |
|
|
|
while (true){ |
|
|
|
char dat[0x40]; |
|
|
|
char dat[0x40]; |
|
|
|
while (r.length() < 0x1000){ |
|
|
|
int len = read(pigeon_tty_fd, dat, sizeof(dat)); |
|
|
|
int len = read(pigeon_tty_fd, dat, sizeof(dat)); |
|
|
|
if(len < 0) { |
|
|
|
if(len < 0) { |
|
|
|
handle_tty_issue(len, __func__); |
|
|
|
handle_tty_issue(len, __func__); |
|
|
|
} else if (len == 0 || r.length() > 0x1000){ |
|
|
|
} else if (len == 0){ |
|
|
|
break; |
|
|
|
break; |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
r.append(dat, len); |
|
|
|
r.append(dat, len); |
|
|
|