掌機 - Z-Pocket Game Pro (ZPG Pro) - 控制振動馬達



main.c

#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <time.h>
#include <fcntl.h>
#include <string.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/epoll.h>
#include <linux/uinput.h>

int main(int argc, char** argv)
{
    int fd = open("/sys/class/gpio/gpio17/value", O_RDWR);

    if (fd > 0) {
        write(fd, "1", 1);
        usleep(1000000);
        write(fd, "0", 1);
        close(fd);
    }

    return 0;
}