Note that the two echo commands each open and close the device and each prints a <newline> character that might neither be needed nor desirable from the second echo.
Alternatively, you might want to consider opening the device once at the start of your script using exec to open (and hold open) your device:
Code:
exec <> /dev/ttyACM0
(replacing standard input for the entire script in this case, but a different file descriptor can also be specified if some other file is being fed into your script). Then you could consider using the stty utility to set appropriate parameters for your device such as icrnl or -icrnl and igncr or -igncr (depending on whether your device sends <carriage-return> and/or <newline> characters as line terminators when you read data from your device) and ocrnl or -ocrnl, onlcr or -onlcr, and onocr or -onocr depending on what it wants to see as line terminators in commands it receives from your script. (And, of course, check the stty man page on your system for other operands that might simplify using your device.)
hi. Im trying to install a switch.
And the manual says i should type a command including a SerialPortDevicePath. which is the filepath to serial port used for connection.
However.. nothing about how to find this info.
Could anyone help me where to find this path?
thx
mr.T (6 Replies)
Hey!
I'm trying to figure out a sollution for a problem I have at my company with an Iomega MiniMax 500 GB USB disk.
If i run cat /proc/bus/usb/devices
I get this information:
T: Bus=01 Lev=02 Prnt=04 Port=00 Cnt=01 Dev#= 5 Spd=480 MxCh= 0
D: Ver= 2.00 Cls=00(>ifc ) Sub=00 Prot=00... (2 Replies)
Hello!
I am working on an application which reads environmental instruments which have serial ports. The application requires a serial port to be present to talk to the device (i.e. /dev/ttyS0 ). In some instances the environmental devices will be 100's of yards away from the computer, so a... (5 Replies)
I have problem with C programming. I want to send & receive data through serial communication. I send data(command) to device to get data from device but when receive data, it can't get altogether of data.
It get only some data. What should I do to get altogether of data?
If all of... (7 Replies)
I am using the while-loop to read a file.
The file has lines with null-terminated strings (words, actually.)
What I have by that reading - just a first word up to '\0'!
I need to have whole string up to 'new line' - (LF, 10#10, 16#A)
What I am doing wrong?
#make file 'grb' with... (6 Replies)
I am trying to change one of my serial printers from /dev/ttyr002 to /dev/ttyr014:
lpstat -s
device for check3: /dev/ttyr002
device for check4: /dev/ttyr002
I changed the tty setting for check3 in:
/etc/printcap
/var/spool/lp/admins/lp/printers/check3
to /dev/ttyr014
Then I get:... (4 Replies)
I have a script batch_vmdgenpqr.sh which has a problem:
#!/bin/bash
while read line
do
vmd.sh -dispdev text -e vmdgenpqr.tcl -args $line
done<file
The do line calls another program, VMD (called by vmd.sh) and it requires the values from $line, but this is not recognised by... (3 Replies)
Hi All,
Am trying to write wrapper shell/bash script on a utility tool for which i need to pass 2 files as arugment to execute utility tool.
Wraper script am trying is to do with above metion 2 files.
utility tool accepts :
a. userinfo file : which contains username
b. item file : which... (2 Replies)
Heyas
I'm trying to read/display a file its content and put borders around it (tui-cat / tui-cat -t(ypwriter).
The typewriter-part is a 'bonus' but still has its own flaws, but thats for later.
So in some way, i'm trying to rewrite cat using bash and other commands.
But sadly it fails on... (2 Replies)
Hello,
I'm works on Ubuntu server
My goal : I would like to read file line per line, but i want to started at the end of file.
Currently, I use instructions :
while read line;
do
COMMAND
done < /var/log/apache2/access.log
But, the first line, i don't want this. The file is long... (5 Replies)
Discussion started by: Fuziion
5 Replies
LEARN ABOUT FREEBSD
gpio
GPIO(4) BSD Kernel Interfaces Manual GPIO(4)NAME
gpiobus -- GPIO bus system
SYNOPSIS
To compile these devices into your kernel and use the device hints, place the following lines in your kernel configuration file:
device gpio
device gpioc
device gpioiic
device gpioled
Additional device entries for the ARM architecture include:
device a10_gpio
device bcm_gpio
device imx51_gpio
device lpcgpio
device mv_gpio
device ti_gpio
device gpio_avila
device gpio_cambria
device zy7_gpio
device pxagpio
Additional device entries for the MIPS architecture include:
device ar71xxx_gpio
device octeon_gpio
device rt305_gpio
Additional device entries for the POWERPC architecture include:
device wiigpio
device macgpio
DESCRIPTION
The gpiobus system provides a simple interface to the GPIO pins that are usually available on embedded architectures and can provide bit
banging style devices to the system.
The acronym GPIO means ``General-Purpose Input/Output.''
The BUS physically consists of multiple pins that can be configured for input/output, IRQ delivery, SDA/SCL iicbus use, etc.
On some embedded architectures (like MIPS), discovery of the bus and configuration of the pins is done via device.hints(5) in the platform's
kernel config(5) file.
On some others (like ARM), where FDT(4) is used to describe the device tree, the bus discovery is done via the DTS passed to the kernel,
being either statically compiled in, or by a variety of ways where the boot loader (or Open Firmware enabled system) passes the DTS blob to
the kernel at boot.
The following device.hints(5) are only provided by the ar71xx_gpio driver:
hint.gpio.%d.pinmask This is a bitmask of pins on the GPIO board that we would like to expose for use to the host operating system. To
expose pin 0, 4 and 7, use the bitmask of 10010001 converted to the hexadecimal value 0x0091.
hint.gpio.%d.pinon This is a bitmask of pins on the GPIO board that will be set to ON at host start. To set pin 2, 5 and 13 to be set ON
at boot, use the bitmask of 10000000010010 converted to the hexadecimal value 0x2012.
hint.gpio.function_set
hint.gpio.function_clear
These are bitmasks of pins that will remap a pin to handle a specific function (USB, UART TX/RX, etc) in the Atheros
function registers. This is mainly used to set/clear functions that we need when they are set up or not set up by
uBoot.
Simply put, each pin of the GPIO interface is connected to an input/output of some device in a system.
SEE ALSO gpioiic(4), gpioled(4), iicbus(4), gpioctl(8)HISTORY
The gpiobus manual page first appeared in FreeBSD 10.0.
AUTHORS
This manual page was written by Sean Bruno <sbruno@FreeBSD.org>.
BSD November 5, 2013 BSD