[7040u] Lid randomly closes and opens for less than 50 ms at a time during normal use

I’ve got a fairly bizarre issue I wasn’t able to track down on the forums, so here I go…

In the course of normal use (including while simply typing out this post on the forum - no magnetic objects nearby!), my Framework 13 (7640u) has been randomly detecting “lid closed” for anywhere between 30 and 60 milliseconds at a time, making the laptop go to sleep (which I manually overrode with KDE settings). Regardless, the laptop still detects that it has “gone to sleep” and the power light flashes for an instant before the laptop either proceeds to suspend (prior to settings override) or returns to normal (since I modified settings). This would happen sometimes 1-2 seconds apart, other times a minute apart, and that is, whether I’m typing on my lap or the laptop is on a hard surface.

Running journalctl -u systemd-logind -o short-iso-precise on Linux evidences this (screenshot attached). I absolutely suspect that there’s some sort of a hardware issue going on. I already cleaned the audio cable with isopropyl alcohol, have cleaned much of the laptop proper, etc, and have checked issues with the power button (there are none). This started happening earlier today after I disassembled and reassembled the laptop to fix some other issues with the laptop. What’s going on?

Anything magnetic near the left side of the laptop?

Hmmm, doesn’t seem like it. I was able to replicate the issue even with the input cover kit removed.

Here’s a photo of the internals. Also added a photo of the audio cable since I suspect it might have something to do with that as well.

I’m not sure why you think the input cover is relevant, the lid sensor sits on the chip that has the audio port on the left between the speaker and the expansion ports.

The most likely cause is either something magnetic near the audio board, or maybe a short cuircuit in that audio cable, which looks a bit bad from your photo.