pat@orac.pgh.pa.us (Pat Barron) (12/02/88)
I have News 2.11 running on my 7300, and use "rn" to read the news. I've just found that "rn" won't work when I'm dialed in on /dev/ph1 - it complains about not being able to open /dev/tty. It turns out that, when logged on to ph1, I can not open either /dev/tty or /dev/ph1 for read (even though I own the device). I have a feeling that the system won't allow a process to open the phone port if someone else already has it open (even if that someone else is the owner of the device!). Is there any way around this? I'd really rather not have to use "readnews" when I'm dialled up ... --Pat. -- Pat Barron Internet: pat@orac.pgh.pa.us - or - orac!pat@gateway.sei.cmu.edu UUCP: ...!uunet!apexepa!sei!orac!pat - or - ...!pitt!darth!orac!pat
ditto@cbmvax.UUCP (Michael "Ford" Ditto) (12/06/88)
In article <149@orac.pgh.pa.us> pat@orac.pgh.pa.us (Pat Barron) writes: > [ ... ] "rn" won't work when I'm dialed in on /dev/ph1 - it complains >about not being able to open /dev/tty. I'm sure you'll get lots of responses explaining what the problem is: The Unix PC phone driver has a design flaw: the mode which is passed to open() is what it uses to decide whether you want "voice" or "data" access. O_RDONLY means VOICE access, which is not allowed when the port is already open in DATA mode. What most people do is modify the "rn" source code to open /dev/tty with O_RDWR mode (change 2nd arg to open() from 0 to 2, or from O_RDONLY to O_RDWR). This won't fix any other programs or shell scripts which open /dev/tty for reading. What I did was to modify the /dev/ph? driver to ALWAYS use data mode. This, of course, means that the phone manager is not usable, but I never run it anyway. I have this modification available as a loadable driver (source code) if anyone wants it. -- -=] Ford [=- "The number of Unix installations (In Real Life: Mike Ditto) has grown to 10, with more expected." ford@kenobi.cts.com - The Unix Programmer's Manual, ...!sdcsvax!crash!elgar!ford 2nd Edition, June, 1972. ditto@cbmvax.commodore.com
ditto@cbmvax.UUCP (Michael "Ford" Ditto) (12/09/88)
In article <5437@cbmvax.UUCP> I wrote: >What I did was to modify the /dev/ph? driver to ALWAYS use data mode. >This, of course, means that the phone manager is not usable, but I >never run it anyway. I have this modification available as a loadable >driver (source code) if anyone wants it. Below is the "loadable driver" I mentioned, but I think I should apologize for any ambiguity in my statement above: I do NOT have the source code to an actual ph driver, only to this simple "driver" that essentially makes an in-memory patch to the normal driver. Remember that this will completely prevent any kind of "VOICE" mode access to either phone line. The phone manager will no longer work. I threw in an "Install" script which has not been tested, but should work, or at least give you the right idea. A lot of people asked for this, and I think I lost a few of their names, so I decided to just post it. -=] Ford [=- "The number of Unix installations (In Real Life: Mike Ditto) has grown to 10, with more expected." ford@kenobi.cts.com - The Unix Programmer's Manual, ...!sdcsvax!crash!elgar!ford 2nd Edition, June, 1972. ditto@cbmvax.commodore.com #! /bin/sh # This is a shell archive, meaning: # 1. Remove everything above the #! /bin/sh line. # 2. Save the resulting text in a file. # 3. Execute the file with /bin/sh (not csh) to create the files: # Install # phfx.c # This archive created: Fri Dec 9 00:38:11 1988 export PATH; PATH=/bin:$PATH echo shar: extracting "'Install'" '(128 characters)' if test -f 'Install' then echo shar: will not over-write existing file "'Install'" else cat << \SHAR_EOF > 'Install' set -e /etc/masterupd -a init release phfx make phfx.o cp phfx.o /etc/lddrv cd /etc/lddrv ./lddrv -av phfx echo phfx >> drivers SHAR_EOF if test 128 -ne "`wc -c < 'Install'`" then echo shar: error transmitting "'Install'" '(should have been 128 characters)' fi chmod +x 'Install' fi # end of overwriting check echo shar: extracting "'phfx.c'" '(548 characters)' if test -f 'phfx.c' then echo shar: will not over-write existing file "'phfx.c'" else cat << \SHAR_EOF > 'phfx.c' #define KERNEL #include <sys/types.h> #include <sys/conf.h> #include <sys/user.h> #include <sys/file.h> #include <sys/errno.h> extern int phopen(); int fakephopen(); static int cdevidx; phfxinit() { for ( cdevidx=0 ; cdevidx < cdevcnt ; ++cdevidx ) if (cdevsw[cdevidx].d_open == phopen) { cdevsw[cdevidx].d_open = fakephopen; return 0; } u.u_error = ESRCH; return -1; } fakephopen(dev, flag) dev_t dev; int flag; { return phopen(dev, flag|FREAD|FWRITE); } phfxrelease() { cdevsw[cdevidx].d_open = phopen; } SHAR_EOF if test 548 -ne "`wc -c < 'phfx.c'`" then echo shar: error transmitting "'phfx.c'" '(should have been 548 characters)' fi fi # end of overwriting check # End of shell archive exit 0 -- -=] Ford [=- "The number of Unix installations (In Real Life: Mike Ditto) has grown to 10, with more expected." ford@kenobi.cts.com - The Unix Programmer's Manual, ...!sdcsvax!crash!elgar!ford 2nd Edition, June, 1972. ditto@cbmvax.commodore.com