diff --git a/extmod/modtrezormsg/modtrezormsg-unix.h b/extmod/modtrezormsg/modtrezormsg-unix.h index 7080e150e7..988f6bc00a 100644 --- a/extmod/modtrezormsg/modtrezormsg-unix.h +++ b/extmod/modtrezormsg/modtrezormsg-unix.h @@ -1,5 +1,6 @@ #include #include +#include #include #define TREZOR_PORT 21324 @@ -10,9 +11,11 @@ static socklen_t slen = 0; void msg_init(void) { - s = socket(AF_INET, SOCK_DGRAM | SOCK_NONBLOCK, IPPROTO_UDP); + s = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP); assert(s != -1); + fcntl(s, F_SETFL, O_NONBLOCK); + si_me.sin_family = AF_INET; si_me.sin_port = htons(TREZOR_PORT); si_me.sin_addr.s_addr = htonl(INADDR_ANY);