Dell Chromebook 3180 Activity Light

Good day to all of you. I recently installed EndevourOS on my Dell Chromebook 3180 that has MrChromebox firmware in it. And surprisingly working great on all aspects sound, keyboard and track pad. And most of all even though there is a limited storage capacity on this machine with just 16 Gb, I still have roughly 5 Gb left after installing other needed softwares like printing support unlike other OS which plays around 2 Gb or less after installation. Enough about that, the real reason I post is that this machine is equipped with Activity Light.

download

I manage to get it work using a script from a blog.
The only problem I have is I need to be root to access the device /dev/hidraw1 and not as a normal user. I am currently creating a graphical user interface to interact with the activity light.

Screenshot_2022-11-14_14-47-15

The instruction provided from the blog is applicable using Devian/Ubuntu based only. I hope you all can help me.

If I violate any rules and posting guidelines please accept my apology, I didn’t mean to do any harm. Thank you and have a nice day.

Can you elaborate more on what the issue is? You said you managed to get the script to work. But I read the script, and the script uses /dev/hidraw0 (is it hidraw0 or hidraw1?). I assume you ran the script with sudo?

I’m still a bit unclear as to what the problem is.

It’s hidraw1.

#!/usr/bin/python

from random import randrange
import sys
from time import sleep

devpath = '/dev/hidraw1'

# Available colors
colors = {
    'red': 0x01,
    'green': 0x02,
    'blue': 0x03,
    'yellow': 0x04,
    'magenta': 0x05,
    'cyan': 0x06,
    'white': 0x07,
    'black': 0x08
}


def changeColor(color='white'):
    """ Change Dell Chromebook 11 led color """

    # Checksum function
    chsum = lambda b0, b1, b3: (21 * b0**2 + 19 * b1 - 3 * b3) % 255

    # Build command
    cmd = bytearray.fromhex('ff' * 64)
    cmd[0] = 0x11
    cmd[1] = colors[color]
    cmd[3] = randrange(255)
    cmd[2] = chsum(cmd[0], cmd[1], cmd[3])

    # Send command
    try:
        with open(devpath, 'wb') as d:
            d.write(cmd)
    except IOError:
        print("Can't access " + devpath)
        raise

changeColor('magenta')

I tried to run it with sudo and the activity light activate/change color. I was hoping to access the device hidraw1 as a normal user not as sudo. Thank you.

To access a root-owned file as a normal user, I believe you would have to edit the /etc/sudoers file, which can be dangerous.

Another option is to add your user to the adm group.

Another option is to use setuid

Hope this helps.

2 Likes

Thank you very much. I manage to get it to work using a udev rule.

Step 1. Add “user” to “adm” group.

$ sudo usermod -a -G adm myusername

Step 2. Create a /etc/udev/rules.d/40-kefka-led.rules and below text.

ATTRS{idVendor}=="04d8",ATTRS{idProduct}=="0b28",MODE="0660",GROUP="adm"

Step 3. Reload udev rules.

sudo udevadm control --reload-rules && sudo udevadm trigger
2 Likes