> Hi there, I don't have a program to offer you. All my old code is in > other languages. > I did however write a little working example for you. > You will need to use port, not parport0. > For some reason that is unknown to me, I too, am unable to get parport > to work correctly from gambas. > > I tested the code below, and it does work. I ran it a few times on a > system with Ubuntu 9.04, gambas 2.20, and a little parallel port tester > I made 20 years ago. > > Unless you have already sorted out permission to access 'port', you will > need to be root to run it, either start gambas as root, or compile it > and then run the executable as root. > > PUBLIC SUB Main() > ' Gambas module file > DIM pport AS File > DIM bi, bo AS Byte > > pport = OPEN "/dev/port" FOR READ WRITE > > FOR bo = 32 TO 122 > SEEK #pport, 888 > WRITE #pport, bo > SEEK #pport, 888 > READ #pport, bi > PRINT Chr(bi) & " " > WAIT 0.05 > NEXT > CLOSE #pport > > END > > Just a quick mention about seek on ports. > Seek simply takes you to the port address. Notice I used a seek before > each read or write. > > 888 (0x378): Data > 889 (0x379): Status > 890 0x37A) : Control > > > > Hope this helps > Regards > Les Hardy >
And you can even look in the Linux kernel source code to see how /dev/port is implemented: a few lines of code in '/usr/src/linux/drivers/char/mem.c'. Regards, -- Benoît Minisini ------------------------------------------------------------------------------ Download Intel® Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev _______________________________________________ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user