Computers Windows Internet

We simulate the keyboard. On the question of evaluating pemin digital signals. keyboards What is scan code

Most modern keyboards are equipped with multimedia keys, and mice already have three to seven buttons. Drivers and all kinds of useful programs Windows only. Everyone knows that Linux is famous for its ability to customize the system for yourself, if, of course, you know where and what to configure. Our task is to teach the penguin to work with additional loaves.

Determining the scan code of the keys

Whatever you press on your keyboard, the X-server and the kernel, in general, do not care what is written or drawn on it. They are only interested in the scan code of the button, and first the X reads the kernel key code table, and then the key code is tied to its own code table. If in Windows problems multimedia keys settings in the console do not exist as such, then in Linux you have to separately configure the response to pressing buttons in the console and in the X-Window.

To find out the key code, you should use the xev utility included with the X server. After its launch, the Event Tester window appears, now we press the keys sequentially, remembering the issued code:

$ xev
...
KeyRelease event, serial 31, synthetic NO, window 0x3e00001,
root 0x67, subw 0x0, time 279734676, (311,611), root: (1104,687),
state 0x2000, keycode 236 (keysym 0x1008ff19, XF86Mail), same_screen YES,

XFilterEvent returns: False
KeyRelease event, serial 31, synthetic NO, window 0x2600001,
root 0x67, subw 0x0, time 265877259, (883,334), root: (886,358),
state 0x0, keycode 161 (keysym 0x0, NoSymbol), same_screen YES,
XLookupString gives 0 bytes:
XFilterEvent returns: False

The output can be overwhelming, as every mouse movement is tracked as you move over the Event Tester window. The key is described by the KeyRelease block, in particular, the keycode value is exactly the scan code that we want to know. In the example shown, two keys were pressed. Keycode 236 corresponds to the keycode for the X server specified in the keysym, as well as the XF86Mail action, which in KDE launches the default mail client. For key number 161, no code or action is defined.

A situation is possible when a key is pressed, but its scan code is not issued. This means that the kernel cannot find a matching value. The dmesg output should contain a line like this:

Use "setkeycodes 0xec "to make it known.

That is, you are offered to set the scan code of the key yourself using setkeycodes, while the keycode value is very easy to select. Convert the resulting digit to a decimal number (most calculators can do this) and add 128. В this example 0xec = 236, that is, we get scan code 364. If in doubt, the list of used and unused scan codes can be viewed by running the getkeycodes or dumpkeys utility in the console. For example, if the output “getkeycodes | grep<код клавиши>"Did not give anything, so this code can be safely used.

The XKeycaps utility (www.jwz.org/xkeycaps), which is a graphical front-end to Xmodmap, can also help determine the scan code.

In the console, the xev program, of course, does not work. To find out the scan code issued by the kernel, use the showkey or getkeycodes utility:

$ showkey
the keyboard was in UNICODE mode
press any key (the program will end 10 seconds after the last press) ...
0xe0 0x6c 0xe0 0xec

The first two digits correspond to the pressed key, the second to the absence of pressing.

Configuring the binding of scan codes in X-Window

So, now we have scancodes, we need to tell the X-server what it actually should do when this key is pressed, that is, assign a symbolic name to it. For a list of symbolic names, see the XF86keysym.h header file. By default, X server headers are not installed on modern distributions. To see it in Ubuntu, you need to install the x11proto-core-dev package, after which this file will be in the / usr / include / X11 directory. Alternatively, you can go to the X.Org CVS server. We look:

$ cat /usr/include/X11/XF86keysym.h
/*
* Keys found on some "Internet" keyboards.
*/
#define XF86XK_Standby 0x1008FF10
#define XF86XK_AudioLowerVolume 0x1008FF11
#define XF86XK_AudioRaiseVolume 0x1008FF13
#define XF86XK_AudioPlay 0x1008FF14
#define XF86XK_AudioStop 0x1008FF15
#define XF86XK_Mail 0x1008FF19

If we compare the last line with the xev output, we see that the values ​​match the key with keycode 236 - keysym 0x1008ff19, XF86Mail (without the XK_ suffix). You can find a list of all available values ​​as they should be used in / usr / share / X11 / XKeysymDB.

You can create your own layout in two ways: create a description of your keyboard or use Xmodmap. The last method is the simplest, so we will talk about it further. In the user's home directory, create an .Xmodmap file, into which we enter the desired values:

$ mcedit ~ /. Xmodmap

keycode 161 XF86Calculator
keycode 174 XF86AudioLowerVolume
keycode 176 XF86AudioRaiseVolume
keycode 162 XF86AudioPause

And so on, the principle, I think, is clear. Moreover, the key code can be entered in both decimal and hexadecimal forms. In my observation, the codes for most of the keys are standardized. Therefore, if you once set up the reaction to a key press and transfer the file to another computer, there is a possibility that on another keyboard the reaction to pressing a signed key will be similar. Gnome desktop users with GDM can write all of these lines in the system-wide / etc / X11 / Xmodmap.

In other cases, we still need to tell the X server to use the generated file. Different distributions implement this in different ways, the main idea is to run the command / usr / bin / xmodmap $ HOME / .Xmodmap when the user logs in or when X starts. Here everyone dances as he wants. The forums suggest using the file $ HOME / .xsession (in some distributions it may be called .Xsession), .xprofile or system / etc / X11 / Xsession. And I'm afraid that this is not all possible options... Let's see how it is done in KUbuntu:

$ sudo grep -iR xmodmap / etc

As a result, we find the most curious file /etc/X11/Xsession.d/80ubuntu-xmodmap with the following content:

$ cat /etc/X11/Xsession.d/80ubuntu-xmodmap

/ usr / bin / xmodmap /usr/share/apps/kxkb/ubuntu.xmodmap || true

USRMODMAP = "$ HOME / .Xmodmap"

if [-x / usr / bin / xmodmap]; then
if [-f "$ USRMODMAP"]; then
/ usr / bin / xmodmap "$ USRMODMAP" || true
fi
fi

That is, the content of the ubuntu.xmodmap file is loaded and the custom.Xmodmap file if it exists. When you open ubuntu.xmodmap in an editor, you will find a list of keycodes and associated symbolic names. From this we can conclude: if the developer reports that his distribution kit supports multimedia keyboards, then with a high degree of probability you can find a similar file. Other distributions have a similar system for running custom xmodmap files.

Now that symbolic names have been assigned to the keys, you can assign them the desired actions. Some windowing environments like KDE can handle symbolic names. So, when you press a button with XF86AudioPlay (QUESTION), the default player starts playing. To set the desired combination, just go to "KDE Control Center -> Regional and Accessibility -> Keyboard Shortcuts" (in KUbuntu look under "System Setting -> Keyboard & Mouse"). Gnome has a similar menu item (you can simply call gnome-keyboard-bindings) and XFce. Plus, some programs like Amarok, Konqueror, MPD can also handle keystrokes. In other environments that do not have
graphical configuration tools will most likely require manual intervention in the configuration files. For example, in IceWM to launch the XMMS player when you press a key with the symbolic name XF86AudioPlay, and when you press it again, it pauses, add the following line to the ~ / .icewm file that appears after the first launch:

$ mcedit ~ / .icewm

key XF86AudioPlay xmms --play-pause

In Fluxbox, the line to start the player will look like this:

$ mcedit ~ / .fluxbox / keys

None XF86AudioPlay: ExecCommand xmms --play-pause

There are usually examples in the configs, so I think you can figure it out with the rest of the window managers yourself.

Configuring the reaction in the console

In the console, the procedure is slightly different. As you may recall, the dmesg output recommended assigning keycodes using the setkeycodes command. But there are differences - there can be no more than 128 key commands in the console, you should select values ​​from 0 to 127:

$ setkeycodes 0xec 118

You can view free values ​​in the file of the current keyboard layout. On Ubuntu and all Debian-based distributions, this is usually /etc/console-setup/boottime.kmap.gz. If, after starting, there are no problems with the keys, enter this line into one of the startup scripts, for example, in /etc/init.d/rc.local.

Now it remains to set the correspondence between the key and the action being performed. There is even more room for creativity here than in X's. In keymaps (5), the keycode mapping procedure is as follows:

(plain | ) keycode keynumber = keysym

# Switch the console one back when pressing a key with code 105
keycode 105 = Decr_Console
# Switch the console one forward when clicking on and a key with code 106
alt keycode 106 = Incr_Console

But you can create your own variants by specifying the command in variables:

keycode 120 = F100
string F100 = "/ sbin / shutdown -h now \ n"

In other words, pressing the 120 key will perform the action specified in the F100 variable; in our case, the computer is turned off. Instead of F100, of course, you can use any other name.

Now, an equally important part is where to write it all down. The documentation and numerous tips suggest using the current console map file (in my case, boottime.kmap.gz). By the way, this is the only layout description file available after installing KUbuntu; to see the rest of the options, install the console-data package. After that, in / usr / share / keymaps / i386 / you can find several subdirectories with files inside. But if you need to switch to a different layout (in Ubuntu and some other distributions, the / etc / default / console-setup or ~ / .console-setup file is used for this purpose), all settings will need to be transferred to another file, which is somewhat
uncomfortable. If you do decide to take this step, use the existing entries as a template, without writing anything in the first position, and do not forget to leave an empty line at the end.

A little about the laptop

Until I came across a laptop, the scan codes of the keys of which could not be determined. Therefore, the settings here are no different from those described above. Although there is one technique that I would like to tell you about. I find hibernation mode very convenient to use, when, after turning on the computer, you find everything in its place. Modern distributions, as a rule, support it, although configuration is, in general, not difficult - just install the hibernate package and override the necessary parameters in the configuration file. The only thing is that every time to switch to this mode, you need to run the script / usr / sbin / hibernate, which is not always convenient. I just want to close the laptop lid, and turn it back on
food, discover everything in its place.

This is very easy to do using the acpid daemon, which is a kind of user interface that allows you to manage any ACPI events accessed through / proc / acpi / event. At the same time, acpid reads a set of configuration files from the / etc / acpi / events / directory. If there is no package with the daemon in the distribution kit, install it from the repository; the latest version can be obtained from phobos.fs.tum.de/acpi. After installation, you need to create two files in the / etc / acpi / events directory: lid and power. The first describes the reaction to closing the lid, the second - to pressing the power button.

$ sudo mcedit / etc / acpi / events / lid

event = button / lid. *
action = / usr / sbin / hibernate

$ sudo mcedit / etc / acpi / events / power

event = button / power. *
action = / sbin / shutdown -h now

These are somewhat simplified versions, in KUbuntu you will find more complex scripts. After that, a restart of the acpid daemon is required:

$ sudo /etc/init.d/acpid restart

Now, when you close the laptop lid, the system will hibernate with the power off, and when you press the power button, it will turn off. Simple and convenient.

Configuration programs

If you don't like fiddling with configuration files, here are a few programs to help you customize how your multimedia keys work. For example, the original purpose of the Sven program (sven.linux.kiev.ua) is to configure additional keys on a multimedia keyboard, but since version 0.4 it can correct typing errors and change the keyboard layout. Moreover, even if you have a regular keyboard, you can use it to emulate multimedia keys by using keyboard shortcuts instead. You can also assign actions to specific mouse buttons. She understands approximately 10,000 Russian words and 9,500 English words. If the program did not switch
itself, the layout can be changed manually, using a specially assigned key (Break by default). With a separate key (Scroll Lock), you can change the case of words (upper, lower, the first letter - upper, the rest - lower). The keyboard layout switch indicator remembers its state for each window, therefore, often switching between applications, you will no longer need to additionally change the layout. The program has great possibilities, and I would advise you to take a look at it. All settings are made using graphics program built on GTK + libraries. Sven has been tested on Linux, but in principle should work on * BSD systems as well. The window manager used
does not matter.

KeyTouch (keytouch.sf.net) capabilities are somewhat more modest, this utility is used exclusively for configuring multimedia keys. Although, with its help, any key can be assigned an action that differs from the default settings. On the program's website, in addition to the sources and packages for some distributions, you can find ready-made settings for multimedia keyboards from most well-known manufacturers.

Another interesting solution - xbindkeys (hocwp.free.fr/xbindkeys/xbindkeys.html) - allows you to assign any command to any keyboard and mouse button, including shell commands. All settings are made in the configuration file, which has a simple and understandable format.

The book contains and summarizes tips for solving various problems, which sooner or later arise in the operation of both economical netbooks and modern desktop models. All of the recipes given are field-tested and categorized by topic: hardware personal computers, computer networks and Internet connection, installing, configuring and repairing Windows OS, surfing the Internet, protecting against viruses. Considered not only ready-made solutions to sudden problems, but also answers to many questions that arise even before buying a computer. The required minimum is given technical data allowing you to make an informed decision.

The CD is included only with the printed edition of the book.

Book:

Sections on this page:

There are many keys on the keyboard that you never use. One of the most annoying is the key , preserved from the days of programming languages ​​such as Fortran, where everything was written in capital letters. Few people use systemic Windows keys(both main and for calling context menu) - it is more convenient to do it with the mouse. Meanwhile accidental press these keys slows down all work. Those who are annoyed can disable them or reassign them to other functions - for example, to adjacent keys.

Let's consider these actions by examples, and then we'll tell you how this is done in the general case - for any key.

First, you need to create a new binary parameter in the HKEY_LOCAL_MACHINESYSTEMCurrentControlSet ControlKeyboard Layout registry key (not to be confused with Keyboard Layouts!)

00 00 00 00 00 00 00 00

03 00 00 00 00 00 5C E0

00 00 5D E0 00 00 00 00

This line will disable the Windows checkbox key and the adjacent popup menu key. Let's figure out what is written here.

First, there should be 8 pairs of zeros in a row. Then comes a number (with a leading zero) - in this case 03, which means the number of keys to track plus one (that is, in this example, we are tracking two keys). It should always be followed by three pairs of zeros (complementing up to 4 pairs of numbers). The record must always end with four pairs of zeros. But between them, we must write as many fours of paired numbers as we have provided for tracking keys - in this case, two. They contain the so-called scan-codes of the keys that we want to disable. Table 12.2 shows the codes of those keys that are advisable to be considered in terms of candidates for disconnection or replacement (see below).

These codes are written in the last two pairs of every four pairs of numbers, the first two pairs are again zeros - as you can see in the sample. So the example line will disable our right key (with Windows flag) (00 00 5C E0) and adjacent key Calls up the pop-up menu (00 00 5D E0).

Table 12.2. Key scan codes


What are scan codes and where to get them

The scan code is the number that the keyboard gives out when you press a certain key. Scan codes should not be confused with virtual key codes - the latter are formed already at the BIOS and Windows level and later determine the character codes, the very ones that, for example, form the content text documents... In most cases, they are not related in any way. For example, the virtual code of the "space" key is 32 (the same as the code of the "space" character in single-byte encodings), and its scan code is 57 (in the HEX form it will be 20 and 39, respectively). Note that virtual codes are not equivalent to symbolic ones - in order to turn a virtual code into a character code, you also need to take into account the language layout, the state of the keys , and, by the way, the encoding system used is single-byte or Unicode. All this is done by the system keyboard driver even before the press event hits the Windows message queue. Some keys ( or ) are not associated with any characters at all and do not end up in the specified queue. Therefore, to completely replace the functionality of a certain key, to replace virtual codes (which in fact can be done by anyone with programming skills in Delphi or Visual C ++) is not enough - you need to act at a deeper level, manipulating the scan codes. This is what enables the Scancode Map parameter in the Windows registry.

For our purposes, scan codes, as you can guess from the table below, should be presented in hexadecimal (HEX), not decimal form. Tables of virtual codes and character codes are usually attached to any Windows programming tutorial, but a complete table of scan codes is not easy to find. One of these tables is located on the site " Digital library"At the link http://ntlib.chat.ru/ware/tables/scan.htm. It is a little unsuccessfully composed - the so-called extended keys (these are those with the second byte in our table equal to E0) are shown there by adding an extra digit equal to 1. That is, by selecting the scan code from the HEX column, for example, 11C (key on numeric keypad), it must be rewritten for our purposes as 1C E0. The official full set of scancodes, including the power keys (but excluding additional media keys), can be downloaded from the Microsoft website. The link to the document is very long, so just type the words "Keyboard Scan Code Specification" in the search on microsoft.com, and you will get what you are looking for - albeit in English. As you study this document, please note that we are only interested in one set of codes: Scan Code Set 1.

Of course, such a string of numbers should be prepared in advance and all pairs should be carefully recounted before entering it into the register. But as you type, you will see that it will help you not to make mistakes. Entering a value binary number is done manually (Fig. 12.11), but despite the unusual appearance of this editor, you will quickly see that it is very convenient to work with it. In particular, there are no problems when counting the entered pairs - they are automatically grouped at eight per line. Do not forget to restart the PC after the final input of the parameter values.


Rice. 12.11. Entering Binary Parameter Values

For not just cancellation, but also reassignment, you will have to complicate the recording a little - the first two pairs of zeros in those fours that contain the codes of the keys to be disabled should be replaced with those codes that, in your opinion, should work. For example, a Scancode Map value of

00 00 00 00 00 00 00 00

03 00 00 00 00 00 5C E0

1D E0 5D E0 00 00 00 00

