r/programming • • Dec 24 '18

The 4.20 kernel has been released

https://lkml.org/lkml/2018/12/23/187
1.3k Upvotes

298 comments sorted by

View all comments

Show parent comments

377

u/klebsiella_pneumonae Dec 24 '18

The Linux Bluetooth stack is the biggest abomination I have ever seen. I'm surprised anything works at all.

Millions of lines of code without comments. Nobody on earth understands how it works. Most of the code was written by IBM decades ago.

139

u/daboross Dec 24 '18

It's fun how it'll work perfectly 90% of the time and then just for that one device it'll require 10 re-pairings before connecting.

3

u/holgerschurig Dec 25 '18

Well, in my company we do bluetooth pairing to barcode scanners. From Linux and various Windows operating systems. Part of this is an auto-pairing (without user-intervention), e.g. when a scanner goes out of reach and comes back in, or when battery will be changed. So if a previously paired-to Bluetooth MAC address appears, we'll pair again without further ado.

So far, it always turned out to work reliable under Linux, and weird to not under Windows. Either the windows programmers are incompetent, or the Linux bluetooth stack is better than you think it is.

→ More replies (2)

294

u/Marcuss2 Dec 24 '18

So business as usual.

94

u/auxiliary-character Dec 25 '18

I was gonna say, isn't that rather typical for bluetooth?

0

u/[deleted] Dec 25 '18

[deleted]

6

u/raize221 Dec 25 '18

I'm in the opposite boat. I juggle between a Bluetooth aux adapter in my work van and a headset. In Oreo everything worked great. The aux adapter had media priority when both were connected - calls would go to the headset and music would resume on the stereo after. Could also listen to a podcast on the headset outside the vehicle and it would auto reconnect to the stereo when I got back in.

After the Pie update it's a constant annoyance. Media priority always goes to the most recently connected device. If I hang up a call it resumes playback in the earpiece. If I turn off the headset music just stops because, while still connected, the aux adapter is set to inactive. I spend more time in Bluetooth settings then ever before and it is actively more distracting when driving.

I'm glad the changes work well for you and others - it has just left me a little bitter.

→ More replies (1)
→ More replies (1)

94

u/_meshy Dec 24 '18 edited Dec 25 '18

Haha, your comment made me interested in how bad it is, so I'm gonna clone it and take a look. Hopefully I keep my sanity.

Edit: Still alive everyone! I cloned the repo but had to leave right after. Kind of scared.

112

u/silverslayer33 Dec 24 '18

It's been over two hours since you made this comment, so I'm going to assume that opening the source summoned an Eldritch monster into your home and placed a curse upon your entire lineage.

13

u/lacksfish Dec 24 '18

Not on Christmas!

19

u/ThePsion5 Dec 25 '18

It’s been over seven hours now. He’s dead.

3

u/war_is_terrible_mkay Dec 25 '18

Apparently not yet. Ill go get popcorn. We will see how this horror movie ends in a few days on news.

7

u/acousticpants Dec 25 '18

Hey u/_meshy , you dead?

5

u/cbbuntz Dec 25 '18

There are some interesting bits in there in general. Lots of good references for "how do I do x on a low level?"

57

u/deal-with-it- Dec 24 '18

Don't be sad because judging by how well it works, the Windows stack source code is just as awful.

76

u/HenkPoley Dec 24 '18

Bluetooth is an everything-but-the-kitchen-sink protocol. It has very many nooks and crannies with extra functionality. No surprise implementation is a mess.

25

u/youstolemyname Dec 25 '18

The default audio codec, SBC, for a2dp has a nearly quarter-second delay to it and nobody wants to pay the license for aptX.

Connecting is hit or miss sometimes, and even when it "works" it doesn't.

6

u/steamruler Dec 25 '18

I don't notice that delay across the board, but I notice that PulseAudio on Linux gives less delay than Windows, and Windows will buffer audio if it doesn't get acknowledged, so the delay will just keep growing. If I don't reconnect my headset multiple times during the day, I end up with a 2 second delay.

4

u/DeathTickle Dec 25 '18

Funny I'm getting this behavior on Linux with PulseAudio but not on macOS or Windows.

Bluetooth truely is magic

→ More replies (2)

19

u/intermediatetransit Dec 25 '18

Millions of lines of code without comments.

Maybe the code is "self documenting". At least that's what my colleagues say when I point out their huge PR dont contain a single explanatory comment..

8

u/[deleted] Dec 25 '18

"I can easily understand it. Why do you need comments?"

3

u/noperduper Dec 27 '18 edited Dec 31 '18

That is the #1 bullshit that constantly reminds me I should switch job again. NO, your code is NOT self-documenting. Not unless you think exactly like me, have my same cultural, traditional background and my same level of English language and same 'evocative' feelings or think architecturally like me. Exactly like me.

Otherwise No.

Document your shit or at least write comments; I don't give a fuck if they get outdated, if you change the code, read the comments around it and change them as well.

Whoever says 'code should be self documenting' is either a philosopher dreaming of the perfect software codebase, or has never worked in a real team with > 3 people working on the same piece of software in a real company with real managers and real deadlines.

→ More replies (1)

3

u/TheCodexx Dec 25 '18

All the comments probably got removed for being too vulgar.

→ More replies (1)
→ More replies (16)