Live data from Hacker News

Android's new Bluetooth stack rewrite (Gabeldorsh) is written with Rust

android.googlesource.com

151–160 of 393 posts

Re: Android's new Bluetooth stack rewrite (Gabeldorsh) is written with Rust

#151

Earlier quoted context omitted.

Zig is too uninteresting to eclipse anything. It's the same problem as D's -betterC option. It's not better-enough to motivate switching away from C in places where C is still used, and it's far too stripped down & basic to attract the majority that's gone to C++, Rust, Go, ObjC, or Swift (or even "full" D). It doesn't offer much to justify switching costs. If C++11 had never happened then maybe Zig would attract the…

I share your view partially. As you said, code generation is difficult and it can get messy pretty fast, but this is the beauty of Zig, you have these features tightly packed, there is a capped number of ways for doing things. In Zig you learn how to use the wand properly, instead of being distracted by trying different sizes and colors of wands. While many languages focus on the breadth of ways of doing things, Zig…

Sounds a lot like Go. For me, that was a huge problem with Go.

I can only speak for Go, not Zig at all, but not giving me the "wand colors" meant that when i still needed colors to solve my problems, i had to invent them myself. .. okay this analogy breaks down there, but yea. The need for basic things like iterators, enums, and sometimes even generics didn't go away in Go. They didn't stop being extremely useful patterns or abstractions. They're just missing.

So what do you do with something that is still useful, possibly needed, but missing? You reinvent it. Very basic behavior like Iterators, Maps, etc become separated by piles of functions spread out all over the page. Yea, it's all simple - no complex features, but also no way to express that logic tightly, quick to reason about. Go wears down your scroll wheel in my experience (~5 years).

Would i have the same complaints about Zig? Your comment leaves me feeling like i would.

Re: Android's new Bluetooth stack rewrite (Gabeldorsh) is written with Rust

#152

Earlier quoted context omitted.

Buggy Bluetooth on the other end... Alexa is running Linux, and the Sony is probably some custom bluetooth stack. Once you move to all Apple bluetooth, things really smooth out. It seems that Apple does way more testing/validating of their Bluetooth stack.

I had the idea in my head (so take with a grain of salt) that parts of the BT stack are underspecified such that different implementations tend to have slightly different interpretations of the standard, so the problem isn't even which vendor you use so much as going all-in on any single vendor so the devices all agree on which reading to use. Although of course Apple might well be better anyways; one would hope that…

I buy this. All Apple works great, but Apple headset with Windows PC doesn’t seem better than anything else with Windows PC.

Re: Android's new Bluetooth stack rewrite (Gabeldorsh) is written with Rust

#153

This is great news. Hopefully it fixes a lot of the jank that I've always experienced with Android Bluetooth. I don't think I've ever had a smooth experience - even with a supposedly flagship device (Pixel 4a!) I've encountered all of the following problems: * Devices getting stuck at max volume (thankfully not headphones) * Devices getting stuck at really low volumes * Devices randomly switching between absolute vol…

All my Bluetooth woes from iPhone finally went away when I got a Pixel last year. The iPhone is still here and being used, but not for exercising due to the connectivity issues. I think it’s just Bluetooth itself being cursed.

What’s interesting is the iPhone Bluetooth experience with Apple products is excellent. I remember my partner used to have an Android wear watch for her Android phone and it was constantly disconnecting and having to be disconnected/reconnected to fix issues. When I got my Apple Watch, I couldn’t believe how smooth the experience was. To the point where if you didn’t know it ran off Bluetooth you would think it is some new protocol. Similar experience with AirPods as well.

Re: Android's new Bluetooth stack rewrite (Gabeldorsh) is written with Rust

#154
post #145

Earlier quoted context omitted.

NOT TRUE! You are doing it wrong If you are manually managing memory on Modern C++. C++ has RAII built in even before Rust came to the scene. I've never had a situation where I had to manage memory manually during my professional career in C++ If your students face seg faults, please show them Valgrind. Valgrind is better than GDB when it comes to seg faults. It can show you where exactly error occurred. Edit: Oh I g…

