HOW to type with an USB Keyboard in the OpenWRT Terminal???

Hi guys,

I wanna ask you if it is possible to write in the OpenWRT terminal by a connected keyboard in the usb port.

I have installed this package "kmod-usb-hid" so that Arduino Yun can recognize an usb keyboard connected in the usb port. But the problem is when I am writing something, these taps are not being sent to the terminal. I know that I cannot read these taps in a ssh terminal for example, it would be like blind mode without screen, tapping something and executing it in a terminal.

I can check that when I type something, all taps are in /dev/input/event1, but they are not being sent to a terminal...

Is it possible to redirect that in some way?

Thanks in advance!!
Regards.

Well, when you open a terminal, it asociates its own keyboard (for example, if you connect yun to laptop and open putty, putty will read the laptops keyboard).

If you want to use a usb keyboard, you have to set up a local monitor on yun, with a lcd or else.

mart256:
Well, when you open a terminal, it asociates its own keyboard (for example, if you connect yun to laptop and open putty, putty will read the laptops keyboard).

If you want to use a usb keyboard, you have to set up a local monitor on yun, with a lcd or else.

Is not it possible without and lcd or else, just connecting the Keyboard??

What you are asking sounds like a very odd thing to do: the Yun doesn't have a native display device, which is what is normally used with a native keyboard such as you are proposing. As such, the Yun really doesn't have a "terminal" window that it manages. Instead, for command line access, the Yun relies on a network SSH connection, or a serial connection from another computer. The commands come from that computer (usually from that computer's own keyboard) and the results get sent back to that computer (which are usually displayed on that computer's monitor using that computer's window manager -- the "terminal" program is running on the remote computer, NOT on the Yun.

It sounds like what you want to do is make an SSH connection into the Yun, but ignore the input stream from that connection, and instead take input from a locally connected keyboard? I'm having trouble picturing a practical use case for such a setup. You would need to run a command shell on the Yun, where it takes STDIN from the local keyboard, and sends STDOUT to the network connection. I'm sure it can be done with some clever programming and stream redirection, but why would you want to do it? What would the utility be for typing commands on a local keyboard, and having the output show up on a remote computer's display screen?

What are you really trying to accomplish here? Are you trying to figure out how a program you write on the Yun can read from a local keyboard? That sounds like an interesting project, if you have a practical application for it, but to just route those keystrokes to a command shell that has no way to display the results seems odd.

Thanks for the comment!!!

It is not a very odd thing to do, I just want to program a device that can work as a USB HID (so as a keyboard connected by arduino yun usb port) and do some commands in the terminal without watch anything in a display or something like that, because when I am programming I can check if the commands are correct or not.

This "USB HID" can be an Arduino UNO turning it into a Keyboard.

Does someone know how to do that?

Thanks in advance!!

CAlberca:
...
This "USB HID" can be an Arduino UNO turning it into a Keyboard.
...

Not true, since Arduino UNO is not 32u4 based.

Mouse and Keyboard libraries

These core libraries allow a 32u4 based boards or Due and Zero board to appear as a native Mouse and/or Keyboard to a connected computer.

Yun is 32u4 based, you could load Mouse and Keyboard libraries at Arduino side.

UPPPSSSS SORRY!!

I wanted to say "USB HID can be an USB Rubber Ducky".

Does someone knows how to use it in Arduino Yun? In my case I receive data in /dev/input/event1 but nothing happens...

THANKS IN ADVANCEEE!!

USB Rubber Ducky-The Original Keystroke Injection Tool?

Nearly every computer including desktops, laptops, tablets and smartphones take input from Humans via Keyboards. It's why there's a specification with the ubiquitous USB standard known as HID - or Human Interface Device. Simply put, any USB device claiming to be a Keyboard HID will be automatically detected and accepted by most modern operating systems. Whether it be a Windows, Mac, Linux or Android device the Keyboard is King.

32u4+ 'Keyboard libraries'='HID keyboard'

Use bridge class you could send key stroke form Linux to 32u4.

sonnyyu:
USB Rubber Ducky-The Original Keystroke Injection Tool?

USB Rubber Ducky - Hak5

32u4+ 'Keyboard libraries'='HID keyboard'

Use bridge class you could send key stroke form Linux to 32u4.

I do not want to send commands from Linux to 32u4.

I want to program the rubber ducky to automate some task in Linux environment (e.g. Check Software Updates or whatever) without using a LCD screen like other guys commented above.

This can be possible because the taps that rubber ducky does are in /dev/input/event1 as a keyboard more, but the problem is the commands are not being executing... So I have to pass those taps to the "terminal".....

Kernel command line:  board=Yun console=ttyATH0,250000 mtdparts=spi0.0:256k(u-boot)ro,64k(u-boot-env)ro,14656k(rootfs),1280k(kernel),64k(nvram),64k(art),15936k@0x50000(firmware) rootfstype=squashfs,jffs2 noinitrd

console=ttyATH0,250000

To make Kernel use HID keyboard, need change kernel source code and re-compile every thing, broken channel between AR9331 and ATmega32u4...

Pain is far more than gain.

Thank you very much!!

Pufff, absolutely yes, pain is far more than the gain... I hope there could be an easier and more comfortable different way hahaha although maybe with a python module redirecting the taps is possible.

CAlberca:
It is not a very odd thing to do, I just want to program a device that can work as a USB HID (so as a keyboard connected by arduino yun usb port) and do some commands in the terminal without watch anything in a display or something like that, because when I am programming I can check if the commands are correct or not.

Well, now you're changing the original requirements. In your first post (and this one) you keep using the term "terminal." That is an application that opens up a window, lets you type in commands to the command interpreter shell, and view the results of the command. The Yun doesn't have any way to view the results of the command that would be typed in from a USB keyboard, so the use of a "terminal" application doesn't make sense.

You are confusing the "terminal" (an application to access a command shell) with the command shell itself (the application that interprets and processes shell commands.) Forget "terminal." What you want is to send the keystrokes from the USB keyboard to a command interpreter shell for processing. I'm sure a Linux guru can come up with the appropriate command to launch a shell and redirect the keyboard input to that shell, and redirect the output to a NULL device so it is discarded/ignored.

But I'm still confused as to the practicality. The USB Rubber Ducky is designed to emulate keystrokes to a computer without having access to the internals of the computer. In fact, it is often used to exploit a vulnerability to gain such access to the computer's internals. But in this case, you already have to have access to the Yun's internals to enable the access from your device. If you're already there, it seems like it would be much easier to just write a shell script to accomplish what you are trying to do:

CAlberca:
I want to program the rubber ducky to automate some task in Linux environment (e.g. Check Software Updates or whatever) without using a LCD screen like other guys commented above.

That's exactly what shell scripts can do. Rather than write a script to enable the device to send commands to the Yun, and then program the device to send those commands, wouldn't it be a whole lot simpler to just put those commands into the shell script in the first place? Once you have the script written on the Yun, you can execute it manually at any time (through an SSH connection, or even triggered by a sketch.) Or it can run automatically on startup, or add it as a cron task and automatically run it periodically.

If you are doing this as a learning experience, so you can figure out how some of the Linux internals work, then go for it. But if you are doing this so you can automate a series of commands to run periodically, then there are much simpler (and more reliable) ways to do it.

Thanks for the answer ShapeShifter.

You are right, sorry for the error, I wanted to say "command shell" instead of "terminal", In that moment I was a little bit confused about how to explain this problem hahaha

Now with your explication I have things clearer :smiley: I just was trying the rubber ducky in Arduino Yún to see if in this system worked like in Windows, Linux, Mac, Android...

I think the easiest way is to create a python module to execute the input "/dev/input/event1" in the command shell like I think ssh does. If it was to run rubber ducky as simple as in other OS (e.g. Windows), it is worth it, but the real way is not worth it

Thanks to all the community!!!