Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Installation and Deployment
  4. access directly to I/O ports on PC hardware in ubuntu give segmentation fault

access directly to I/O ports on PC hardware in ubuntu give segmentation fault

Scheduled Pinned Locked Moved Solved Installation and Deployment
4 Posts 2 Posters 716 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    anil_arise
    wrote on last edited by
    #1

    i am using outl (unsigned int __value, unsigned short int __port) & inl (unsigned short int __port) that are not part of compilation but it is used in run time . it gives me segmentation error.
    I am using Ubuntu 16.04
    and qt5

    i get /usr/include/x86_64-linux-gnu/sys/io.h is located correctly.

    jsulmJ 1 Reply Last reply
    0
    • A anil_arise

      i am using outl (unsigned int __value, unsigned short int __port) & inl (unsigned short int __port) that are not part of compilation but it is used in run time . it gives me segmentation error.
      I am using Ubuntu 16.04
      and qt5

      i get /usr/include/x86_64-linux-gnu/sys/io.h is located correctly.

      jsulmJ Offline
      jsulmJ Offline
      jsulm
      Lifetime Qt Champion
      wrote on last edited by
      #2

      @anil_arise In what way is it related to Qt?
      Did you try to debug your app to see where and why it crashes?
      From the information you provided others can only guess...

      https://forum.qt.io/topic/113070/qt-code-of-conduct

      A 1 Reply Last reply
      2
      • jsulmJ jsulm

        @anil_arise In what way is it related to Qt?
        Did you try to debug your app to see where and why it crashes?
        From the information you provided others can only guess...

        A Offline
        A Offline
        anil_arise
        wrote on last edited by
        #3

        @jsulm this is the simple code of two methods;;;;;...............

        #include <sys/io.h>

        typedef unsigned long DWORD;
        // PCI Device Read/Write I/O
        #define PCI_CONFIG_ADDR 0xCF8
        #define PCI_CONFIG_DATA 0xCFC

        DWORD SMBUS::PCI_Read(int size_t)
        {
        DWORD dwAddrVal;
        dwAddrVal= inl(PCI_CONFIG_DATA);
        usleep(10);
        return dwAddrVal;
        }

        void SMBUS::PCI_Write(DWORD dwDataVal,int size_t)
        {
        outl(dwDataVal,PCI_CONFIG_ADDR);
        usleep(10);
        }

        ............................................
        in this code when i got crash when go to inl() or outl() these are predefined function of sys/io.h

        jsulmJ 1 Reply Last reply
        0
        • A anil_arise

          @jsulm this is the simple code of two methods;;;;;...............

          #include <sys/io.h>

          typedef unsigned long DWORD;
          // PCI Device Read/Write I/O
          #define PCI_CONFIG_ADDR 0xCF8
          #define PCI_CONFIG_DATA 0xCFC

          DWORD SMBUS::PCI_Read(int size_t)
          {
          DWORD dwAddrVal;
          dwAddrVal= inl(PCI_CONFIG_DATA);
          usleep(10);
          return dwAddrVal;
          }

          void SMBUS::PCI_Write(DWORD dwDataVal,int size_t)
          {
          outl(dwDataVal,PCI_CONFIG_ADDR);
          usleep(10);
          }

          ............................................
          in this code when i got crash when go to inl() or outl() these are predefined function of sys/io.h

          jsulmJ Offline
          jsulmJ Offline
          jsulm
          Lifetime Qt Champion
          wrote on last edited by
          #4

          @anil_arise Please read https://linux.die.net/man/2/inl
          Especially:
          "You use ioperm(2) or alternatively iopl(2) to tell the kernel to allow the user space application to access the I/O ports in question. Failure to do this will cause the application to receive a segmentation fault."

          https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          2

          • Login

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved