GET Cheap USB Button for PC / Sudo Null IT News FREE

The idea is to run the script past pressing a physical button connected to the computer.

Button

Options:

  • Arduino nano - 1400 r (orig), 300 r (not orig). (pluses: you can hang very much of buttons happening 1 usb embrasure; minuses: you motive to solder + empathize how it works and you have to keep a program on the computer that will wait for the button to be pressed)
  • USBbutton - 780 r (pluses: everything is beautifully designed and finished; minuses: high price and it is win-solely)
  • U-HID Nano - 1150 r (pluses: there is software; minuses: gamey price + you need to solder)
  • Usb device (almost whatsoever) - 0 - 100 r (pros: almost 0 be, no programming; cons: linux, workable soldering, scathe to usb cable)

I conducted totally experiments on Raspberry PI with debian along plank (more just, raspbmc firmware).
Any statistical distribution that uses udev to pass over system devices is suitable for implementation .

The device on the basis of which the release will be ready-made can be anything: an Old fractional-broken usb keyboard, mouse, camera, and indeed everything that clings to USB and can be recognized by the system.
I found a mouse on the market for 70 rubles, which can serve as a button and is quite a competitory with other options.

Make button

The button operation plot is simple to disgrace,
an important note on the connection diagram: see PS101 at the oddment of the article.

While the button is pressed, the entire circuit is closed, world power is supplied to the device and the system sees that a freshly twist is siamese.
When we press the clitoris, the circuit breaks and the device disappears from the system.
This system of logic is the key in the smooth process of creating a button.

I took apart the old keyboard and got it out of it

integrated circuit


In one and only of the versions of this push button, I used the closure of specific contacts connected the keyboard
to emulate a key press and a program was running in the background that was waiting for this tonality to be ironed.

Checking the functionality of the button:

Shortest udev hypothesis

The udevd process monitors the twist's connection / disconnection and creates a device file in the / dev / directory (for a real figurative explanation, see the links at the end of the article for details lovers).
When conjunctive devices, udevd checks the list of rules in the /etc/udev/rules.d/ directory .
Rules can live as in one file cabinet operating theatre in several.
Create a file and add a rule:

          pi@raspbmc:~$ cat /etc/udev/rules.d/20-usb_button.rules ATTRS{name}=="LITEON Technology USB Multimedia Keyboard", ATTRS{phys}=="usb-bcm2708_usb-1.2/input0", ACTION=="add", Tally+="/bank identification number/sh /dwelling house/pi/usb.sh"                  

in debian there is nobelium need to restart udev aft changing the rules, everything happens mechanically.

This reign only holds when altogether conditions are met:

ATTRS {name} == "LITEON Applied science USB Multimedia system Keyboard" (the name of the connected device is the same)
ATTRS {phys} == "usb-bcm2708_usb-1.2 / input0" (the gimmick is connected to a particular USB port . I pauperization this, because I use 2 buttons made from the same keyboards)
ACTION == "add" (the rule only works when the device is only added, there is also the " remove " parameter . If you do not specify Action, the script will constantly run until connected device)
RUN + = "/ bin / sh /home/pi/usb.sh"(actually our script, which is launched at the click of a clit, did non start without / bin / sh , too get wind PS01 to a lower place) The

list of attributes can be recovered as follows:

          pi@raspbmc:~$ udevadm info -a -p $(udevadm information -q path -n /dev/input/by-path/platform-bcm2708_usb-usb-0\:1.2\:1.0-event-kbd)   looking at gimmick '/devices/platform/bcm2708_usb/usb1/1-1/1-1.2/1-1.2:1.0/stimulant/input107/event0':     KERNEL=="event0"     SUBSYSTEM=="input"     DRIVER==""   looking at parent gimmick '/devices/platform/bcm2708_usb/usb1/1-1/1-1.2/1-1.2:1.0/input/input107':     KERNELS=="input107"     SUBSYSTEMS=="input"     DRIVERS==""     ATTRS{advert}=="LITEON Technology USB Multimedia Keyboard"     ATTRS{phys}=="usb-bcm2708_usb-1.2/input0"     ATTRS{uniq}==""     ATTRS{properties}=="0" ....                  

where /dev/input signal/aside-way/platform-bcm2708_usb-usb-0\:1.2\:1.0-event-kbd - device address the device

address in the organization can comprise found at the time of connecting the device:

          pi@raspbmc:~$ udevadm monitor --env |grep DEVLINKS DEVLINKS=/dev/input/by-id/usb-LITEON_Technology_USB_Multimedia_Keyboard-result-kbd /dev/input signal/by-path/platform-bcm2708_usb-usb-0:1.2:1.0-outcome-kbd                  

for debug I used the rule:

          SUBSYSTEM=="usb", ATTRS{ID_MODEL_ID}=="c312", SYMLINK+="ABC"                  

and checked if the gimmick symlink / dev / ABC was created

Total

That's wholly. We got a button, away clicking which a script is launched in the system.

cost:
old keyboard - 0r
release - 10r
case - 0r

And most importantly, such a button does not require cognition of microcontrollers and special power to solder, it is convenient and accessible to everyone :)

PS00 is about my button pillowcase.


The monkey is on the outflow and if you press out connected the head, the monkey presses the button with its tail, which leads to the closure of the chain

PS01 I came across an exciting hemipteran and could not pick it rising: the script specified in the rule runs 2 times. Can buoy someone tell me?
PS10 The button needs to be kept for about 2 seconds, since it is inevitable to wait for the device to initialize in the
PS11 arrangement . If you make up one's mind to reprize the propose with any changes, I highly recommend at least scrolling done the
PS100 lit list. Python script for working with udev github.com/bockro/misc usb_checker. py
PS101 Important Notice from Blangel

You made a momentaneous-circuit of the +5 V wire in USB, however, Data would be ameliorate to short / open too.
Let's remember the fib - wherefore are the +5 V and GND contacts ready-made in the USB connective extended?
First off, so that the USB gimmick has time to do a software reset and be set to invite and ship data.
Only there is second - old computers (and especially the suspect motherboards of the Pentium 4 time on ICH5) have a harmful USB bus execution, in the end there is a computer freezing or rebooting.
And in that respect are also very cheap buggy Chinese devices with a correspondent burden and the expectation of connecting only through a USB connecter.
So it would Be more optimal to close and open 3 contacts - +5 V and Data ± (moreover, to close the top executive to data). This can be done, for example, with the facilitate of 2 Soviet switches that were put in the floor lamp, only one needs to file a button by 3-5 mm ...
In your display case, you can not do it, only at the least observe this in the article, otherwise I didn't notice anything like that.
References

  • [RU] Superior transformation to opennet about using udev
  • [ENG] The main manual for committal to writing udev rules
  • [ENG] Presentation about udev. Many examples and explanations.
  • [RU] Habr: employment of udev for self-acting mounting of devices
  • valet de chambre udev

Thank you for reading to the end.

DOWNLOAD HERE

GET Cheap USB Button for PC / Sudo Null IT News FREE

Posted by: phillipsolkill.blogspot.com

0 Response to "GET Cheap USB Button for PC / Sudo Null IT News FREE"

Post a Comment

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel