All of lore.kernel.org
 help / color / mirror / Atom feed
From: Padraig Brady <padraig@antefacto.com>
To: Martin Dalecki <dalecki@evision-ventures.com>
Cc: Nick Kurshev <nickols_k@mail.ru>, linux-kernel@vger.kernel.org
Subject: Re: /dev/port BUG and possible workaround
Date: Wed, 22 May 2002 13:09:50 +0100	[thread overview]
Message-ID: <3CEB8A8E.6090401@antefacto.com> (raw)
In-Reply-To: <20020522124116.680f59b8.nickols_k@mail.ru> <3CEB4E43.5020203@evision-ventures.com>

Martin Dalecki wrote:
> Uz.ytkownik Nick Kurshev napisa?:
> 
> ...
> 
>> 800=inl(CFC)
>> 2. Wrong log with using of /dev/port:
> 
> ...
> 
>> But it seems that nobody uses this device. Then what is goal
>> of implementing of this device?
> 
> Basically the goal is that contrary to some silly /proc
> stuff which is "en vouge" nowadays you have the ability to
> controll port access by using normal user permission control
> semantics of unix file access permissions, by giving /dev/port
> a proper group and so on. This is legacy crap of course, since
> the above goal can be reached by using a apache-suexec alike wrapper
> as well... even with more fine grained resolution of access controll.

It also allows you to write a watchdog driver in shell :-)

#!/bin/sh
# Padraig@antefacto.com
# This supports both the Ibase MB700 and Advantech PCM9576

usage() {
     echo "Usage: `basename $0` [pat] [playdead]"
     exit 1
}

if [ $# != 1 ]; then usage; fi;
if [ $1 != "pat" ]; then
     if [ $1 != "playdead" ]; then
         usage
     fi
fi

HW_VERSION=`cat /var/run/HW_VERSION`

if [ "$HW_VERSION" == "IBASE MB700" ];
     ENABLE_PORT=`printf %d 0x443`
     DISABLE_PORT=`printf %d 0x441`

     if [ $1 == "pat" ]; then
         TIMEOUT='\x5' #20 seconds (0=30s, 1=28s, ..., F=0s)
         printf "$TIMEOUT" | dd bs=1 seek=$ENABLE_PORT of=/dev/port
     else
         #write any value to port to disable
         printf "\001" | dd bs=1 seek=$DISABLE_PORT of=/dev/port
     fi
elif [ "$HW_VERSION" == "Advantech PCM9576" ]; then
     DISENABLE_PORT=`printf %d 0x443`

     if [ $1 == "pat" ]; then
         TIMEOUT='\x14' #20 seconds (1=1s, 2=2s, ..., 3E=62s)
         printf "$TIMEOUT" | dd bs=1 seek=$DISENABLE_PORT of=/dev/port
     else
         #read from port to disable
         dd bs=1 count=1 skip=$DISENABLE_PORT if=/dev/port of=/dev/null
     fi
fi


      parent reply	other threads:[~2002-05-22 12:10 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-05-22  8:41 /dev/port BUG and possible workaround Nick Kurshev
2002-05-22  7:52 ` Martin Dalecki
2002-05-22  9:12   ` Nick Kurshev
2002-05-22 12:09   ` Padraig Brady [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3CEB8A8E.6090401@antefacto.com \
    --to=padraig@antefacto.com \
    --cc=dalecki@evision-ventures.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nickols_k@mail.ru \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.