tty

Cygnal Integrated Products serial port on Linux

本秂侑毒 提交于 2019-12-23 05:16:45
问题 I have an infrared thermometer which operates on a virtual serial port over USB, which I am trying to use on Debian Linux. Unfortunately, the system does not enumerate a /dev/ttyUSB device. Here is the dmesg for the device: usb 5-1: new full-speed USB device number 3 using uhci_hcd usb 5-1: New USB device found, idVendor=10c4, idProduct=834b usb 5-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3 usb 5-1: Product: Infrared Online Sensor Adapter usb 5-1: Manufacturer: Silicon Labs

Option key in Cocoa Emacs not entering accented characters

时光怂恿深爱的人放手 提交于 2019-12-23 03:00:13
问题 Using an international keyboard with TTY emacs works fine for entering characters: alt-e + a enters á alt-i + a enters â etc The problem is that in Cocoa Emacs that same doesn't hold true. These keys get interpreted as emacs commands. I tried to unbind these keys globally, even unbinded they don't enter the correct escape character needed for international accented characters. How to I get back to the TTY behaviour in Cocoa Emacs? 回答1: I like to have the best of both worlds on OSX, so I set

How to I detect whether a tty belonging to a gsm/3g-modem is a data or control port?

别来无恙 提交于 2019-12-22 05:20:47
问题 I'm currently writing a small tool for a linux router that sets up a wwan (gsm/3g) connection when I plug an appropriate modem into its USB port. When the device is plugged in several ttys are registered and I currently maintain a list of manufacturers and devices and which of their registered ttys is the control / data port. If possible I want to get rid of this list and find a way to somehow probe the registered ttys directly to check if they are a control port or a data port. I examined

Detect if stdin is a tty device (terminal) or pipe in PHP?

风流意气都作罢 提交于 2019-12-21 07:28:21
问题 I wrote a php script. I want it show help message when called with standard input connected to a tty device (terminal) before reading and executing interactively, but dont show when called with a file or stream from pipe as standard input. Is there a way to detect this from PHP? 回答1: Use posix_isatty. This function accepts both a file descriptor (an integer) and a PHP stream. If it receives a PHP stream, it automatically attempts to cast it in order to obtain a file descriptor and use it

Make R (statistics package) wait for keyboard prompt when run within a bash script

匆匆过客 提交于 2019-12-21 04:21:07
问题 I am using R to generate a series of plots within a loop, with the user hitting the enter key to indicate they have seen the plot and it is time to move on. These are interactive rotatable plots generated with the rgl package and therefore using something like Sys.sleep() is not good enough. Currently I can use readline() which works find when running R interactively. However, if I want to run my R script within a bash script all the plots appear flashing before the screen. This happens

Make R (statistics package) wait for keyboard prompt when run within a bash script

走远了吗. 提交于 2019-12-21 04:21:02
问题 I am using R to generate a series of plots within a loop, with the user hitting the enter key to indicate they have seen the plot and it is time to move on. These are interactive rotatable plots generated with the rgl package and therefore using something like Sys.sleep() is not good enough. Currently I can use readline() which works find when running R interactively. However, if I want to run my R script within a bash script all the plots appear flashing before the screen. This happens

How to know which device is connected in which /dev/ttyUSB port

那年仲夏 提交于 2019-12-20 19:11:12
问题 I am using two Wavecom 16-port modems. When I attach the modems to my system, I am able to list of all the /dev/ttyUSB port names, but also I want to know, which modem is containing ports 0 to 16 and which one is containing ports 17 to 32? The modems may be attached and removed many times in a single day, so I also want to keep logs when modems get disconnected and connected again. Any idea how to do so using c/c++/php script/node.js ? 回答1: You can get this information from the sys filesystem

How to know which device is connected in which /dev/ttyUSB port

前提是你 提交于 2019-12-20 19:11:04
问题 I am using two Wavecom 16-port modems. When I attach the modems to my system, I am able to list of all the /dev/ttyUSB port names, but also I want to know, which modem is containing ports 0 to 16 and which one is containing ports 17 to 32? The modems may be attached and removed many times in a single day, so I also want to keep logs when modems get disconnected and connected again. Any idea how to do so using c/c++/php script/node.js ? 回答1: You can get this information from the sys filesystem

Can you fool isatty AND log stdout and stderr separately?

久未见 提交于 2019-12-20 09:47:59
问题 Problem So you want to log the stdout and stderr (separately) of a process or subprocess, without the output being different from what you'd see in the terminal if you weren't logging anything. Seems pretty simple no? Well unfortunately, it appears that it may not be possible to write a general solution for this problem, that works on any given process... Background Pipe redirection is one method to separate stdout and stderr, allowing you to log them individually. Unfortunately, if you

Get terminal size in Go

房东的猫 提交于 2019-12-18 12:47:41
问题 How to get tty size with Golang? I am trying do this with executing stty size command, but I can't craft code right. package main import ( "os/exec" "fmt" "log" ) func main() { out, err := exec.Command("stty", "size").Output() fmt.Printf("out: %#v\n", out) fmt.Printf("err: %#v\n", err) if err != nil { log.Fatal(err) } } Output: out: []byte{} err: &exec.ExitError{ProcessState:(*os.ProcessState)(0xc200066520)} 2013/05/16 02:35:57 exit status 1 exit status 1 I think this is because Go spawns a