• Stars
    star
    103
  • Rank 331,598 (Top 7 %)
  • Language
    C#
  • License
    Apache License 2.0
  • Created almost 7 years ago
  • Updated over 2 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

This repo explains how to turn your Raspberry Pi Zero into USB Keyboard and Mouse. Also provides sample code and binaries to control them.

What is it?

This repo explains how to turn your Raspberry Pi Zero into USB Keyboard and Mouse. Also provides sample code and binaries to control them.

Steps - Installation

  1. Flash your SD card with NOOBS (download: https://www.raspberrypi.org/downloads/noobs/) or use your installed Raspbian.

  2. Make /share directory on your raspberry pi.

    $ sudo mkdir -m 1777 /share
    
  3. Run /script/deploy_with_pscp.bat on your PC to deploy files to Raspberry PI Zero. (download pscp.exe from https://www.chiark.greenend.org.uk/~sgtatham/putty/latest.html)

    c:\...\script> deploy_with_pscp.bat [your_raspberrypi_ip]
    
    For example, if the address of your raspberry pi is 192.168.0.100
    
    c:\...\script> deploy_with_pscp.bat 192.168.0.100
    
  4. On your raspberry pi, make /share/install_usb.sh and /share/rasp_vusb_server.out runnable.

    $ sudo chmod +x /share/install_usb.sh
    $ sudo chmod +x /share/rasp_vusb_server.out
    
  5. Run install_usb.sh

    $ sudo /share/install_usb.sh
    
  6. That's all, all of the changes will be applied after reboot.

    $ sudo reboot
    
  7. Finally, connect your Raspberry PI zero to your Computer. Go to your "Control panel" / "Device Manager", you can find 3 new devices.

    Human Interface Devices
        * USB Input Device
    
    Keyboards
        * HID Keyboard Device
    
    Mice and other pointing devices
        * HID-compliant mouse  (Absolute position + buttons)
        * HID-compliant mouse  (Relative position + wheel)
    

    You can get the report descriptors at /report_descriptors.txt

How to Test

Now, you can run "InputController.exe (from /bin/v1_0_0_2/InputController.zip)" on your Windows PC. As soon as run, it will find "usb_server" program which is run in Raspberry PI and connect it automatically.

At first, InputController parse input as mouse data. So you can move to specific position as whatever you want but need to calculate for your circumstances. If you move to x = 50, y = 100 and your monitor's resolution is 1920 * 1080, your input has to be like this,

x = 50 * 32767 / 1920 = 853
y = 100 * 32767 / 1080 = 3033

then type it,

853 3033

you can find your mouse position is moved to (50, 100) on windows.

Also, you can move your mouse relatively. For this, type '+' or '-' prefix to number.

+50 -10

And control wheel on the mouse with 'w' prefix to offset value.

w10

It acts as scrolling down, or type "w-50" to scroll up with offset 50.

For testing input as keyboard, change the mode by typing "--mode" command,

--mode

(If you type "--mode" again, it will change to mouse input mode)

Now you can type any text and just hit ENTER,

test is good

then, your PC will accept "test is good" key inputs. Of course, you can send any special inputs of these,

Left Window key: <window>
IME toggle key: <ime>
Enter Key: <return>
Control Down: <ctrl_down>
Control Up: <ctrl_up>
Shift Down: <shift_down>
Shift Up: <shift_up>
Alt Down: <alt_down>
Alt Up: <alt_up>
CapsLock: <capslock>
ESC: <esc>
Backspace: <backspace>
Tab: <tab>
Insert: <insert>
Home: <home>
Page Up: <pageup>
Page Down: <pagedown>
Delete: <del>
End: <end>
Left Arrow key: <left>
Right Arrow key: <right>
Up Arrow key: <up>
Down Arrow Key: <down>
F1 ~ F12: <f1> ~ <f12>

If you type like this,

test is good<backspace>d <shift_down>wow<shift_up>

you will see this text input,

test is good WOW

Steps - Uninstallation

  1. Just run uninstall_usb.sh.
$ sudo /share/uninstall_usb.sh
  1. Reboot.
$ sudo reboot

Change Log

1.0.0.2 - Dec 20, 2017

  • apply ssl socket

1.0.0.1 - Oct 13, 2017

  • Add "--shutdown" command to shutdown raspberry pi.

1.0.0.0 - Oct 12, 2017

  • Initial checked-in

How to build

If you want to modify InputController.exe and rasp_vusb_server.out, just load rasp_usb.sln in Visual Studio 2017, and build it.

It needs connection info to Raspberry Pi for compiling C++ source codes to ARM machine codes.

Requests or Contributing to Repository

Any help and advices for this repo are welcome.

License

Apache License V2.0 (Refer to LICENSE.txt)

More Repositories

1

ffmpeg_autogen_cs

C# port of FFmpeg Examples (https://ffmpeg.org/doxygen/trunk/examples.html)
C#
37
star
2

XingAPI

C#
11
star
3

XmlCodeGenerator

Visual Studio 2012/2013/2015/2017/2019 plugin: Generates source codes with XML + XSLT(includes pre-defined XSLT)
C#
10
star
4

cs10_net6_sample

"์‹œ์ž‘ํ•˜์„ธ์š”! C# 10 ํ”„๋กœ๊ทธ๋ž˜๋ฐ: ๊ธฐ๋ณธ ๋ฌธ๋ฒ•๋ถ€ํ„ฐ ์‹ค์ „ ์˜ˆ์ œ๊นŒ์ง€" ์ฑ…์—์„œ ์‚ฌ์šฉํ•œ ์˜ˆ์ œ์˜ .NET 6 ๋ฒ„์ „์ž…๋‹ˆ๋‹ค.
C#
10
star
5

DotNetSamples

C#
7
star
6

cs10_netfx_sample

"์‹œ์ž‘ํ•˜์„ธ์š”! C# 10 ํ”„๋กœ๊ทธ๋ž˜๋ฐ: ๊ธฐ๋ณธ ๋ฌธ๋ฒ•๋ถ€ํ„ฐ ์‹ค์ „ ์˜ˆ์ œ๊นŒ์ง€" ์ฑ…์—์„œ ์‚ฌ์šฉํ•œ ์˜ˆ์ œ์˜ .NET Framework ๋ฒ„์ „์ž…๋‹ˆ๋‹ค.
C#
6
star
7

DxgiScreenCapture

Screeen Capture Library using SharpDX
C#
5
star
8

mod_aspdotnet

This repo is migrated from mod_aspdotnet to support Apache 2.4
C
4
star
9

NHanNanum

HanNanum for C#
C#
3
star
10

OfficePresenter

PowerPoint controller by Windows Phone and Android
C#
3
star
11

KoreaBusInfo

Provide bus info using https://www.data.go.kr/ Open API
C#
3
star
12

KernelMemoryIO

Legacy kernel device driver for reading and writing kernel memory
C
2
star
13

reg_free_kiwoom_openapi

Sample application which use reg-free Kiwoom Open API+
C#
2
star
14

svg

C#
2
star
15

reg_free_vlc

Sample C# Project using reg-free VLC ActiveX
C#
2
star
16

NoDtarVisualStudioVersionSelector

If you hate "DTAR_08E86330_4835_4B5C_9E5A_61F37AE1A077_DTAR" folder, use this application of association to ".sln" file extension.
C#
2
star
17

AttachToW3WP

Can attach to w3wp.exe before loading of ASP.NET pipeline. It enables Visual Studio to activate breakpoint on initial .NET code like global.asax.cs or whatever.
C#
2
star
18

SampleSrcGen

C#
1
star
19

HanjaHangul

C# Ports of "Hanja Hangul Project v1.01 (ํŒŒ์ด์ฌ) - https://blog.daum.net/masoris20/187"
C#
1
star
20

IniColorizer

Simple INI Syntax Highlighter (Visual Studio 2015 or later)
C#
1
star
21

cs12_sample

"์‹œ์ž‘ํ•˜์„ธ์š”! C# 12 ํ”„๋กœ๊ทธ๋ž˜๋ฐ ๊ธฐ๋ณธ ๋ฌธ๋ฒ•๋ถ€ํ„ฐ ์‹ค์ „ ์˜ˆ์ œ๊นŒ์ง€" ์˜ˆ์ œ ์ฝ”๋“œ
C#
1
star
22

KIS

C#
1
star