will make it so that right key with the checkbox Windows will turn off and Will duplicate the right , that is, the closest key to it. It is this Scancode Map value that is shown as an example in Fig. 12.11.

Let's show you how to deal with ... Experiments show that not everything is unambiguous with it - in particular, an attempt at a simple shutdown may not yield results. But I will give the value of the Scancode Map parameter, which is guaranteed to disable - its function changes to function (right, but in practice it doesn't matter), and Here, as before, duplicates the right :

00 00 00 00 00 00 00 00

03 00 00 00 1D E0 5D E0

2A 00 3A 00 00 00 00 00

The key.reg file is located on the supplied disk in the Registry folder, when you run it and confirm that you really want to make changes to the registry, a Scancode Map parameter with this value will be automatically created. If you don't want to touch anything but , then edit this value as follows: replace 03 with 02 and replace the four non-zero bytes in the second line with zeros.

Nothing fatal should happen as a result of these experiments of yours - if you make a mistake or decide to leave everything as it is, just delete the Scancode Map parameter from the registry and restart your computer. Or return the system to its original state using restore points.

Disable key as entering the menu

Unfortunately, handle the key as a system one for Windows (calling the main menu), while retaining its functionality as a modifier key, it will not work through the registry - it will stop responding to pressing altogether. Therefore, since we are dealing with the keys, at the same time I will indicate the means to cope with it, although it has nothing to do with the registry. The book contains the AltSpy folder on the disk, which contains the program of the same name. Copy the entire folder (it contains three files) to your hard drive and run the js file (Java Script). In order not to start it by hand every time, it should be included in the startup (see section 10.1.3 “Startup”). 10 seconds after starting the script, AltSpy will create a brown-eyed icon in the notification area, which will have the only context menu item - Close. The pause is needed so that AltSpy is guaranteed to be the last one on startup and to override other services. After that will stop calling the main menu, but will retain its basic functionality. At the same time, the ability to call the main menu does not disappear - this function is still performed by the key , but now it is much more difficult to call it accidentally and thereby knock the input focus off the desired element.

Most likely on your phone already installed by default QR code scanner, you can easily scan the first QR code with it. This is very easy to do. Just follow our instructions.

1. Open the QR code reader on your phone.

2. Hold the device over the QR code so that it is clearly visible on the screen of your smartphone.

If you hold your smartphone correctly over the QR code, then the following will happen:

  • The phone scans the code automatically.
  • In some code scanning apps, you have to click on an image, not a button as you would to create a photo on your smartphone.

3. Press the indicated button, if required.

Super! Your smartphone reads the code and follows the specified link, which does not always happen instantly. On most devices, this may take a few seconds.

You will start to see QR codes all over the place. They are used for teaching, informing, explaining, and many other things. Find them and scan them! QR codes will save you a lot of time and effort.

How to scan QR codes on Android

Now we are going to show you how to use the QR code scanning app on Android.

Briefly:
1. Open Play Store .
2. Search QR code reader .
3. Select QR Code Reader(via Scan).
4. Click " Install".
5. Open the program QR code reading.
7. Point the camera at the QR code.
8. Click " OK".

Step 1... Open the Play Store on Android. It's an icon in the app or on the home screen.

Step 2. Enter the QR code reader in the search engine. A list of QR code reader apps will appear.

  • This article explains how to use QR Code Reader, but you can choose which app you like. Just be sure to read about the app before downloading.
  • The steps should be the same for all QR code reader apps.

Step 3.Click QR Code Reader developed by Scan. The developer's name is listed below each app. You may have to scroll down the page to find the app made by Scan.

Step 4.Click Install. A popup will appear asking for permission to access information on your Android.

Step 5.Click “Accept”. QR Code Reader will now be installed on your Android device.

    • When the application is downloaded, the "Install" button will change to "Open" and you will have a new icon in the application.

Step 6.Open QR Code Reader. It's an icon that looks like a QR code in the app. An application will open that looks like a standard camera screen.

Step 7.Align the QR code in the camera frame. A bit similar to how you take photos, except that you don't have to press any buttons. When the barcode scanner reads the code, a popup will appear with the URL in the code.


Step 8.Click OK to open the website. This launches your default web browser and navigates to the URL in the QR code.

The next typical PC device, seemingly uncomplicated, but sometimes troublesome for the researcher, is the keyboard.

