This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import itertools | |
import _winreg as winreg | |
def enumerate_serial_ports(): | |
path = 'HARDWARE\\DEVICEMAP\\SERIALCOMM' | |
key = winreg.OpenKey(winreg.HKEY_LOCAL_MACHINE, path) | |
ports = [] | |
for i in itertools.count(): | |
try: | |
val = winreg.EnumValue(key, i) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
static int | |
is_any_of(const unsigned char *p, int len, const char *s, int *ofs) | |
{ | |
int i, ch; | |
ch = s[*ofs]; | |
for (i = 0; i < len; i++) | |
if (p[i] == ch) { | |
(*ofs)++; |