Re: setupapi: enumerate serial ports
Juan Lang <juan_lang(a)yahoo.com> writes:
+/* Based on code from winspool's info.c */ +static UINT SETUP_CountSerialPorts(void) +{ + UINT i, ret; + + /* FIXME: it should be possible for more than four COM ports to exist, not + * sure why we retain that limit, but winspool does too so go with it. + */ + for (i = 0, ret = 0; i < 4; i++) + { + if (SETUP_SerialPortExists(i)) + ret++; + } + TRACE("returning %d\n", ret); + return ret; +}
It would probably be better to use QueryDosDevice here. -- Alexandre Julliard julliard(a)winehq.org
--- Alexandre Julliard <julliard(a)winehq.org> wrote:
+/* Based on code from winspool's info.c */ +static UINT SETUP_CountSerialPorts(void) +{ + UINT i, ret; + + /* FIXME: it should be possible for more than four COM ports to exist, not + * sure why we retain that limit, but winspool does too so go with it. + */ + for (i = 0, ret = 0; i < 4; i++) + { + if (SETUP_SerialPortExists(i)) + ret++; + } + TRACE("returning %d\n", ret); + return ret; +}
It would probably be better to use QueryDosDevice here.
I'm not sure it is. I just tried it, and QueryDosDevice returns success for every COMx passed to it, even though only com1 exists in my dosdevices directory. Unless QueryDosDevice is also wrong (I don't know.) --Juan __________________________________ Do you Yahoo!? Yahoo! Mail - 250MB free storage. Do more. Manage less. http://info.mail.yahoo.com/mail_250
Juan Lang <juan_lang(a)yahoo.com> writes:
I'm not sure it is. I just tried it, and QueryDosDevice returns success for every COMx passed to it, even though only com1 exists in my dosdevices directory. Unless QueryDosDevice is also wrong (I don't know.)
You don't necessarily need symlinks, by default it will fallback to /dev/ttyS?. So if the corresponding ttyS? device exists QueryDosDevice will succeed, which is correct since you do have that serial port. -- Alexandre Julliard julliard(a)winehq.org
participants (2)
-
Alexandre Julliard -
Juan Lang