Sponsored Content
Special Forums UNIX Desktop Questions & Answers cygwin error device or resource busy Post 302353573 by Corona688 on Tuesday 15th of September 2009 04:41:28 PM
Old 09-15-2009
Remember, Cygwin is still subject to silly Windows limitations like two programs not being able to open one port. bash can't open a file for reading and writing simultaneously, so bash can't do it by itself. I'm trying to think of a common shell utility to do this or some way to trick bash into it but so far I'm coming up empty... There's things like minicom, but I'm guessing you want to automate something.

You could use putty if just typing in raw commands is what you want. It's what I use for raw serial port communication in UNIX, and there's a native Windows version with precisely the same functionality.

Or... It's entirely possible your phone doesn't have the control signals to tell it when the connection's broken, so that closing the device file doesn't lose anything. You might be able to
Code:
echo "AT" > /dev/ttyS0
cat /dev/ttyS0

if you set it up with stty correctly first. There's a setting in stty somewhere to define the amount of time to wait before closing the connection. Set it to zero(or just something small) and it gives you only what's in the buffer, which lets you just keep reopening and reclosing it whenever you want to read or write. I've used this feature in actual UNIX, but I don't know if Windows will do this properly -- it might just discard everything while the file's closed.

---------- Post updated at 02:41 PM ---------- Previous update was at 02:11 PM ----------

I finally figured it out, maybe. Try this:

Code:
# Open ttyS2 for reading and writing as FD 5
exec 5<>/dev/ttyS2
# Leave this running in the background
cat <&5 &
# Write a command to FD 5
echo "AT" >&5

Windows may still complain. I'm not sure.

Last edited by Corona688; 09-15-2009 at 05:19 PM..
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

umount, device busy, but..

I'm trying to unmount a file system, but umount says the device is busy. A fuser -c /myfs tells me that nothing on this fs is in use. Any idea? Oh, and btw, why isn't my signature beeing displayed? Show user's signature is enabled and I have entered one :/ (10 Replies)
Discussion started by: sTorm
10 Replies

2. HP-UX

Cannot umount - device busy

Anyone have any idea why I cannot umount a directory even though fuser shows no process attached to it? fuser -cu /data/oracle/GMPSHRDM/export /data/oracle/GMPSHRDM/export: umount /data/oracle/GMPSHRDM/export umount: cannot unmount /data/oracle/GMPSHRDM/export : Device busy umount:... (2 Replies)
Discussion started by: keelba
2 Replies

3. UNIX for Dummies Questions & Answers

Device or resource busy??

Hi, I'm trying to do a sharity mount to mount a terastation network drive. I'm getting a Device or resource busy message after my mount command. Please see output below... # /usr/local/sharity3/bin/sharity mount smb://labbackup01/bakup_data /mnt/labbackup01 Device or resource busy.... (2 Replies)
Discussion started by: orahi001
2 Replies

4. UNIX Desktop Questions & Answers

cygwin /dev/ttyS2: Device or resource busy

Ciao a tutti!!! il mio problema è questo: sto cercando di inviare dei comandi AT da PC a cellulare utilizzando il bluetooth e cygwin e vorrei visualizzare le risposte nella shell bash. Per farlo apro due terminali utilizzando le seguente istruzioni: xterm & Sul primo scrivo cat /dev/ttyS2 ... (0 Replies)
Discussion started by: blianna
0 Replies

5. UNIX and Linux Applications

/dev/ttyS2 device or resource busy

Ciao a tutti!!! il mio problema è questo: sto cercando di inviare dei comandi AT da PC a cellulare utilizzando il bluetooth e cygwin e vorrei visualizzare le risposte nella shell bash. Per farlo apro due terminali utilizzando le seguente istruzioni: xterm & Sul primo scrivo cat /dev/ttyS2 ... (1 Reply)
Discussion started by: blianna
1 Replies

6. Hardware

/dev/ttyS0: Device or resource busy

hello to everybody I have Ubuntu Lucid 10.04 installed on my Desktop and I have a PCI serial card in my computer and it has only one serial port. Actually I want to use this serial port for the serial communication and for that I executed this command : $ setserial -g /dev/ttyS and I... (0 Replies)
Discussion started by: piyush011
0 Replies

7. UNIX for Dummies Questions & Answers

UNIX rm -rf error "rm: cannot remove `filename' : Device or resource busy"

