Uffe Jakobsen wrote:
> +SP_PRIV enum sp_return list_ports(struct sp_port ***list)
..
> + // sanity check if we got a real tty
> + if (!isatty(fd)) {
> + close(fd);
> + continue;
> + }
Here, instead of:
> + if (tcgetattr(fd, &tios) < 0) {
> + close(fd);
> + continue;
> + }
> + close(fd);
> +
> + if ((cfgetospeed(&tios) <= 0) || (cfgetispeed(&tios) <= 0)) {
> + continue;
> + }
You could instead do:
ret = tcgetattr();
close();
if (ret < 0 || cfgetospeed() <= 0 || cfgetispeed() <= 0)
continue;
Other than that I think this looks fine. I understand there's a
different method to enumerate devices in the system through kernel
API but perhaps scanning /dev is good enough for a start.
//Peter
------------------------------------------------------------------------------
New Year. New Location. New Benefits. New Data Center in Ashburn, VA.
GigeNET is offering a free month of service with a new server in Ashburn.
Choose from 2 high performing configs, both with 100TB of bandwidth.
Higher redundancy.Lower latency.Increased capacity.Completely compliant.
http://p.sf.net/sfu/gigenet
_______________________________________________
sigrok-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/sigrok-devel