这篇教程C++ tcsendbreak函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中tcsendbreak函数的典型用法代码示例。如果您正苦于以下问题:C++ tcsendbreak函数的具体用法?C++ tcsendbreak怎么用?C++ tcsendbreak使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了tcsendbreak函数的26个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: test3/* * test sending a break */inttest3(void){ int masterfd, slavefd; char *slavename; masterfd = open(MASTERCLONE, O_RDWR); if (masterfd < 0) { tst_resm(TBROK,"%s",MASTERCLONE); tst_exit(); } slavename = ptsname(masterfd); if (slavename == NULL) { tst_resm(TBROK|TERRNO, "ptsname() call failed"); tst_exit(); } if (grantpt(masterfd) != 0) { tst_resm(TBROK|TERRNO, "grantpt() call failed"); tst_exit(); } if (unlockpt(masterfd) != 0) { tst_resm(TBROK,"unlockpt() call failed"); tst_exit(); } if ((slavefd = open(slavename, O_RDWR)) < 0) { tst_resm(TBROK,"Could not open %s",slavename); tst_exit(); } if (tcsendbreak(masterfd, 10) != 0) { tst_resm(TFAIL,"tcsendbreak"); tst_exit(); } if (tcsendbreak(slavefd, 10) != 0) { tst_resm(TFAIL,"tcsendbreak"); tst_exit(); } if (close(slavefd) != 0) { tst_resm(TBROK,"close slave"); tst_exit(); } if (close(masterfd) != 0) { tst_resm(TBROK,"close master"); tst_exit(); } tst_resm(TPASS,"test3"); /** NOT REACHED **/ return 0;}
开发者ID:joyforu,项目名称:android-ltp-ndk,代码行数:60,
示例2: sch_tcsendbreaks48_ref_t sch_tcsendbreak(s48_call_t call, s48_ref_t sch_fd, s48_ref_t sch_duration) { if (tcsendbreak (s48_extract_long_2(call, sch_fd), s48_extract_long_2(call, sch_duration)) == -1) s48_os_error_2(call, "sch_tcsendbreak", errno, 2, sch_fd, sch_duration); return s48_unspecific_2(call);}
开发者ID:james-m-henderson,项目名称:scsh,代码行数:7,
示例3: ndiSerialBreakint ndiSerialBreak(int serial_port){ tcflush(serial_port,TCIOFLUSH); /* clear input/output buffers */ tcsendbreak(serial_port,0); /* send the break */ return 0;}
开发者ID:Beastmaster,项目名称:AIGS,代码行数:7,
示例4: switchint serialPort::portMode(setType setting, char *set){ switch (setting) { case CONFIG: strcpy(config, set); break; case EOSMODE: eosMode = *set; break; case CLEAR:#ifdef __WIN32__ SetCommBreak( handle ); Sleep ( 300 ); // sleep 300 ms ClearCommBreak( handle ); Sleep ( 50 ); // sleep 50 ms#endif#ifdef __linux__ printf("serialPort::portMode break 300/n"); tcsendbreak( handle, 300); // should send 300 ms break usleep(100000); // a bit of a guard after tcdrain( handle );#endif break; case TIMEOUT: timeout = strtoul(set, NULL, 10) * 1000L; break; case PACING: pace = strtoul(set, NULL, 10) * 1000L; break; } return 0;}
开发者ID:petejan,项目名称:QueryLog,代码行数:34,
示例5: sol_serial_send_breakstatic voidsol_serial_send_break(ipmi_sol_t *sol){ soldata_t *sd = sol->soldata; tcsendbreak(sd->fd, 0);}
开发者ID:turtle-fly,项目名称:openipmi,代码行数:7,
示例6: sendbreakvoid sendbreak(void){ if(serial_port_fd == -1) return; else tcsendbreak(serial_port_fd, 0);}
开发者ID:Jeija,项目名称:gtkterm,代码行数:7,
示例7: hardwire_send_breakstatic inthardwire_send_break (struct serial *scb){#ifdef HAVE_TERMIOS return tcsendbreak (scb->fd, 0);#endif#ifdef HAVE_TERMIO return ioctl (scb->fd, TCSBRK, 0);#endif#ifdef HAVE_SGTTY { int status; struct timeval timeout; status = ioctl (scb->fd, TIOCSBRK, 0); /* Can't use usleep; it doesn't exist in BSD 4.2. */ /* Note that if this select() is interrupted by a signal it will not wait the full length of time. I think that is OK. */ timeout.tv_sec = 0; timeout.tv_usec = 250000; select (0, 0, 0, 0, &timeout); status = ioctl (scb->fd, TIOCCBRK, 0); return status; }#endif}
开发者ID:debrouxl,项目名称:tiemu,代码行数:29,
示例8: posix_tty_tcsendbreakunitposix_tty_tcsendbreak(cerr er, int fd, int duration){ if(tcsendbreak(fd, duration) == -1) send_errno(er,errno); return empty_record;}
开发者ID:RobertHarper,项目名称:TILT-Compiler,代码行数:7,
示例9: EIO_Breakvoid EIO_Break(uv_work_t* req) { BreakBaton* data = static_cast<BreakBaton*>(req->data); data->result = tcsendbreak(data->fd, 1000); if (data->result == -1) { snprintf(data->errorString, sizeof(data->errorString), "Error %s calling ioctl( ..., tcsendbreak)", strerror(errno)); }}
开发者ID:kyoungchinseo,项目名称:HCI-2015-02-source-repo,代码行数:8,
示例10: tcsendbreak/***Send a stream of zero valued bits.@function tcsendbreak@see tcsendbreak(3)@int fd terminal descriptor@int duration if non-zero, stream for some implementation defined time@return 0 if successful, otherwise nil@return error message if failed*/static intPtcsendbreak(lua_State *L){ int fd = checkint(L, 1); int duration = checkint(L, 2); checknargs(L, 2); return pushresult(L, tcsendbreak(fd, duration), NULL);}
开发者ID:fabgithub,项目名称:luaposix,代码行数:17,
示例11: xf86SerialSendBreakintxf86SerialSendBreak(int fd, int duration){ int r; SYSCALL(r = tcsendbreak(fd, duration)); return r;}
开发者ID:XQuartz,项目名称:xorg-server,代码行数:9,
示例12: SetCommBreakvoid SerialPort::sendBreak(){#ifdef __WIN32__ SetCommBreak(handle); ClearCommBreak(handle);#endif#if defined(__gnu_linux__) || (defined(__APPLE__) && defined(__MACH__)) tcsendbreak(handle, 0);#endif}
开发者ID:HenriVesala,项目名称:EmptyEpsilon,代码行数:10,
示例13: serial_special/* * Send serial special codes. */static void serial_special(void *handle, Telnet_Special code){ Serial serial = (Serial) handle; if (serial->fd >= 0 && code == TS_BRK) { tcsendbreak(serial->fd, 0); logevent(serial->frontend, "Sending serial break at user request"); } return;}
开发者ID:halcy,项目名称:PuTTY,代码行数:14,
示例14: sprintf/* * Class: com_pi4j_jni_Serial * Method: sendBreak * Signature: (I)V */JNIEXPORT void JNICALL Java_com_pi4j_jni_Serial_sendBreak (JNIEnv *env, jclass obj, jint fd, jint duration){ // transmit break if(tcsendbreak(fd, duration) != 0){ int err_number = errno; char err_message[100]; sprintf(err_message, "Failed to transmit BREAK signal to serial port. (Error #%d)", err_number); throwIOException(env, err_message); }}
开发者ID:alexmao86,项目名称:pi4j,代码行数:16,
示例15: _srmio_ios_send_breakstatic bool _srmio_ios_send_break( srmio_io_t h, srmio_error_t *err ){ assert( h ); assert( SELF(h)->fd >= 0 ); if( 0 != tcsendbreak( SELF(h)->fd, 0 ) ){ srmio_error_errno( err, "ios break" ); return false; } return true;}
开发者ID:crashracer,项目名称:srmio,代码行数:12,
示例16: send_to_modemint send_to_modem(unsigned char *buffer, unsigned int bytes){ unsigned char outbuf[256]; unsigned int i; int res; int msr; char errorbuf[256]; if (debug) printf("Sending to modem %d bytes/n", bytes); outbuf[0] = 0x55; outbuf[1] = bytes; outbuf[2] = 0x00; for (i = 0; i < bytes; i++) { outbuf[3 + i] = buffer[i]; } msr = TIOCM_RTS; ioctl(modem_fd, TIOCMBIS, &msr); msr = 0; while (!(msr & TIOCM_CTS)) { if ((ioctl(modem_fd, TIOCMGET, &msr)) == -1) { sprintf(errorbuf, "ioctl(TIOCMGET) failed, (%s)", strerror(errno)); printf("%s/n", errorbuf); //return errno; } if (debug) msr_display(msr); // We cant do it if its 4146 it must be 4126 } tcsendbreak(modem_fd, 0); if (debug) display("send", outbuf, i + 3); res = write(modem_fd, outbuf, i + 3); if (debug) printf("send_to_modem about to return %d/n", res); return res;}
开发者ID:kurthaeusler,项目名称:PolyDriver,代码行数:51,
示例17: help_send_escape/* process function for help_state=0 */static void help_send_escape(int fd, char c) { struct termios pts; /* termios settings on port */ in_escape = 0; help_state = 0; switch (c) { case 'x': /* restore termios settings and exit */ write(STDOUT_FILENO, "/n", 1); cleanup_termios(0); break; case 'q': /* quit help */ break; case 'l': /* log on/off */ if (flog == 0) { /* open log file */ open_logFile(log_file); } else { /* close log file */ close_logFile(); } break; case 's': /* script active/inactive */ script_init(scr_name); script = (script)? 0: 1; break; case 'b': /* send break */ /* send a break */ tcsendbreak(fd, 0); break; case 't': /* set terminal */ help_state = 1; help_terminal(); in_escape = 1; break; case '~': /* display it again */ help_escape(); break; default: /* pass the character through */ /* "C-/ C-/" sends "C-/" */ write(fd, &c, 1); break; } if (in_escape == 0) help_done(); return;}
开发者ID:checko,项目名称:microcom,代码行数:51,
示例18: termios_tcsendbreakstatic PyObject *termios_tcsendbreak(PyObject *self, PyObject *args){ int fd, duration; if (!PyArg_ParseTuple(args, "O&i:tcsendbreak", fdconv, &fd, &duration)) return NULL; if (tcsendbreak(fd, duration) == -1) return PyErr_SetFromErrno(TermiosError); Py_INCREF(Py_None); return Py_None;}
开发者ID:CSC-IT-Center-for-Science,项目名称:scalable-python,代码行数:14,
示例19: MOOSTrace/** *The ability to send a Break signal (~.5sec of tying the TX pin low) in Linux */void CMOOSLinuxSerialPort::Break(){ if (m_nPortFD < 0) { MOOSTrace("Cannot Break because port is not open/n"); return; } //according to http://www.mkssoftware.com/docs/man3/tcsendbreak.3.asp //a default value of 0 should work fine, sends a break for 250-500ms,#ifndef _WIN32 tcsendbreak(m_nPortFD, 0);#endif}
开发者ID:HSOFEUP,项目名称:MOOS-IvP-releases,代码行数:18,
示例20: serialuartbreakvoid serialuartbreak (int v){ if (ser_fd < 0 || !currprefs.use_serial) { return; } #ifdef POSIX_SERIAL if(v) { /* in posix serial calls we can't fulfill this function interface completely: as we are not able to toggle the break mode with "v". We simply trigger a default break here if v is enabled... */ if(tcsendbreak(ser_fd, 0) < 0) { write_log("serial: TCSENDBREAK failed/n"); } }#endif}
开发者ID:johanpalmqvist,项目名称:fs-uae,代码行数:17,
示例21: sendbrkvoidsendbrk(int fd){#ifdef USE_TERMIOS tcsendbreak(fd,0);#endif#ifdef USE_TERMIO ioctl(fd, TCSBRK, 0);#endif#ifdef USE_SGTTY#ifdef TIOCSBRK sleep(1); ioctl(fd, TIOCSBRK, 0); sleep(1); ioctl(fd, TIOCCBRK, 0);#endif#endif}
开发者ID:TeamElevate,项目名称:edison,代码行数:18,
示例22: mraa_uart_sendbreakmraa_result_tmraa_uart_sendbreak(mraa_uart_context dev, int duration){ if (!dev) { syslog(LOG_ERR, "uart: sendbreak: context is NULL"); return MRAA_ERROR_INVALID_HANDLE; } if (IS_FUNC_DEFINED(dev, uart_sendbreak_replace)) { return dev->advance_func->uart_sendbreak_replace(dev, duration); }#if !defined(PERIPHERALMAN) if (tcsendbreak(dev->fd, duration) == -1) { return MRAA_ERROR_INVALID_PARAMETER; }#endif return MRAA_SUCCESS;}
开发者ID:jontrulson,项目名称:mraa,代码行数:20,
示例23: gp_port_serial_send_breakstatic intgp_port_serial_send_break (GPPort *dev, int duration){ /* The device needs to be opened for that operation */ if (!dev->pl->fd) CHECK (gp_port_serial_open (dev)); /* Make sure we are operating at the specified speed */ CHECK (gp_port_serial_check_speed (dev)); /* Duration is in milliseconds */#ifdef HAVE_TERMIOS_H tcsendbreak (dev->pl->fd, duration / 310); tcdrain (dev->pl->fd);#else# ifdef __GCC__# warning SEND BREAK NOT IMPLEMENTED FOR NON TERMIOS SYSTEMS!# endif#endif return GP_OK;}
开发者ID:rajbot,项目名称:gphoto,代码行数:22,
示例24: _lib7_P_TTY_tcsendbreakVal _lib7_P_TTY_tcsendbreak (Task* task, Val arg) { //======================= // // Mythryl type: (Int, Int) -> Void // // Send break condition on tty line. // // This fn gets bound as tcsendbreak in: // // src/lib/std/src/posix-1003.1b/posix-tty.pkg ENTER_MYTHRYL_CALLABLE_C_FN("_lib7_P_TTY_tcsendbreak"); int fd = GET_TUPLE_SLOT_AS_INT( arg, 0 ); int duration = GET_TUPLE_SLOT_AS_INT( arg, 1 ); RELEASE_MYTHRYL_HEAP( task->pthread, "_lib7_P_TTY_tcsendbreak", NULL ); // int status = tcsendbreak( fd, duration ); // RECOVER_MYTHRYL_HEAP( task->pthread, "_lib7_P_TTY_tcsendbreak" ); RETURN_VOID_EXCEPT_RAISE_SYSERR_ON_NEGATIVE_STATUS__MAY_HEAPCLEAN(task, status, NULL);}
开发者ID:omork,项目名称:mythryl,代码行数:24,
示例25: mainintmain(int argc, char **argv){ int ups_fd, stat_fd, ch; int flags; int pstatus, poldstat = 1; int bstatus, boldstat = 1; int count = 0; int bcount = 0; int tries = 0; int ikill = 0; int ioctlbit; char *self = argv[0]; char killchar = ' '; struct upsdef *pups; while ((ch = getopt(argc, argv, "kc:d:r:s:t:")) != -1) switch (ch) { case 'k': ikill = 1; break; case 'c': config_file = optarg; break; case 'd': upsport = optarg; break; case 'r': rcpowerfail = optarg; break; case 's': upsstat = optarg; break; case 't': upstype = optarg; break; case '?': default: usage(self); } argc -= optind; argv += optind; if (argc > 0) usage(self); parse_config(config_file); if (upsport == NULL || upstype == NULL || upsstat == NULL) { usage(self); } for (pups = ups; pups; pups = pups->next) { if (strcmp(pups->tag, upstype) == 0) break; } if (!pups) { fprintf(stderr, "Error: %s: UPS <%s> unknown/n", self, argv[2]); exit(1); } /* Start syslog. */ openlog(self, LOG_CONS | LOG_PERROR, LOG_DAEMON); if ((ups_fd = open(upsport, O_RDWR | O_NDELAY)) < 0) { syslog(LOG_ERR, "%s: %s", upsport, strerror(errno)); closelog(); exit(1); } /* Kill the inverter and close out if inverter kill was selected */ if (ikill) { if (pups->killtime) { /* Explicitly clear both DTR and RTS as soon as possible */ ioctlbit = TIOCM_RTS; ioctl(ups_fd, TIOCMBIC, &ioctlbit); ioctlbit = TIOCM_DTR; ioctl(ups_fd, TIOCMBIC, &ioctlbit); /* clear killpower, apply cablepower to enable monitoring */ setlevel(ups_fd, pups->kill.line, !pups->kill.inverted); setlevel(ups_fd, pups->cablepower.line, !pups->cablepower.inverted); if (pups->kill.line == TIOCM_ST) { /* Send BREAK (TX high) to kill the UPS inverter. */ tcsendbreak(ups_fd, 1000 * pups->killtime); } else { /* Force high to send the UPS the inverter kill signal. */ setlevel(ups_fd, pups->kill.line, pups->kill.inverted); sleep(pups->killtime); } ioctl(ups_fd, TIOCMGET, &flags); /* * Feb/05/2001 Added support for Tripplite Omnismart 450PNP, this * UPS shutdowns inverter when data is sent over the Tx line * (jhcaiced) */ if (pups->flags & UPS_TXD_KILL_INVERTER) { sleep(2); write(ups_fd, &killchar, 1); } close(ups_fd);//.........这里部分代码省略.........
开发者ID:quinot,项目名称:genpower,代码行数:101,
示例26: sendbrkstatic void sendbrk(void){ tcsendbreak(iofd, 1);}
开发者ID:hlyytine,项目名称:daydream,代码行数:4,
注:本文中的tcsendbreak函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ tcsetattr函数代码示例 C++ tcpip_output函数代码示例 |