Eco Button: Difference between revisions

From NURDspace
(Created page with "{{Project |Name=Eco Button |Skills=Linux, |Status=Dormant |Niche=Software |Purpose=Instrument |Tool=No |Location=unknown |Cost=free }} ==Eco button as mpd skip button== We ha...")
 
mNo edit summary
 
(5 intermediate revisions by the same user not shown)
Line 5: Line 5:
|Niche=Software
|Niche=Software
|Purpose=Instrument
|Purpose=Instrument
|Picture=Usb-eco-button.jpg
|Tool=No
|Tool=No
|Location=unknown
|Location=In a box in zaal2
|Cost=free
|Cost=free
}}
}}
Line 13: Line 14:


Button gets recognized as shown in dmesg:
Button gets recognized as shown in dmesg:
<pre>[ 1856.485618] hid-generic 0003:0C50:1010.0003: hiddev0,hidraw0:  
[ 1856.485618] hid-generic 0003:0C50:1010.0003: hiddev0,hidraw0:  
USB HID v1.10 Device [One small click One big change One small click One big change]  
USB HID v1.10 Device [One small click One big change One small click One big change]  
on usb-0000:00:1d.1-2/input0</pre>
on usb-0000:00:1d.1-2/input0
After reading [http://www.greygreen.org/blog/code/python/ecobutton-linux] I was hoping this would be easy, but it seems this particular button does not generate keypresses in X.
After reading [http://www.greygreen.org/blog/code/python/ecobutton-linux] I was hoping this would be easy, but it seems this particular button does not generate keypresses in X.


So over to [https://github.com/s-leroux/hid_mapper], and more info on [https://forum.kodi.tv/showthread.php?tid=88560]. Got an error similar to [https://github.com/Claudio-Sjo/HID_linux_xbmc_driver/issues/1]. After editing hid.c it compiles.
So over to [https://github.com/s-leroux/hid_mapper], and more info on [https://forum.kodi.tv/showthread.php?tid=88560]. Got an error similar to [https://github.com/Claudio-Sjo/HID_linux_xbmc_driver/issues/1]. After editing hid.c it compiles.


And it does stuff too \o/:
And it does stuff too \o/. This command:


<pre>
sudo ./hid_mapper --learn --manufacturer 'One small click One big change' \
dell@zeekoe:~/nizzle/hid_mapper$ sudo ./hid_mapper --learn --manufacturer 'One small click One big change' --product 'One small click One big change' --map
--product 'One small click One big change' --map
Found HID device
Outputs:
Opened HID interface on /dev/hidraw0
Found HID device
02 19 01 8f 92 11 00 a8  
Opened HID interface on /dev/hidraw0
02 80 24 08 36 20 08 88  
02 19 01 8f 92 11 00 a8  
02 19 01 8f 92 11 00 a8  
02 80 24 08 36 20 08 88  
02 80 24 08 36 20 08 88  
02 19 01 8f 92 11 00 a8  
02 19 01 8f 92 11 00 a8  
02 80 24 08 36 20 08 88  
02 80 24 08 36 20 08 88  
02 19 01 8f 92 11 00 a8  
02 19 01 8f 92 11 00 a8  
02 80 24 08 36 20 08 88  
02 80 24 08 36 20 08 88  
02 19 01 8f 92 11 00 a8  
02 19 01 8f 92 11 00 a8  
02 80 24 08 36 20 08 88  
02 80 24 08 36 20 08 88  
02 19 01 8f 92 11 00 a8  
02 19 01 8f 92 11 00 a8  
02 80 24 08 36 20 08 88  
02 80 24 08 36 20 08 88  
02 19 01 8f 92 11 00 a8  
02 19 01 8f 92 11 00 a8  
02 80 24 08 36 20 08 88  
02 80 24 08 36 20 08 88  
02 19 01 8f 92 11 00 a8  
02 19 01 8f 92 11 00 a8  
02 80 24 08 36 20 08 88  
02 80 24 08 36 20 08 88  
02 19 01 8f 92 11 00 a8  
02 19 01 8f 92 11 00 a8  
02 80 24 08 36 20 08 88  
02 80 24 08 36 20 08 88  
02 19 01 8f 92 11 00 a8  
02 19 01 8f 92 11 00 a8
02 80 24 08 36 20 08 88  
</pre>
02 19 01 8f 92 11 00 a8


So it seems that after the button is pressed, a sequence of two events is repeated X times (seems to depend on how long button is pressed).
So it seems that after the button is pressed, a sequence of two events is repeated X times (seems to depend on how long button is pressed).
I'm having trouble feeding it the correct map file. With a map file like this:
I'm having trouble feeding it the correct map file. With a map file like this:


<pre>
0219018f921100a80280240836200888:KEY_UP
0219018f921100a80280240836200888:KEY_UP
 
</pre>
or this:
or this:


<pre>
0219018f921100a8:KEY_DOWN
0219018f921100a8:KEY_DOWN
0280240836200888:KEY_UP
0280240836200888:KEY_UP
</pre>


it spits out this error:
This command:
<pre>
sudo ./hid_mapper --manufacturer 'One small click One big change' \
dell@zeekoe:~/nizzle/hid_mapper$ sudo ./hid_mapper --manufacturer 'One small click One big change' --product 'One small click One big change' --map 'eco.map'  
--product 'One small click One big change' --map 'eco.map'
Loading eco.map
spits out this error:
Loading eco.map
Error loading map file eco.map
[ MapReader ] Unknown key name at line 1


Error loading map file eco.map
So where to go from here?
[ MapReader ] Unknown key name at line 1
Maybe ask author of hid_mapper?
</pre>
Or try and write something using https://github.com/signal11/hidapi

Latest revision as of 23:03, 27 December 2018

Eco Button
Usb-eco-button.jpg
Participants Dennis
Skills Linux
Status Dormant
Niche Software
Purpose Instrument
Tool No
Location In a box in zaal2
Cost free
Tool category

Eco Button

Usb-eco-button.jpg {{#if:No | [[Tool Owner::{{{ProjectParticipants}}} | }} {{#if:No | [[Tool Cost::free | }}

Eco button as mpd skip button

We have this cute usb Eco Button lying around, which is meant to put your computer in sleep mode in order to save energy. It would be nice if we could use it as an mpd next button.

Button gets recognized as shown in dmesg:

[ 1856.485618] hid-generic 0003:0C50:1010.0003: hiddev0,hidraw0: 
USB HID v1.10 Device [One small click One big change One small click One big change] 
on usb-0000:00:1d.1-2/input0

After reading [1] I was hoping this would be easy, but it seems this particular button does not generate keypresses in X.

So over to [2], and more info on [3]. Got an error similar to [4]. After editing hid.c it compiles.

And it does stuff too \o/. This command:

sudo ./hid_mapper --learn --manufacturer 'One small click One big change' \
--product 'One small click One big change' --map

Outputs:

Found HID device
Opened HID interface on /dev/hidraw0
02 19 01 8f 92 11 00 a8 
02 80 24 08 36 20 08 88 
02 19 01 8f 92 11 00 a8 
02 80 24 08 36 20 08 88 
02 19 01 8f 92 11 00 a8 
02 80 24 08 36 20 08 88 
02 19 01 8f 92 11 00 a8 
02 80 24 08 36 20 08 88 
02 19 01 8f 92 11 00 a8 
02 80 24 08 36 20 08 88 
02 19 01 8f 92 11 00 a8 
02 80 24 08 36 20 08 88 
02 19 01 8f 92 11 00 a8 
02 80 24 08 36 20 08 88 
02 19 01 8f 92 11 00 a8 
02 80 24 08 36 20 08 88 
02 19 01 8f 92 11 00 a8 
02 80 24 08 36 20 08 88 
02 19 01 8f 92 11 00 a8

So it seems that after the button is pressed, a sequence of two events is repeated X times (seems to depend on how long button is pressed). I'm having trouble feeding it the correct map file. With a map file like this:

0219018f921100a80280240836200888:KEY_UP

or this:

0219018f921100a8:KEY_DOWN
0280240836200888:KEY_UP

This command:

sudo ./hid_mapper --manufacturer 'One small click One big change' \
--product 'One small click One big change' --map 'eco.map'

spits out this error:

Loading eco.map

Error loading map file eco.map
[ MapReader ] Unknown key name at line 1

So where to go from here? Maybe ask author of hid_mapper? Or try and write something using https://github.com/signal11/hidapi