I’m trying to open my Xbox Gamepad at /dev/input/js0 using syscall 56. I have verified the devices’ existence at the given path. Including through a test program written in C with open(). However, the program continues to branch FailExit.
.global main
.section .text
.align 2
main:
ldr x0, =GamepadPath
mov x1, #0
mov x8, #56
svc #0
cmp x0, #0
blt FailExit
mov x0, #1
ldr x1, =SuccessMsg
mov x2, #25
mov x8, #64
svc #0
mov x0, #0
mov x8, #93
svc #0
FailExit:
mov x0, #1
ldr x1, =ErrorMsg
mov x2, #25
mov x8, #64
svc #0
mov x0, #0
mov x8, #93
svc #0
.section .data
.section .rodata
GamepadPath: .asciz "/dev/input/js0"
SuccessMsg: .asciz "Gamepad Connectednn"
ErrorMsg: .asciz "Gamepad Not Availablenn"
.section .bss
I’ve attempt to understand several references including:
openat(2) – Linux man page
ARM64.Syscall.sh
What leaves me confused is that Syscall 56, OpenAt‘s first argument at x0 is suppose to be a return value set by syscall Open, which I cannot find on any reference for ARMv8 Linux.
Side Note: Software assembled with GCC. Which expects main rather than
start…