linux device open() and ioctl()

From: Dirk Meier (Dirk.Meier@cern.ch)
Date: Mon Aug 16 1999 - 16:44:45 MEST


Hello,

is anybody experienced using devices under linux from ROOT/CINT.
I started with the follwing macro:
(The device exists and an insmod driver is running).

// aIOTest.C
{

  gROOT->Reset();

#include <ioctls.h>            // this is o.k.
#include <ioctl-types.h>       // this is o.k.

#include <linux/ioctl.h>       // this is o.k.
#include <linux/kernel.h>      // this is o.k.

#include <stdio.h>             // this is o.k.
#include <stdlib.h>            // this is o.k. 
#include <fcntl.h>             // this is o.k.
#include <unistd.h>            // this is o.k. 

//#include <fcntlbits.h>         // +P/-p message appears , can't use this
//fortunately, here only need the following definition
#define O_RDWR                  02  

 Int_t fd    = open("/dev/despex",O_RDWR);  // device exists, user has permission
 Int_t error = ioctl(fd, _IO('k', 3), 0);   // 

}

  *******************************************
  *                                         *
  *        W E L C O M E  to  R O O T       *
  *                                         *
  *   Version   2.21/01   14 January 1999   *
  *                                         *
  *  You are welcome to visit our Web site  *
  *          http://root.cern.ch            *
  *                                         *
  *******************************************

FreeType Engine v1.1 used to render TrueType fonts.

CINT/ROOT C/C++ Interpreter version 5.13.83, Dec 2 1998
Type ? for help. Commands must be C++ statements.
Enclose multiple statements between { }.

root [0] .x aIOTest.C       
Error: No symbol open("/dev/despex",O_RDWR) in current scope
FILE:/home/xray/cc/despex/learn9908/macros/./aIOTest.C LINE:30
*** Interpreter error recovered ***


thanks for your help
Dirk 



This archive was generated by hypermail 2b29 : Tue Jan 04 2000 - 00:43:38 MET