135
136
/* Set value to match to RS232 type serial */
136
137
CFDictionarySetValue(sdict, CFSTR(kIOSerialBSDTypeKey), CFSTR(kIOSerialBSDRS232Type));
138
/* Init itterator to find matching types */
139
/* Init itterator to find matching types. Consumes sdict reference */
139
140
if ((kstat = IOServiceGetMatchingServices(kIOMasterPortDefault, sdict, &mit))
141
142
error("IOServiceGetMatchingServices returned %d\n", kstat);
212
212
6: uart:unknown port:00000000 irq:0
213
213
7: uart:unknown port:00000000 irq:0
215
but the permissions don't allow looking at this.
216
217
/* (This info is similar to what is returned by "setserial -g /dev/ttyS*", */
217
218
/* and "setserial -gb /dev/ttyS*" returns just the real ports.) */
282
283
strcpy(dpath, dirn);
283
284
strcat(dpath, de->d_name);
285
if ((fd = open(dpath, O_RDWR | O_NOCTTY | O_NONBLOCK )) < 0) {
286
if (p->debug) fprintf(errout,"failed to open serial \"%s\"\n",dpath);
290
/* On linux we could do a
291
struct serial_struct serinfo;
293
serinfo.reserved_char[0] = 0;
295
if (ioctl(fd, TIOCGSERIAL, &serinfo) < 0
296
|| serinfo.type == PORT_UNKNOWN) {
286
/* See if the serial port is real */
287
if (strncmp(de->d_name, "ttyUSB", 5) != 0) {
289
/* Hmm. This is probably a bad idea - it can upset other */
290
/* programs that use the serial ports ? */
291
if ((fd = open(dpath, O_RDONLY | O_NOCTTY | O_NONBLOCK)) < 0) {
292
if (p->debug) fprintf(errout,"failed to open serial \"%s\"\n",dpath);
296
/* On linux we could do a
297
struct serial_struct serinfo;
299
serinfo.reserved_char[0] = 0;
301
if (ioctl(fd, TIOCGSERIAL, &serinfo) < 0
302
|| serinfo.type == PORT_UNKNOWN) {
303
310
if (p->debug) fprintf(errout,"managed to open serial \"%s\"\n",dpath);
305
312
/* Add the path to the list */