Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Creating an udev rule for a bluetooth keyboard [SOLVED]
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware
View previous topic :: View next topic  
Author Message
ville.aakko
Tux's lil' helper
Tux's lil' helper


Joined: 06 Aug 2006
Posts: 100
Location: Oulu, Finland

PostPosted: Wed Jul 16, 2014 4:14 pm    Post subject: Creating an udev rule for a bluetooth keyboard [SOLVED] Reply with quote

Hi!

I'm having trouble creating a udev rule for my bluetooth keyboard. Hope someone here can help me =). To cut right to the problem / culprit, is that the following rule does not seem work:

/etc/udev/rules.d/50-k810.rules:
Code:
KERNEL=="hidraw*", SUBSYSTEM=="hidraw", ATTRS{address}=="00:1F:20:A8:89:8C" \
 RUN+="/opt/bin/k810.sh %p"


A little more background: I have a logitech K810 as my primary keyboard on the HTPC in question (when I need one, actually primarily it's controlled vai a remote control). I need to run an executable to enable the F-keys to work as such by default (without pressing the Fn -key). I can do that manually (so that part is working), but that is a small PITA =).

I got the above udev rule and executable from here. Also there seems to be others struggling with the rule here: http://unix.stackexchange.com/questions/144417/making-udev-rule-for-bluetooth-keyboard

But with the above rule, the script is never run AFAICT. I know that since the script should write a log file to /tmp in any case (even if it would be doing something wrong). Here's the contents of the script:

/opt/bin/k810.sh:
Code:
#!/bin/sh
LOGFILE=/tmp/logfilek810sh.log
echo "RUN: at `date` by `whoami` act $ACTION \$1 $1 DEVPATH $DEVPATH DEVNAME $DEVNAME" >> ${LOGFILE}
echo "Setting F-keys on for your K810!"

if [ "$ACTION" == "add" ];
then
    # configure k810 ($DEVPATH) at $DEVNAME.
    /opt/bin/k810_conf -d $DEVNAME -f on
fi



Permissions of the files in question:
Code:
# ls -l /etc/udev/rules.d/50-k810.rules /opt/bin/k810*
-rw-r--r-- 1 root root   106 2014-06-12 16:48 /etc/udev/rules.d/50-k810.rules
-rwxr-xr-x 1 root root   304 2014-06-08 01:34 /opt/bin/k810.sh
-rwxr-xr-x 1 root root 13102 2014-06-07 22:05 /opt/bin/k810_conf


Cheers!
_________________
- Ville


Last edited by ville.aakko on Wed Jul 16, 2014 4:29 pm; edited 1 time in total
Back to top
View user's profile Send private message
ville.aakko
Tux's lil' helper
Tux's lil' helper


Joined: 06 Aug 2006
Posts: 100
Location: Oulu, Finland

PostPosted: Wed Jul 16, 2014 4:28 pm    Post subject: Reply with quote

Heh, well sometimes writing the problem to a forum will bring you to the solution by itself =)

In case someone has the same problem: putting the address in lower case to the rules file solves it! =D

This is how I figured it out: I tried slightly different google search and came up to this:
http://cris.bytesnblades.net/2009/02/20/starting-gpsd-automatically-with-a-bluetooth-gps/

So, I figured I'd try to run udevadm info -a -n /dev/hidraw1:

Code:

  looking at parent device '/devices/pci0000:00/0000:00:12.0/usb3/3-3/3-3:1.0/bluetooth/hci0/hci0:43':
    KERNELS=="hci0:43"
    SUBSYSTEMS=="bluetooth"
    DRIVERS==""
    ATTRS{type}=="ACL"
    ATTRS{address}=="00:1f:20:a8:89:8c"


So, the address is shown with the letters in lower case - could it really be such a stupid error???? Previously I had used bluetoothctl to figure out the address (which is the same, but in CAPITALS). And - lo and behold - butting the address in lower case solved it!

Cheers, and thanks for your time!
_________________
- Ville
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum