If there is anyone who has a clue about writing to a streams driver,
please help!!!
I just got in some HSI cards and Solaris 2.x driver software from Sun
and am trying to send some simple messages with "putmsg". When I run the
diagnostics, I see that the interface is working correctly, but I can't get
the following code to work:
main()
{
int fd = open("/dev/hih0", O_WRONLY);
if (fd < 1) {
cerr << "Couldn't open device." << endl;
exit(-1);
}
cerr << "Opened device" << endl;
int MAXSIZE = 1152;
char buf[MAXSIZE];
struct strbuf data;
data.maxlen = 1152;
data.buf = buf;
while (1) {
int g = read(0, buf, MAXSIZE);
cerr << "Sent " << g << " bytes" << endl;
if (g < 1) return 0;
data.len = g;
if (putmsg(fd, 0, &data, 0)) perror("putmsg");
}
It opens the device, sends about 3 packets (which don't make it out theQuote:}
interface), and blocks. I assume that since the diagnostics work, I am
using putmsg wrong for this driver. The documentation doesn't give any
examples.
Thanks for any help !!
Shayne