In general, the device is simple. Especially not the outdated models that are connected to the PS / 2 port. As shown by numerous experimental data, the "keyboard" control microcircuit scans the keystrokes and transmits them in the serial code to the port. The clock frequency of this transmission is a multiple (in the overwhelming majority of cases) »6.3 or 10 kHz. Although the author came across in the very last years a couple of copies, the clock frequency of which was in the region of 20 kHz.

When you press and hold any key, all keyboards begin (after a pause) to repeat the transmission of the key code "ad infinitum". In normal mode, this will typically result in a controller buffer overflow and malfunction after a few seconds. There is a sound signal of the system "speaker" - "squeak". The essence of the test mode (the most common one) is to block the buffer overflow command, which allows, when the key is pressed, to ensure an endless transmission of the selected character over the "keyboard" cable.

As always, for the correct subsequent calculation of the result, it is necessary to create a constant alternation of pulses in the code packet. There can be two such combinations for keyboard codes:

10101010 (55) key "+; = "

01010101 (AA) in type tables - not applicable

The general table of scan codes is given in table 14.1

Table 14.1- Keyboard scan codes

Key

Scan code

Key

Scan code

Key

Scan code

Key

Scan code

Thus, during the implementation of the test mode and, for example, a weight placed on the "+" key in the "keyboard" cable there will be an infinite sequence of pulse packets. In this case, the pulse repetition rate in the packet (that is, the clock frequency) will be 6.10 or 20 kHz, and the packet repetition rate will be much lower. The data format is shown in figure 14.1.

Two lines are used for data exchange in the keyboard cable - KBData and KBSync. When transmitting scan codes, the keyboard sets the next bit of data on the KBData line and confirms the transfer by transferring from "1" to "0" the signal on the KBSync line.

The controller can signal its unavailability to transmit / receive data at a low level on the KBSync line. The rest of the time, when there is no data to transmit, both lines have a high signal level.



As follows from the above, in the PEMIN spectrum of the keyboard cable, one should expect frequency components with a clock frequency of 1 / 76.04 · 10 -6 = 13.15 kHz. Moreover, due to the presence of two phase-shifted signals with different (but multiple!) Periods, the even and odd frequency components will differ in amplitude.

As you might expect, PEMIN of the sync data line is not informative in principle. But distinguishing one PEMIN from another is not easy at all. One cable, signals are synchronous ...

Almost the only way is to select a scan code with a minimum number of logical "1" in the package. These are the keys "F3" and F9 "(03 and 01 in hex code). Code "00" is not used.

The oscillogram of the scan code "F3" is shown below.


Strictly "in terms of energy", if you measure all the frequency components of the PEMIN with the code "=" and, for example, the code "F9", then the difference in the readings of the receiver on EACH of the frequency components is the truly informational part of the PEMIN energy. Moreover, this is the maximum maximum. The work is quite difficult and tedious if there is no way to entrust it to an “automaton”. The very components of PEMIN for such low frequencies can be detected not without difficulty. So also the differences "catch" ...



In SI practice, in the overwhelming majority of cases, they simply measure the PEMIN levels (without subtracting anything) and calculate the security parameter. It is possible and so, "with a margin", but the specialist is obliged to know the true state of affairs.

At the end of the review - the "pinout" of the AT- and PS / 2-keyboard connectors.


The "pictures" on the receiver do not look so "classic", however, it is quite recognizable. Here are some examples



The spectrum clearly shows an increase in the amplitude of the components with decreasing frequency.

There are also features of measurements of the "keyboard" in this frequency range (from tens of kHz and beyond). The fact is that the keyboard, in its usual location, is located not far from the system unit. And in the upper part of the SB there is a pulsed power supply unit - the most powerful source of PEMIN for both "E" and "H" components. In the "light" of such a theatrical spotlight, the dull "light" of the keyboard to behold is a special art! Therefore, I propose the following technique. Move the "claudia" away from the SB as far as possible. Better - on a PS / 2 extension cord. A kind of 2-2.5 meters.

Place the antenna so that it is guided by as little as possible from the SB (signal, with a receiver bandwidth of more than 10 kHz - a continuous spectrum). And now, near the so-oriented, fixed antenna, start twisting the "keyboard" and its cable (not vice versa!). Then you will have much more chances to detect the PEMIN signals of the keyboard, to see the PEMIN components on the analyzer screen with your own eyes.

All of the above applies to a PS / 2 keyboard. But now they are being massively replaced by USB keyboards.

In general, this interface has been considered in some detail in conjunction with printers. However, it will not be superfluous to give some "target designation" with respect to the keyboard.

Let's recall the construction of packages for the USB interface, given that the keyboard is connected strictly with low-speed (that is, in fact, over the USB 1.0 interface).

The maximum DATA payload size for low-speed devices is 8 bytes. That is, this is exactly what the keyboard scan code requires.

Seeing the signal (specifically the data) on the USB line was not an easy task. Nevertheless, this is what was revealed in the cable of a typical USB "keyboard" of the GENIUS KB-06XE model, specifically in the "data +" line (wire) (Figure 14.10)


These two oscillograms change each other with an unspecified (chaotic) periodicity, and the "pictures" of the signals do not depend on the pressed key of the keyboard (or none). No other changes in the "variable" part of the package (frame) could be detected.

The repetition rate of these packets is rigidly stabilized (Fig. 14.11), and the duration of each is (seen on the oscillograms) about 34 ± 1 μs.


Packets follow every 4ms. However, it should be noted that the end of each packet “jitters” all the time, and noticeably, the classic “jitter”. Therefore, the spectral picture is somewhat blurred and becomes clear only with a sufficiently long averaging.


In addition, it should be taken into account that, due to the different pulse repetition periods and their different durations, the spectrum has the character of a certain mixture of the continuous and line spectra. Nevertheless, the lobe nature of the spectrum, which is natural for an infinite sequence of packets and is multiple in its “lobes” of the average packet duration, is very clearly preserved. Only the “zeros” of the function are smoothed by jitter and the non-temporal repetition period of individual pulses. However, the picture itself is quite typical. At a finer frequency resolution, the spectrum begins to be resolved on the "lines", due to the packet repetition rate (250 Hz) (Fig. 14.13) Thus, with the simplest and unsynchronized with the true transmission of the scan code, viewing oscillograms, identify and visualize sections of the frame (packet) in charge of data transfer failed. Nevertheless, it can be argued that the PEMIN of the keyboard cable will still be like this and no other. It is clear at what frequencies to look for it, it is clear that it will be solid (in any case, with a frequency resolution of the receiver over 0.3 kHz). And it is clear what value to substitute in calculations as a clock (the minimum pulse period in a packet in the experiment was 1.322 μs). To measure this, for any SI, having an oscilloscope, at least with a 200 MHz bandwidth, is a trivial task. The test mode, in fact, is any, you can press the keys (any), you can not press anything. Packets are transmitted over the interface anyway. And, as a first approximation, we consider them informative (until proven otherwise).

The presented oscillograms and spectra were obtained using an AKIP-4108/2 oscilloscope connected to the same computer on which the measurements were performed (it should be noted - a very functional repetition of the development of PICO Technology by ours. Not worse than the Chinese :)).

The spectrum obviously goes far beyond 1 MHz (the oscilloscope no longer allowed it, and there was no point in connecting the analyzer). The rest is due to the cable as a random antenna and the degree of its shielding.

For other modes of the USB interface, an oscilloscope with a bandwidth of many GHz is needed.

How exactly to consider the continuous spectrum and, at the same time, stay within the framework of the current NMI is a separate conversation and not for open discussion, alas ... However, in subsequent publications you will have to return to it, there is nowhere to go. I will try to "stay within the limits of what is permitted" ...

  1. There is a search bar at the top of the Google Play window. This is what we will use. We activate and write the name of our application. It is not necessary to enter it all the way. As soon as the object indicated in the screenshot appears in the search results, just tap on it.
  1. We will be redirected to the home page of the program. There is a large green button that says INSTALL. Click it.
  1. We are waiting for the end of the download of the application. Since it "weighs" a little less than 5 MB, the process does not take much time.
  1. Ready. After the automatic installation is over, we can run the program right from here.
  1. Also, a launch shortcut will appear on the home screen (if activated in the settings).

This completes the installation of the program, and we can proceed to an overview of working with it.

In the screenshot below, you can see the programming interface. Here it is divided into 3 main tabs. There is also a settings icon made in the form of a gear. On the main tab "SCAN" there are 4 main tools:

  • Scan Barcode. This is the QR scanner that works through the camera;
  • Manual Key-in. Function of manual data entry about the code;
  • Decode from File. Decoding from a file. From here you can open the previously downloaded QR code and read it;
  • Decode from Url. Scanning by link.

At the bottom there are several buttons that do not carry useful functionality. You should not pay attention to them.

Let's consider the program settings. There are quite a few of them here. Your screens will have screenshots of different configuration areas, but we will just voice some of the most interesting points.

For example, on the first screen, you can enable or disable the sound of the program. The same can be done with vibration feedback. You can set the operating mode when the program starts running directly from the scanner, bypassing the main menu. Another important feature is the automatic copying of data to the clipboard.

As soon as we want to start scanning and launch the scanner itself, the program will request access to the necessary system resources. Naturally, it needs to be resolved. Click the button marked in the screenshot.

Next, we aim the frame of the scanner so that the horizontal strip falls directly on the QR. Try to keep your hands from shaking while staying focused. Scanning will fail without normal sharpness.

There is a backlight for QR BARCODE SCANNER operation in low light conditions.

Once the code is recognized, you will see the information shown in the screenshot below.

In addition to scanning QR, you can also create them here. To do this, go to the third tab. We marked it in the screenshot. All data types that can be encrypted are listed as a list. The following is supported:

  • phone book contact;
  • phone number;
  • Url;
  • Email;
  • application;
  • location;
  • any text;
  • bookmark;
  • calendar event.

It all looks like this:

When the data type is selected and set, we just have to click the "Encode" button. In this case, we have encrypted the link.

Let's try to encrypt arbitrary text as well. To do this, select the desired item.

Enter the phrase in the designated field and press the "Encode" button.

The result looks great. Let's change its color a little more. We press the button intended for this.

Choose the desired shade from the palette.

And admire the received QR.

Let's move on to the next program, which also has impressive functionality.

QR Droid Code Scanner

Another application that can be found on Google Play. You can also download it via a direct link on the Google website. For now, we will consider the program itself.

This is how the QR Droid Code Scanner launch shortcut looks like - click on it.

This application, unlike the previous one, is made in Russian and, as soon as it starts, we need to click on the button with the inscription: "STARTING WORK."

The scanner is immediately visible, but first, let's take a look at its settings. We tap on the button located in the upper right corner.

In the main menu, you can see 6 tiles-buttons that redirect the user to the desired section. Here they are:

So, in order to use the scanner, you need to activate it in the main menu and, hovering over the QR code, press the "Read" button.

Here the start screen is selected, the address for Reserve copy and the language of the software interface is configured.

Next, we can set up the scanning engine. One of the proprietary algorithms is used: Zapper or ZXing. Below you will be able to enable or disable the crosshair, set up an automatic action after scanning, and enable displaying hints or copying a link to the clipboard.

In this section, you can configure the soundtrack, turn on and off the vibration. The process of recording actions in the log and interaction with smart watch Android Wear.

Then we will be able to export or import backup or set the date.

Allow the sending of anonymous data (it is better to disable it), enable verification of the security link received during the scan, or configure batch scanning. Functions such as zoom or highlight are available below.

But this is not the end of our settings. In addition to the above functions, we have the following:

  • setting screen orientation;
  • work with a front camera;
  • parsing links;
  • show of shops.
  • extended slip function;
  • prohibition of some special characters;
  • activation of WEB preview;
  • search for saved images.

The last settings screen contains such interesting features as: setting the maximum number of positions, configuring custom CSVs, shaking the smartwatch and saving duplicate positions.

In addition to the settings in the QR Droid Code Scanner menu, there is an item called "More". Let's consider its functionality.

There are such possibilities:

Consider the last, but no less functional, application on our list.

NeoReader QR & Barcode Scanner

This program, like others, you can download and install via Google play or by direct link. When this is done, you can go directly to work with her.

On the first launch, we will need to satisfy the access request. Click "ALLOW".

Then a window with settings will appear. Here you will be able to choose a language, indicate your country, gender and age. The two checkboxes below allow you to enable or disable the program's access to geodata.

You can actually start scanning. Point the camera at the QR code and NeoReader QR & Barcode Scanner will automatically recognize its contents.

We think that these three programs will be enough for any person. Choose the most convenient for you and use at your discretion. We're going to talk about some of the features of Chinese devices.

Standard functionality

Some smartphones and tablets (depending on the brand) have the functionality of scanning QR codes as standard, and everything can be done without an application. We will not list them all, we will only touch on the model from Xiaomi.

Summing up

As a result, we learned how to scan a QR code on Android different ways... We hope this article was useful to you. If you still have questions, ask them in the comments. We will try to help everyone.

Even if this does not happen, some of the users on the site will definitely tell you how to get out of the situation and give good advice. You just have to bring it to life.

Video instruction