ggerganov / kbd-audio

🎤⌨️ Acoustic keyboard eavesdropping
https://ggerganov.github.io/keytap
MIT License
8.55k stars 588 forks source link

Error 'Buffer size in file (…..) does not match the expected one (5)' #23

Closed Mi-Al closed 5 years ago

Mi-Al commented 5 years ago

Hello! I am trying to run keytap on Linux system like that: sudo ./keytap /dev/input/event13 But every time I got the error:

Buffer size in file (1565157006) does not match the expected one (5)

The first number is always changing, for example:

Buffer size in file (1565157170) does not match the expected one (5)

Please, would you like to provide some information how to select input device (input.kbd)? Because in my Linux installation I have 24 /dev/input/event* devices...

Thank you in advanced.

ggerganov commented 5 years ago

The selection of input device is done via the the -cN command line argument.

For example, first run: ./keytap input.kbd -c0

You will see output similar to

$ ./keytap input.kbd -c0
Usage: ./keytap input.kbd [input2.kbd ...] [-cN] [-pF] [-tF]
    -cN - select capture device N
    -pF - prediction threshold: CC > F
    -tF - background threshold: ampl > F*avg_background

Found 3 capture devices:
    - Capture device #0: 'Family 17h (Models 00h-0fh) HD Audio Controller Analog Stereo'
    - Capture device #1: 'HD Audio some other device'
    - Capture device #2: 'HD Audio some third device'
Attempt to open capture device 0 : 'Family 17h (Models 00h-0fh) HD Audio Controller Analog Stereo' ...
Opened capture device succesfully!
    Frequency:  24000
    Format:     33056 (4 bytes)
    Channels:   1
    Samples:    512

You will see the available capture devices listed with indices. To change to the desired capture device, lets say to 2, simply run:

$ ./keytap input.kbd -c2

Note that you need to generate the input.kbd file yourself using the record tool.

Mi-Al commented 5 years ago

Thank you for quick reply! I got it now! I was confused before and thought I should specify input device in file system like **/dev/input/event***. Closing.