Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

I use two keyboards (laptop and USB connected), one works, the other doesn't. Why? #17

Open
leabit opened this issue Apr 13, 2024 · 1 comment
Assignees

Comments

@leabit
Copy link

leabit commented Apr 13, 2024

My code:

package main

import (
	"fmt"

	"github.com/MarinX/keylogger"
)

func main() {
        // k, err := keylogger.New("/dev/input/event14")
	k, err := keylogger.New("/dev/input/event3")
	if err != nil {
		fmt.Println(err)
		return
	}
	defer k.Close()

	events := k.Read()

	for e := range events {
		switch e.Type {
		case keylogger.EvKey:
			if e.KeyPress() {
				fmt.Println("[event] press key ", e.KeyString())
			}
		}
	}
}

I have two keyboards. One original from the laptop (/dev/input/event3) and one connected to laptop via USB (/dev/input/event14). When I use keylogger.New("/dev/input/event3") and press something on the laptop keyboard everything works as I expect. However, when I change to keylogger.New("/dev/input/event14"), that is, to my other keyboard and press something on that keyboard, nothing happens.

The result of sudo lsinput:


....

/dev/input/event3
   bustype : BUS_I8042
   vendor  : 0x1
   product : 0x1
   version : 43962
   name    : "AT Translated Set 2 keyboard"
   phys    : "isa0060/serio0/input0"
   bits ev : (null) (null) (null) (null) (null)

....

/dev/input/event14
   bustype : BUS_USB
   vendor  : 0x258a
   product : 0x3a
   version : 273
   name    : "SINO WEALTH Gaming KB  Keyboard"
   phys    : "usb-0000:04:00.3-2.3/input1"
   uniq    : ""
   bits ev : (null) (null) (null) (null)

....

Why is this happening? What should I do?

@MarinX MarinX self-assigned this Jun 4, 2024
@leabit
Copy link
Author

leabit commented Sep 14, 2024

@MarinX any progress?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants