framework-system icon indicating copy to clipboard operation
framework-system copied to clipboard

`/dev/cros_ec` does not exist

Open jhpratt opened this issue 1 year ago • 11 comments

Failed to open /dev/cros_ec. Because: Os { code: 2, kind: NotFound, message: "No such file or directory" }
thread 'main' panicked at 'called `Option::unwrap()` on a `None` value', framework_lib/src/chromium_ec/cros_ec.rs:70:34
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

Using Fedora 40 on my new FW16, the /dev/cros_ec file does not exist. As such, the program fails in the manner indicated for most of the commands.

Is there something that needs to be installed? The README indicates that it should work out of the box so long as Rust is installed (I'm a Rust programmer, so it very much is).

jhpratt avatar Jun 05 '24 08:06 jhpratt

I'm seeing the same issue

Tool Version Information
  Version:     0.1.0
  Built At:    Thu, 16 May 2024 17:17:50 +0000
  Git Commit:  ?
  Git Dirty:   ?

zdcthomas avatar Jun 19 '24 18:06 zdcthomas

Same here, FW 16 with NixOS:

$ sudo framework_tool --test
Self-Test
  SMBIOS Platform:     Framework16
  SMBIOS is_framework: true
  Dump EC memory region
Failed to open /dev/cros_ec. Because: Os { code: 2, kind: NotFound, message: "No such file or directory" }
thread 'main' panicked at framework_lib/src/chromium_ec/cros_ec.rs:70:34:
called `Option::unwrap()` on a `None` value
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

julianneswinoga avatar Jul 07 '24 17:07 julianneswinoga

Hmm, seems like your ec kernel driver is not loaded (for various reasons), can you do something like this:

alex@alex-framework:~% modprobe configs
alex@alex-framework:~% zcat /proc/config.gz|grep CROS_EC
CONFIG_KEYBOARD_CROS_EC=m
CONFIG_I2C_CROS_EC_TUNNEL=m
CONFIG_GPIO_CROS_EC=m
CONFIG_CROS_EC_WATCHDOG=m
CONFIG_MFD_CROS_EC_DEV=m
CONFIG_CEC_CROS_EC=m
CONFIG_SND_SOC_CROS_EC_CODEC=m
CONFIG_RTC_DRV_CROS_EC=m
CONFIG_CROS_EC=m
CONFIG_CROS_EC_I2C=m
CONFIG_CROS_EC_ISHTP=m
CONFIG_CROS_EC_SPI=m
CONFIG_CROS_EC_UART=m
CONFIG_CROS_EC_LPC=m
CONFIG_CROS_EC_PROTO=y
CONFIG_CROS_EC_CHARDEV=m
CONFIG_CROS_EC_LIGHTBAR=m
CONFIG_CROS_EC_DEBUGFS=m
CONFIG_CROS_EC_SENSORHUB=m
CONFIG_CROS_EC_SYSFS=m
CONFIG_CROS_EC_TYPEC=m
CONFIG_EXTCON_USBC_CROS_EC=m
CONFIG_IIO_CROS_EC_ACCEL_LEGACY=m
CONFIG_IIO_CROS_EC_SENSORS_CORE=m
CONFIG_IIO_CROS_EC_SENSORS=m
CONFIG_IIO_CROS_EC_SENSORS_LID_ANGLE=m
CONFIG_IIO_CROS_EC_LIGHT_PROX=m
CONFIG_IIO_CROS_EC_BARO=m
CONFIG_CROS_EC_MKBP_PROXIMITY=m
CONFIG_PWM_CROS_EC=m
alex@alex-framework:~% lsmod|grep cros_ec
cros_ec_lpcs           20480  0
cros_ec                20480  1 cros_ec_lpcs
alex@alex-framework:~% uname -a
Linux alex-framework 6.9.7-arch1-1 #1 SMP PREEMPT_DYNAMIC Fri, 28 Jun 2024 04:32:50 +0000 x86_64 GNU/Linux

amstan avatar Jul 08 '24 06:07 amstan

modprobe configs errors out: modprobe: FATAL: Module configs not found in directory /lib/modules/6.9.4-200.fc40.x86_64

And given that, perhaps unsurprisingly zcat /proc/config.gz says file not found.

jhpratt avatar Jul 08 '24 07:07 jhpratt

I don't have this working either - I can confirm the module is loaded but I get this:

[   15.536037] cros_ec_lpcs cros_ec_lpcs.0: EC ID not detected

cawilliamson avatar Jul 09 '24 16:07 cawilliamson

Nothing here either

[parker@parker-framework ~]$ lsmod | grep cros
cros_ec_lpcs           20480  0
cros_ec                20480  1 cros_ec_lpcs
[parker@parker-framework ~]$ sudo framework_tool --versions
UEFI BIOS
  Version:        03.03
  Release Date:   03/27/2024
EC Firmware
Failed to open /dev/cros_ec. Because: Os { code: 2, kind: NotFound, message: "No such file or directory" }
thread 'main' panicked at framework_lib/src/chromium_ec/cros_ec.rs:70:34:
called `Option::unwrap()` on a `None` value
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Linux parker-framework 6.9.8-arch1-1 #1 SMP PREEMPT_DYNAMIC Fri, 05 Jul 2024 22:11:24 +0000 x86_64 GNU/Linux

parkerlreed avatar Jul 10 '24 15:07 parkerlreed

the issue is fixed with kernel 6.10, as it has the required cros_ec support

kriba24 avatar Jul 26 '24 14:07 kriba24

Yep! Thanks.

[parker@parker-framework ~]$ sudo framework_tool --versions
[sudo] password for parker: 
UEFI BIOS
  Version:        03.04
  Release Date:   07/09/2024
EC Firmware
  Build version:  "lotus_v3.4.113353-ec:b4c1fb,os:7b88e1,cmsis:4aa3ff 2024-03-26 07:08:43 lotus@ip-172-26-3-226"
  RO Version:     "lotus_v3.4.113353-ec:b4c1fb,os:"
  RW Version:     "lotus_v3.4.113353-ec:b4c1fb,os:"
  Current image:  RO
PD Controllers
  Right (01)
    Main   App:     0.0.30 (Notebook)
    Backup App:     0.0.30 (Notebook)
  Left  (23)
    Main   App:     0.0.30 (Notebook)
    Backup App:     0.0.30 (Notebook)
Retimers
  Unknown
CSME
  Unknown

parkerlreed avatar Aug 06 '24 01:08 parkerlreed

Not working for me on my newly-bought FW 13 with Intel 125H

UEFI BIOS
  Version:        03.01
  Release Date:   07/08/2024
EC Firmware
Failed to open /dev/cros_ec. Because: Os { code: 2, kind: NotFound, message: "No such file or directory" }
thread 'main' panicked at 'called `Option::unwrap()` on a `None` value', framework_lib/src/chromium_ec/cros_ec.rs:70:34
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

kernel 6.10.5-arch1-1

jabcross avatar Aug 25 '24 00:08 jabcross

Same for me, doesnt work for me on Intel Core Ultra 165H and Fedora 40 with kernel 6.10.7-200.fc40.x86_64.

basert avatar Sep 11 '24 13:09 basert

I am also seeing that this doesn't work on my newly setup Framework 16 with NixOS with Secure boot enabled.

uname -a

Linux nixos 6.6.54 #1-NixOS SMP PREEMPT_DYNAMIC Fri Oct  4 14:30:05 UTC 2024 x86_64 GNU/Linux

I have this tool imported through nixos-hardware

sudo framework_tool --version

Tool Version Information
  Version:     0.1.0
  Built At:    Fri, 06 Sep 2024 02:26:42 +0000
  Git Commit:  ?
  Git Dirty:   ?

Should this be working for Framework 16 at this point? If not can someone link me an issue or discussion for tracking a fix.

Edit: I see above that someone mentioned linux kernel 6.10 fixes this issue. Anyone know if upgrading to that kernel on NixOS is stable?

JMartJonesy avatar Oct 10 '24 18:10 JMartJonesy

For me it didnt work either. I tryed a bunch of different kernels, the newest were 6.10.14 and 6.11.5 I got a Framework 16 with NixOS on it. @kriba24 do you have a 16 too?

niggowai avatar Oct 24 '24 17:10 niggowai

For NixOS, I've raised this as NixOS/nixpkgs#365709. However, upgrading the kernel to 6.11, by adding boot.kernelPackages = pkgs.linuxKernel.packages.linux_6_11; to my NixOS configuration, does have the tool working as expected:

$ uname -a; sudo framework_tool --power
Linux hex 6.11.10 #1-NixOS SMP PREEMPT_DYNAMIC Fri Nov 22 14:39:56 UTC 2024 x86_64 GNU/Linux
  AC is:            connected
  Battery is:       connected
  Battery LFCC:     5664 mAh (Last Full Charge Capacity)
  Battery Capacity: 5664 mAh
                    100.394 Wh
  Charge level:     100%
  Battery discharging

me-and avatar Dec 16 '24 22:12 me-and

Moving to the new NixOS 24.11 fixed this for me as well since it's on a newer kernel.

JMartJonesy avatar Dec 16 '24 22:12 JMartJonesy

--driver portio works on all systems (with secureboot disabled), even when the cros_ec_lpcs driver is not loaded.

Various platforms got support in different kernels. With 6.13 all platforms the driver loads seamlessly on all platforms.

JohnAZoidberg avatar Jan 29 '25 07:01 JohnAZoidberg

Just tried this on Fedora 41 and it failed for me, both without --driver portio and with it:

dcaro@fedora:~/Downloads$ sudo ./framework_tool --driver portio -t
Self-Test
  SMBIOS Platform:     IntelCoreUltra1
  Dump EC memory region
[ERROR] ioperm failed. portio driver is likely block by Linux kernel lockdown mode
[ERROR] Failed to communicate with EC. Reason: "Failed to initialize"
    Failed to read EC memory region
  Checking EC memory mapped magic bytes
[ERROR] ioperm failed. portio driver is likely block by Linux kernel lockdown mode
[ERROR] Failed to communicate with EC. Reason: "Failed to initialize"
[ERROR]   Failed to read EC ID from memory map
FAILED!!
Error: "Fail"

dcaro@fedora:~/Downloads$ uname -a
Linux hephaestus 6.11.4-301.fc41.x86_64 #1 SMP PREEMPT_DYNAMIC Sun Oct 20 15:02:33 UTC 2024 x86_64 GNU/Linux

dcaro@fedora:~/Downloads$ sudo ./framework_tool --version
Tool Version Information
  Version:     0.2.1
  Built At:    Thu, 06 Mar 2025 05:57:18 +0000
  Git Commit:  4ff42b89491e0aa265611c726faedf945ac7ca8e
  Git Dirty:   ?

david-caro avatar Mar 06 '25 15:03 david-caro

portio cannot work with Secureboot/lockdown enabled.

For cros_ec with Intel Core Ultra, you need at least kernel 6.11 with this patch: https://github.com/torvalds/linux/commit/62be134abf4250474a7a694837064bc783d2b291

JohnAZoidberg avatar Mar 06 '25 15:03 JohnAZoidberg