I believe that statement from the person you're replying to was in comparison to the issues with teaching C not C++

No. See what he said,

"C++ is a little better because they have experience with Java, but they are frequently mystified by constructors/destructors and how to manage memory manually"

Re: Android's new Bluetooth stack rewrite (Gabeldorsh) is written with Rust

#155

Earlier quoted context omitted.

>Wait , so can rust generally be replace C++ code in most projects ? In principle Rust could replace every line of C++ code in the world. The questions of how often it would be a good idea to do so, practical to do so, is harder to say. It is promising that this bluetooth stack only needed 4 lines of unsafe though! Since the interop is zero overhead doing piecewise migrations is certainly possible, as has been going…

I thought curl was expressly not migrating any code to Rust?

Yes, but more recently there has been a change of heart. I don't think it implies for now that there is any aim to replace all of it with Rust though.

Re: Android's new Bluetooth stack rewrite (Gabeldorsh) is written with Rust

#156

I'm always curious why bluetooth is such a terrible piece of technology. Did anyone write blogposts analyzing what went wrong?

Some of it is the constraints with the main use cases: low power, (relatively) high bandwidth, the need to pair devices without screens. Comparing this use case to something like wifi is unfair.

A lot of it is due to backwards compatibility. Bluetooth isn't simply bluetooth. There are different versions, different profiles, different codecs, and even different optional features.

Have a look at the matrix: https://www.rtings.com/headphones/learn/bluetooth-versions-c...

The two devices being paired have to figure out what version/profile/codec to use to talk to each other, and gracefully fall back to the lowest mutually supported featureset. This is a really hard problem, and the devices don't always handle it well.

Re: Android's new Bluetooth stack rewrite (Gabeldorsh) is written with Rust

#157

I know the guy that heads up the team that did this work -- he and I spent 2+ years fighting Broadcom's old, god-awful bluetooth code. Our whole team used to play what-if games about replacing the thing while massive code dumps came in from vendors, making the task ever larger. Zach, if you're reading this, HUGE kudos to holding the line in replacing that, and double kudos for doing it in a verifiable, sane language!

Broadcom seems to pump out a lot of garbage in general. The SoCs on the raspberry pis are particularly terrible.

Re: Android's new Bluetooth stack rewrite (Gabeldorsh) is written with Rust

#158

I'm always curious why bluetooth is such a terrible piece of technology. Did anyone write blogposts analyzing what went wrong?

From what I know from having worked at Nokia, it's simply the result of design by committee where the committee was made up of mutually very hostile hardware (mostly) companies not particularly good at software (that's how Nokia failed in a nutshell), telcos, chipset manufacturers, hardware manufacturers, etc. And I mean hostile as in looking to squeeze each other for patent licensing, competing for the same customer…

> pple did Facetime instead and in the process also strangled SMS and cut out the middlemen

I'm personally really glad for this decision. iMessage is many times better than SMS. SMS security is a nightmare by design.

I just wish there was something better between Google and Apple, like a universal iMessage.

Re: Android's new Bluetooth stack rewrite (Gabeldorsh) is written with Rust

#159

Earlier quoted context omitted.

>Wait , so can rust generally be replace C++ code in most projects ? In principle Rust could replace every line of C++ code in the world. The questions of how often it would be a good idea to do so, practical to do so, is harder to say. It is promising that this bluetooth stack only needed 4 lines of unsafe though! Since the interop is zero overhead doing piecewise migrations is certainly possible, as has been going…

I thought curl was expressly not migrating any code to Rust?

Well there's this: https://daniel.haxx.se/blog/2020/10/09/rust-in-curl-with-hyp...

Re: Android's new Bluetooth stack rewrite (Gabeldorsh) is written with Rust

#160
shudder I'm thinking back to all of the nightmares I had trying to use Bluetooth (especially BLE) in the early Android 6 and 7 days. It was basically unusable because of _serious_ platform bugs and issues. I hope this time with a new stack it goes a little better.
Post reply on HN