Several questions here, but first some background:
Our software is QNX version 4.25. Our hardware is a Ampro P5e
board interfacing to PCMCIA card via Ampro MM2-PCC adaptor
board. Our system will collect data and write it to a “Sundisk SDP5/3 0.6”
card. We will then take the card and read it into NT machine for further
processing.
What we have found:
After launching Pcmcia.generic we use the “pin cis” command to
extract the configuration for the “Sundisk SDP5/3 0.6” card and
this confuguration is added it to pcmcia.cards file.
After launching Efsys.365sl server we see /dev/skt1 in /dev directory.
The program (below) will try and write then read to/from the card, but it
does not work. The open() as shown in the program is not successful
BUT if we open using “/dev/skt1” instead, then the open IS successful
BUT then after successful write, seek, read we don’t read back the
“Hello World”, even though wbytes is 11, pos is 0, and rbytes is 11.
Finally my questions:
Which driver should we be using? Currently using Efsys.365sl but is this
the correct driver for our hardware?
Can we use buffered I/O calls (fopen, fread, fwrite etc.)? These do not
seem to work.
Do the Sundisk cards need to be formatted or mounted?
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <sys/uio.h>
#include <unistd.h>
int main (void)
{
off_t pos;
int fd;
int wbytes , rbytes;
char buf[15] = “Hello World”;
char temp[15] = “test”;
fd = open("/dev/skt1/filename", O_RDWR | O_CREAT, S_IRWXU);
if (fd == -1)
perror("\nFailed to open device.\n");
wbytes = write(fd, buf, strlen(buf));
if(wbytes == -1)
perror("\nFailed to write to the device.\n");
pos = lseek(fd, 0L, SEEK_SET);
rbytes = read(fd, temp, strlen(buf));
if (rbytes == -1)
perror("\nFailed to read from the device.\n");
printf("\ntemp is %s, buf is %s\n", temp, buf); // does not print
anything
close(fd);
return 0;
}
regards
Rob Murenbeeld
robm@optech.on.ca