5 Replies Latest reply on Jul 13, 2011 4:41 PM by 873748

    Is There a Standard or Common JNI to the (POSIX) C Driver Interface?

    873748
      I have the source code in (POSIX) C for an RS422 Serial Driver.

      I've been asked to create the JNI for using the 8 driver interfaces:
      install()
      open()
      read()
      write()
      ioctl()
      select()
      close()
      uninstall()

      This seems like something that enough people would want to do that there'd be a Standard or Common Practice way to do this. However, my Google-foo has let me down on finding it.

      Since I have the source code, I've considered re-compliling the driver code into a library and writing the JNI to call into that library. The potential problem I see with this is that normally the driver would get dynamically linked into the kernel, and the calls from Java would run the library functions in userspace.

      I've also considered creating the JNI to call clib functions (read, write, ioctl, ...). Then the driver would get used normally, but the problem I see with this is that install() and uninstall() do not seem to have a standard (POSIX) C function that directly corresponds do them. Most Linux forums mention insmod and mknod to install the driver and make the device node, but LynxOS uses dr_install and dev_install.

      So here's my question: Is there a Standard or Common Practice way to access a driver from Java?