Hi Everyone, I am trying to remove a directory: $ rm -rf directory_name/ rm: cannot remove `directory_name/filename': Device or resource busy What does this mean, and why can't I remove these files? I already tried moving into the directory, and removing the files individually, but I... (7 Replies)
Discussion started by: Anna_Z
7 Replies

8. UNIX for Advanced & Expert Users

lvm swapon failed Device or resource busy

Is there a trick to mounting swap in n a lvm? I can't get it to work. # swapon -va swapon on /dev/mapper/VG-lv_swap swapon: /dev/mapper/VG-lv_swap: found swap signature: version 1, page-size 4, same byte order swapon: /dev/mapper/VG-lv_swap: pagesize=4096, swapsize=4294967296,... (1 Reply)
Discussion started by: cokedude
1 Replies

9. SCO

NFS umount shows the "Device busy (Error 16)"

Hi there After making a backup copy of it sometimes happens that when I want to unmount an NFS indicates the error:umount: /path_mount busy: Device busy (Error 16) if I run lsoff, I can not find the process that is blocking the application. I'm using OpenServer 5.0.2c as one NFS server ... (14 Replies)
Discussion started by: flako
14 Replies

10. HP-UX

Failed to open tape device /dev/rmt/0mn:Device busy (errno = 16)

Hi, Unable to make tape backup, please help. /opt/ignite/bin/make_tape_recovery -a /dev/rmt/?mn -I -v -m tar -x inc_entire=vg00 * Creating local directories for configuration files and archive. ======= 04/25/16 16:28:08 IST Started /opt/ignite/bin/make_tape_recovery. (Mon... (4 Replies)
Discussion started by: anuragr
4 Replies
TTYSNOOP(8)						    BSD System Manager's Manual 					       TTYSNOOP(8)

NAME
ttysnoop -- snoop on a user's tty SYNOPSIS
ttysnoop [pty] ttysnoops DESCRIPTION
The ttysnoop / ttysnoops client-server combo can be used to snoop (watch) on a user's login tty. The server (ttysnoops) is usually started by getty(8) or telnetd(8) and reads the file /etc/snooptab to find out which tty's should be cloned and which programs to run on them (usu- ally /bin/login). A tty may be snooped through a pre-determined (ie. fixed) device, or through a dynamically allocated pseudo-tty (pty). This is also specified in the /etc/snooptab file. To connect to the pty, the client ttysnoop should be used. The available pseudo terminals pty are present as sockets in the directory /var/spool/ttysnoop/. Format of /etc/snooptab The /etc/snooptab file may contain comment lines (starting with a '#'), empty lines, or entries for tty's that should be snooped upon. The format of such an entry is as follows: tty snoop-device type program where tty is the leaf-name of the tty that should be snooped upon (eg. ttyS2, not /dev/ttyS2) OR the wildcard '*', which matches ANY tty. snoop-device is the device through which tty should be snooped (eg. /dev/tty8) OR the literal constant "socket". The latter is used to tell ttysnoops that the snoop-device will be a dynamically allocated pty. type specifies the type of program that should be run, currently recog- nized types are "init", "user" and "login" although the former two aren't really needed. Finally, program is the full pathname to the program to run when ttysnoops has cloned tty onto snoop-device. EXAMPLE
The following example /etc/snooptab file should illustrate the typical use of ttysnoop / ttysnoops: # # example /etc/snooptab # ttyS0 /dev/tty7 login /bin/login ttyS1 /dev/tty8 login /bin/login # # the wildcard tty should always be the last one in the file # * socket login /bin/login # # example end # With the above example, whenever a user logs in on /dev/ttyS0 or /dev/ttyS1, either tty will be snooped through /dev/tty7 or /dev/tty8 respectively. Any other tty's will be snooped through a pty that will be allocated at the time of login. The system-administrator can then run ttysnoop pty to snoop through the pty. Note that it is up to the system-administrator to setup getty and/or telnetd so that they execute ttysnoops instead of /bin/login. SEE ALSO
getty(8), telnetd(8) FILES
/etc/snooptab BUGS
The program is unable to do any terminal control-code translations for the original tty and the snoop-device. I doubt it will ever do this. AUTHOR
Carl Declerck, carl@miskatonic.inbe.net BSD
August 8 1994 BSD
All times are GMT -4. The time now is 02:08 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy