mcrblg-header-image

search

Enable Wake Up by Keyboard/Mouse on Arch Linux

Published on 2016-10-12 in Linux

The power button on my pc case is not very handy to work with, which made waking up by mouse/keyboard an awesome idea. The first thing to achieve this is obviously, getting inside bios and enable the wake up option for keyboard/mouse, LAN or whatever you like. You probably at this step expect that things get to work out of the box.

Well…. probably no. but still you got chance. from my experience some device works out of the box and some simply don’t. why? I think because they are a little too complicated for ACPI to handle them. Here I summarize my workaround to get these kind of devices work.

Step 1: Find device path

First of all you need to find device path. Device path is both the way that the device is connected to your computer and also the way you can access your device settings on your computer. To get this path, all you need is to find your keyboard/mouse node on /dev path and feed it to udevadm. As an example for my keyboard executing something like

udevadm info -q path -n /dev/input/event0
/devices/pci0000:00/0000:00:14.0/usb1/1-5/1-5:1.0/0003:04F2:0833.0001/input/input2/event0

give this path and for mouse executing

udevadm info -q path -n /dev/input/mouse0
/devices/pci0000:00/0000:00:14.0/usb1/1-13/1-13:1.0/0003:1BCF:0002.0003/input/input4/mouse0

Step 2: Find your lucky wakeup file

Next you need to surf on your device path and find a file named wakeup. it may be in your device path/power. if not look it parent directory and foreword until you find the right file. For example in my case, wakeup file turned out to be /sys/devices/pci0000:00/0000:00:14.0/usb1/1-13/power/wakeup. Then you should write enabled inside this file by running

sudo sh -c "echo enabled > '/sys/devices/pci0000:00/0000:00:14.0/usb1/1-13/power/wakeup'"

If you are standing on a right place then probably double clicking cause your pc to wake up after suspension. if not try to looking the parent folder.

Step 3: Make The Process into Auto mode

As you know udev let you run script if specific device connected to the kernel, we exploit the idea and enable wakeup for our little cute mice.

/etc/udev/rules.d/90-keyboardwakeup.rules
-----------------------
SUBSYSTEM=="usb", ATTRS{idVendor}=="1b1c", ATTRS{idProduct}=="1b19" RUN+="/bin/sh -c 'echo enabled > /sys$env{DEVPATH}/../power/wakeup;'"

Hope You Enjoy


How to Program Cortex M under GNU/Linux Arch

Published on 2016-04-14 in ARM, Linux

You may serach out all sites but there isn’t any adequate context in this subject. ARM family is a new platform that it’s compiler and other toolchains also matured recently so unfortunately there isn’t much quick start guide available out there. Here, I try to fill this gap and give you a hint about how to begin developing your fresh ARM-based board under GNU/Linux. Throughout this tutorial I work out with STM32F4 Discovery development board and Arch Linux distribution. If your board or your distribution is different don’t worry, with a little efforts all steps can be applied into your case.

Required tools:

sudo pacman -S arm-non-eabi-gcc

After installing toolchains you need to download CMSIS library for your microcontroller. CMSIS is a vendor based library, written to interface CPU and peripherals control register in a delicate manner. In our case, ST Microelectronic CMSIS library known as STMCube F4, can be downloaded from STMicroelectronics webpage.

Each stm32 device carry out with a two user manual so-called Programming Manual and Reference Manual. Reference Manual address to each peripheral registers and unit description. On the other hand Programming Manual show how to employ interrupt and hook up booting process. Both these manuals are essential in programming ARM microcontroller so ensure to have them before you start.

Unfortunately for the time being I’m busy to write down full guide on programming Arm Coretex M. so if you are in hurry to get things to work you can checkout our git repository for a clean and simple blink LED project. please keep in mind that follow all above steps and check ReadMe folder in the repository befor jump into the final stage.


next posts ›
close
menu