PDA

Bekijk de volledige versie : parport bits controling utility



pipos
07-09-2005, 14:59
Hi all

Could you please send me how to sets paralel ports bits from wl500g command line?

Is it possible via echo to /dev/lp0, or i need something else?

Or where aj can find some binary to sets paralel port bits? I'm not so good in linux to compile some for wl500g.

thanks

pipos
08-09-2005, 17:09
Please....

could someone make this source to work under wl500g as binary.
I really need this, and I have no ide how to do this..

please help


/*
* Simple parallel port output control program for Linux
* Written and copyright by Tomi Engdahl 1998
* (e-mail: tomi.engdahl@hut.fi)
*
* The program output the data value to PC parallel port data pins
* (default lpt1 I/O address 0x378). The data values are given as the
* command line parameter to the program. The number can be
* in decimal (0..255) or hexadecimal format (0x00..0xFF).
*
*/

#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <asm/io.h>

#define base 0x378 /* printer port base address */

main(int argc, char **argv)
{
int value;

if (argc!=2)
fprintf(stderr, "Error: Wrong number of arguments. This program needs one argument which is number between 0 and 255.\n"), exit(1);
if (sscanf(argv[1],"%i",&value)!=1)
fprintf(stderr, "Error: Parameter is not a number.\n"), exit(1);
if ((value<0) || (value>255))
fprintf(stderr, "Error: Invalid numeric value. The parameter number must be between 0 and 255\n"), exit(1);
if (ioperm(base,1,1))
fprintf(stderr, "Error: Couldn't get the port at %x\n", base), exit(1);

outb((unsigned char)value, base);
}

unaiur
08-09-2005, 19:22
This code doesn't compile:


