Skip to content

ioctl( "/dev/hidraw0", TCGETS, …) always fails #255

@dilyanpalauzov

Description

@dilyanpalauzov

I want to open a /dev/hidraw0 serial port using new NRSerialPort("/dev/hidraw0", 2400) as everything else has not worked. So once I do

(new NRSerialPort("/dev/hidraw0", 2400)).connect()

under strace, it shows

[pid  9193] stat64("/var/lock/LCK..hidraw0",  0x5f2d00b0) = -1 ENOENT (No such file or directory)
[pid  9193] openat(AT_FDCWD, "/var/lock/LCK..hidraw0", O_WRONLY|O_CREAT|O_EXCL, 0666 )       = 225
[pid  9193] getpid( )       = 7840
[pid  9193] write(225, "      7840\n", 11)        = 11
[pid  9193] close(225 )        = 0
[pid  9193] openat(AT_FDCWD, "/dev/hidraw0", O_RDONLY|O_NOCTTY|O_NONBLOCK )       = 225
[pid  9193] getpid( )       = 7840
[pid  9193] fcntl64(225, F_SETOWN, 7840 )      = 0
[pid  9193] fcntl64(225, F_SETFD, 0 )      = 0
[pid  9193] fcntl64(225, F_GETLK , 0x902) = -1 EFAULT (Bad address)
[pid  9193] ioctl(225, TCGETS , 0x5f2d14e8) = -1 EINVAL (Invalid argument)
[pid  9193] openat(AT_FDCWD, "/var/lock/LCK..hidraw0", O_RDONLY )       = 226
[pid  9193] read(226,  "      7840\n", 11) = 11
[pid  9193] close(226 )        = 0
[pid  9193] getpid( )       = 7840
[pid  9193] getpid()                    = 7840
[pid  9193] getppid( )      = 1
[pid  9193] unlink("/var/lock/LCK..hidraw0" )       = 0
[pid  9193] fcntl64(225, F_GETFL)      = 0x800 (flags O_RDONLY|O_NONBLOCK)
[pid  9193] close(225)        = 0

and connect() returns false. My understanding is that ioctl(, TCGETS, ) is the same as tcgetattr(fd, argp) and this probably does not work on hidraw devices. I event have changed chmod 777 /dev/hidraw0, it dit not help.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions