Jump to content

Casi

Members
  • Posts

    3
  • Joined

  • Last visited

  1. I've found my error, I've found my error, I filtered all events with EPOLLET flag that is input-only, so it newer occured in output
  2. I'm sorry, I've meant Orange PI Lite with H3 processor. Sorry for long reply. As a newbie I have limitations for posts
  3. Hello everyone, I'm creating my coursework project and I should create my own C++ library for easier GPIO usage. I'm struggling with using epoll in my code, because it doesn't register edge events, that I specified. My code looks like this: void somePollingFunc(std::string path) { int epollFD = epoll_create1(0); if(epollFD == -1){ throw std::runtime_error("Failed to create epoll"); } int socketToRead = open(path.c_str(), O_RDONLY | O_NONBLOCK); if(socketToRead < 0) { throw std::runtime_error(std::string("Failed to open file\nPath: ") + path.data()); } // Creating epoll struct struct epoll_event gpioPollFD; gpioPollFD.data.fd = socketToRead; gpioPollFD.events = EPOLLET; // Adding gpio fd to epoll if(epoll_ctl(epollFD, EPOLL_CTL_ADD, socketToRead, &gpioPollFD) == -1) { throw std::runtime_error("Failed to add custom file descriptor to epoll"); } char readByte; bool callbackStop = false; int pollValue; do { pollValue = epoll_wait(epollFD, &gpioPollFD, 1, 100); if(pollValue == 0){ continue; } if(::read(gpioPollFD.data.fd, &readByte, 1)){ callbackStop = callback(readByte); } lseek(gpioPollFD.data.fd, 0, SEEK_SET); } while(!callbackStop); close(epollFD); } I checked my edge file, its value is set right, also I experimented using EPOLLIN or EPOLLPRI, they both works for every action that happen to socket Am I missing something or such functionality doesn't work?
×
×
  • Create New...

Important Information

Terms of Use - Privacy Policy - Guidelines