In file included from /opt/brcm/hndtools-mipsel-uclibc-3.2.3-full/include/linux/sched.h:13,
from /opt/brcm/hndtools-mipsel-uclibc-3.2.3-full/include/linux/mm.h:4,
from /opt/brcm/hndtools-mipsel-uclibc-3.2.3-full/include/linux/pagemap.h:10,
from /opt/brcm/hndtools-mipsel-uclibc-3.2.3-full/include/asm/io.h:15,
from parport.c:16:
/opt/brcm/hndtools-mipsel-uclibc-3.2.3-full/include/linux/times.h:5: parse error before "clock_t"
/opt/brcm/hndtools-mipsel-uclibc-3.2.3-full/include/linux/times.h:7: parse error before "tms_cutime"
/opt/brcm/hndtools-mipsel-uclibc-3.2.3-full/include/linux/times.h:8: parse error before "tms_cstime"
In file included from /opt/brcm/hndtools-mipsel-uclibc-3.2.3-full/include/linux/sched.h:18,
from /opt/brcm/hndtools-mipsel-uclibc-3.2.3-full/include/linux/mm.h:4,
from /opt/brcm/hndtools-mipsel-uclibc-3.2.3-full/include/linux/pagemap.h:10,
from /opt/brcm/hndtools-mipsel-uclibc-3.2.3-full/include/asm/io.h:15,
from parport.c:16:
/opt/brcm/hndtools-mipsel-uclibc-3.2.3-full/include/asm/semaphore.h:31: parse error before "wait_queue_head_t"
/opt/brcm/hndtools-mipsel-uclibc-3.2.3-full/include/asm/semaphore.h: In function `sema_init':
/opt/brcm/hndtools-mipsel-uclibc-3.2.3-full/include/asm/semaphore.h:65: dereferencing pointer to incomplete type
/opt/brcm/hndtools-mipsel-uclibc-3.2.3-full/include/asm/semaphore.h:66: dereferencing pointer to incomplete type
/opt/brcm/hndtools-mipsel-uclibc-3.2.3-full/include/asm/semaphore.h:67: dereferencing pointer to incomplete type
/opt/brcm/hndtools-mipsel-uclibc-3.2.3-full/include/asm/semaphore.h: In function `down':
/opt/brcm/hndtools-mipsel-uclibc-3.2.3-full/include/asm/semaphore.h:93: dereferencing pointer to incomplete type
/opt/brcm/hndtools-mipsel-uclibc-3.2.3-full/include/asm/semaphore.h: In function `down_interruptible':
/opt/brcm/hndtools-mipsel-uclibc-3.2.3-full/include/asm/semaphore.h:108: dereferencing pointer to incomplete type
/opt/brcm/hndtools-mipsel-uclibc-3.2.3-full/include/asm/semaphore.h: In function `down_trylock':
/opt/brcm/hndtools-mipsel-uclibc-3.2.3-full/include/asm/semaphore.h:122: dereferencing pointer to incomplete type
/opt/brcm/hndtools-mipsel-uclibc-3.2.3-full/include/asm/semaphore.h: In function `up':
/opt/brcm/hndtools-mipsel-uclibc-3.2.3-full/include/asm/semaphore.h:193: dereferencing pointer to incomplete type
/opt/brcm/hndtools-mipsel-uclibc-3.2.3-full/include/asm/semaphore.h: In function `sem_getcount':
/opt/brcm/hndtools-mipsel-uclibc-3.2.3-full/include/asm/semaphore.h:199: dereferencing pointer to incomplete type
In file included from /opt/brcm/hndtools-mipsel-uclibc-3.2.3-full/include/linux/signal.h:4,
from /opt/brcm/hndtools-mipsel-uclibc-3.2.3-full/include/linux/sched.h:26,
from /opt/brcm/hndtools-mipsel-uclibc-3.2.3-full/include/linux/mm.h:4,
from /opt/brcm/hndtools-mipsel-uclibc-3.2.3-full/include/linux/pagemap.h:10,
from /opt/brcm/hndtools-mipsel-uclibc-3.2.3-full/include/asm/io.h:15,
from parport.c:16:
/opt/brcm/hndtools-mipsel-uclibc-3.2.3-full/include/asm/signal.h: At top level:
/opt/brcm/hndtools-mipsel-uclibc-3.2.3-full/include/asm/signal.h:20: conflicting types for `sigset_t'
/opt/brcm/hndtools-mipsel-uclibc-3.2.3-full/include/sys/select.h:38: previous declaration of `sigset_t'
In file included from /opt/brcm/hndtools-mipsel-uclibc-3.2.3-full/include/linux/signal.h:5,
from /opt/brcm/hndtools-mipsel-uclibc-3.2.3-full/include/linux/sched.h:26,
from /opt/brcm/hndtools-mipsel-uclibc-3.2.3-full/include/linux/mm.h:4,
from /opt/brcm/hndtools-mipsel-uclibc-3.2.3-full/include/linux/pagemap.h:10,
from /opt/brcm/hndtools-mipsel-uclibc-3.2.3-full/include/asm/io.h:15,
from parport.c:16:
/opt/brcm/hndtools-mipsel-uclibc-3.2.3-full/include/asm/siginfo.h:44: parse error before "clock_t"
/opt/brcm/hndtools-mipsel-uclibc-3.2.3-full/include/asm/siginfo.h:46: parse error before "clock_t"
/opt/brcm/hndtools-mipsel-uclibc-3.2.3-full/include/asm/siginfo.h:52: parse error before "clock_t"
/opt/brcm/hndtools-mipsel-uclibc-3.2.3-full/include/asm/siginfo.h:54: parse error before "_stime"
/opt/brcm/hndtools-mipsel-uclibc-3.2.3-full/include/asm/siginfo.h:81: parse error before '}' token
/opt/brcm/hndtools-mipsel-uclibc-3.2.3-full/include/asm/siginfo.h:82: parse error before '}' token
In file included from /opt/brcm/hndtools-mipsel-uclibc-3.2.3-full/include/linux/sched.h:80,
from /opt/brcm/hndtools-mipsel-uclibc-3.2.3-full/include/linux/mm.h:4,
from /opt/brcm/hndtools-mipsel-uclibc-3.2.3-full/include/linux/pagemap.h:10,
from /opt/brcm/hndtools-mipsel-uclibc-3.2.3-full/include/asm/io.h:15,
from parport.c:16:
/opt/brcm/hndtools-mipsel-uclibc-3.2.3-full/include/linux/time.h:9: redefinition of `struct timespec'
/opt/brcm/hndtools-mipsel-uclibc-3.2.3-full/include/linux/time.h:88: redefinition of `struct timeval'
/opt/brcm/hndtools-mipsel-uclibc-3.2.3-full/include/linux/time.h:90: parse error before "suseconds_t"
In file included from /opt/brcm/hndtools-mipsel-uclibc-3.2.3-full/include/linux/sched.h:87,
from /opt/brcm/hndtools-mipsel-uclibc-3.2.3-full/include/linux/mm.h:4,
from /opt/brcm/hndtools-mipsel-uclibc-3.2.3-full/include/linux/pagemap.h:10,
from /opt/brcm/hndtools-mipsel-uclibc-3.2.3-full/include/asm/io.h:15,
from parport.c:16:
/opt/brcm/hndtools-mipsel-uclibc-3.2.3-full/include/asm/processor.h:102: parse error before "fpureg_t"
/opt/brcm/hndtools-mipsel-uclibc-3.2.3-full/include/asm/processor.h:104: parse error before "fpureg_t"
/opt/brcm/hndtools-mipsel-uclibc-3.2.3-full/include/asm/processor.h:106: parse error before '}' token
/opt/brcm/hndtools-mipsel-uclibc-3.2.3-full/include/asm/processor.h:110: field `soft' has incomplete type
In file included from /opt/brcm/hndtools-mipsel-uclibc-3.2.3-full/include/asm/pgtable.h:18,
from /opt/brcm/hndtools-mipsel-uclibc-3.2.3-full/include/linux/pagemap.h:15,
from /opt/brcm/hndtools-mipsel-uclibc-3.2.3-full/include/asm/io.h:15,
from parport.c:16:
/opt/brcm/hndtools-mipsel-uclibc-3.2.3-full/include/asm/fixmap.h:58: parse error before "pgprot_t"
In file included from /opt/brcm/hndtools-mipsel-uclibc-3.2.3-full/include/linux/pagemap.h:15,
from /opt/brcm/hndtools-mipsel-uclibc-3.2.3-full/include/asm/io.h:15,
from parport.c:16:
/opt/brcm/hndtools-mipsel-uclibc-3.2.3-full/include/asm/pgtable.h:192: parse error before "invalid_pte_table"
/opt/brcm/hndtools-mipsel-uclibc-3.2.3-full/include/asm/pgtable.h:192: `pmd_t' undeclared here (not in a function)
/opt/brcm/hndtools-mipsel-uclibc-3.2.3-full/include/asm/pgtable.h:198: parse error before "pmd"
/opt/brcm/hndtools-mipsel-uclibc-3.2.3-full/include/asm/pgtable.h: In function `pmd_page':
/opt/brcm/hndtools-mipsel-uclibc-3.2.3-full/include/asm/pgtable.h:200: `pmd' undeclared (first use in this function)
/opt/brcm/hndtools-mipsel-uclibc-3.2.3-full/include/asm/pgtable.h:200: (Each undeclared identifier is reported only once
/opt/brcm/hndtools-mipsel-uclibc-3.2.3-full/include/asm/pgtable.h:200: for each function it appears in.)
/opt/brcm/hndtools-mipsel-uclibc-3.2.3-full/include/asm/pgtable.h: At top level:
/opt/brcm/hndtools-mipsel-uclibc-3.2.3-full/include/asm/pgtable.h:203: parse error before '*' token
/opt/brcm/hndtools-mipsel-uclibc-3.2.3-full/include/asm/pgtable.h: In function `pmd_set':
/opt/brcm/hndtools-mipsel-uclibc-3.2.3-full/include/asm/pgtable.h:205: `pmdp' undeclared (first use in this function)
/opt/brcm/hndtools-mipsel-uclibc-3.2.3-full/include/asm/pgtable.h:205: `ptep' undeclared (first use in this function)
/opt/brcm/hndtools-mipsel-uclibc-3.2.3-full/include/asm/pgtable.h: At top level:
/opt/brcm/hndtools-mipsel-uclibc-3.2.3-full/include/asm/pgtable.h:208: parse error before "pte"
/opt/brcm/hndtools-mipsel-uclibc-3.2.3-full/include/asm/pgtable.h: In function `pte_none':
/opt/brcm/hndtools-mipsel-uclibc-3.2.3-full/include/asm/pgtable.h:208: `pte' undeclared (first use in this function)
/opt/brcm/hndtools-mipsel-uclibc-3.2.3-full/include/asm/pgtable.h: At top level:
/opt/brcm/hndtools-mipsel-uclibc-3.2.3-full/include/asm/pgtable.h:209: parse error before "pte"
/opt/brcm/hndtools-mipsel-uclibc-3.2.3-full/include/asm/pgtable.h: In function `pte_present':
/opt/brcm/hndtools-mipsel-uclibc-3.2.3-full/include/asm/pgtable.h:209: `pte' undeclared (first use in this function)
/opt/brcm/hndtools-mipsel-uclibc-3.2.3-full/include/asm/pgtable.h: At top level:
/opt/brcm/hndtools-mipsel-uclibc-3.2.3-full/include/asm/pgtable.h:215: parse error before '*' token
/opt/brcm/hndtools-mipsel-uclibc-3.2.3-full/include/asm/pgtable.h: In function `set_pte':
/opt/brcm/hndtools-mipsel-uclibc-3.2.3-full/include/asm/pgtable.h:217: `ptep' undeclared (first use in this function)
/opt/brcm/hndtools-mipsel-uclibc-3.2.3-full/include/asm/pgtable.h:217: `pteval' undeclared (first use in this function)
/opt/brcm/hndtools-mipsel-uclibc-3.2.3-full/include/asm/pgtable.h:220: `pte_t' undeclared (first use in this function)

unaiur
08-09-2005, 19:25
This piece of code is designed for an IBM compatible personal computer. The asus router isn't a PC, so the pararell port probably doesn't work like this code expects.

wtzm
09-09-2005, 13:19
Have a look at this thread (http://wl500g.info/showthread.php?t=3210).
EDIT: Wrong link. Sorry for causing confusion.

narcis
09-09-2005, 19:12
Have a look at this thread (http://wl500g.info/showthread.php?t=3210).
In order to understand recursion, one must first understand recursion.

wtzm
10-09-2005, 11:47
Alright, got it :D
The right link is this one (http://wl500g.info/showthread.php?t=2286).