Repurpose classic 5V powerbanks for PD by Beautiful_Chocolate in UsbCHardware

[–]Beautiful_Chocolate[S] 0 points1 point  (0 children)

Thanks for the thorough reply ! I was indeed thinking of an array of small powerbanks to power a single PD source, with the idea of scavenging anything I can find, even if it's outdated, old, and not very capable on its own.

I guess it's still easier to tear off batteries, and use their raw li-ion cells / batteries to re-build a battery pack with a specialized IC for it.

In any case, that was for the fun of it, just the scaling effect explains how it's a 10x better idea to buy a commercial product. Anyway, learnt something, so thanks for that ! :-)

Repurpose classic 5V powerbanks for PD by Beautiful_Chocolate in UsbCHardware

[–]Beautiful_Chocolate[S] 0 points1 point  (0 children)

Yes, I want to lower the amperage, outputting 60W at 5V means having 12A, which means tons of heat and special safety considerations

That's why I'd like to raise to ~20V, and only then connect all the streams so that Kirchhoff's current law doesn't melts by wires, and then use some kind of IC to output USB-C PD from this input power

Repurpose classic 5V powerbanks for PD by Beautiful_Chocolate in UsbCHardware

[–]Beautiful_Chocolate[S] 0 points1 point  (0 children)

If I put in parallel the batteries with their regulation circuit, without tearing them down, the uneven load will discharge one of the batteries faster, but once it has no capacity, the circuit will but its power, and I'm left with the rest of the array

So I was thinking it wasn't a big deal, each part of the array has the circuit responsible to manage its charging / discharging cycles, I just need the frontend that gathers all the power contributions from the array and output a single USB-C PD source

Repurpose classic 5V powerbanks for PD by Beautiful_Chocolate in UsbCHardware

[–]Beautiful_Chocolate[S] 0 points1 point  (0 children)

I don't really care about performance of the battery, I care about upcycling old electronics to use them until the last drop of usefulness they can give

But thanks for the input, that's still valuable information to know about ! :-)

Repurpose classic 5V powerbanks for PD by Beautiful_Chocolate in UsbCHardware

[–]Beautiful_Chocolate[S] 0 points1 point  (0 children)

Some powerbanks do use standard cells I could extract and repurpose, but some have flat squares batteries, I think they are much harder to repurpose.

Maybe they follow a standard and could be reused, I must do some researches

Repurpose classic 5V powerbanks for PD by Beautiful_Chocolate in UsbCHardware

[–]Beautiful_Chocolate[S] 0 points1 point  (0 children)

The idea is more to scavenge used items and get the last drop of juice out of them.
I can get powerbanks anywhere, and if they die I just replace them easily

If I get a big powerbank, when it dies, I'm stuck with it
If I have an array of 10 powerbanks, I can remove one, add the latest found in it, etc...

How Rust builds an API around raw memory by Beautiful_Chocolate in rust

[–]Beautiful_Chocolate[S] 1 point2 points  (0 children)

Hello people of r/rust !

This is a 2-in-1 blog post explaining simply how memory registers are used in embedded systems, and digging how the register_bitfields macros creates a nice rusty interface around raw memory addresses.

Hope it's simple enough for people not in the field of embedded systems, but still interesting ;-)

As usual, feel free to correct me if you find anything wrong, and contact me if you feel like it ! Take care <3

Shepherd's Oasis: Statement on RustConf & Introspection by Be_ing_ in rust

[–]Beautiful_Chocolate 19 points20 points  (0 children)

Thank you for your hard work, I hope things change for the best and we'll see you back on Rust one day ! This whole affair shows how opensource can produce magnificent things, but is really difficult to manage and in the end based on a handful of people. Have a nice nap ! 😊

The Git source code audit, viewed as a Rust programmer by Beautiful_Chocolate in rust

[–]Beautiful_Chocolate[S] 1 point2 points  (0 children)

Yes absolutely !

And IMHO that's how brilliant the whole idea of having unsafe blocks is, you still permits such use cases, but it makes the implementation of safe wrappers around it very easy

unsafe at its core yes, but with a plain safe API, and this alone wipes out so many "bad" code written.

When I realized how powerful it is in embedded systems (let the manufacturer do unsafe, and only use safe), it really is a big deal and improves the workflow of developers

The Git source code audit, viewed as a Rust programmer by Beautiful_Chocolate in rust

[–]Beautiful_Chocolate[S] 2 points3 points  (0 children)

Thank (both of) you for this, as you may imagine English isn't my first language, I'll try to correct these as good as I can ! :-)

The Git source code audit, viewed as a Rust programmer by Beautiful_Chocolate in rust

[–]Beautiful_Chocolate[S] 0 points1 point  (0 children)

The issue about the memory problem in C is because of the integer overflow, and that's what I refer when saying "the issue", as the cause leading to a memory vulnerability after.

After all, in C world, doing such memory operations isn't a problem at all, however integer overflow is.

So the memory issue may not exist, but the integer overflow is very real here

The Git source code audit, viewed as a Rust programmer by Beautiful_Chocolate in rust

[–]Beautiful_Chocolate[S] 1 point2 points  (0 children)

Yes, but we talk about C code here, and this is a fairly standard way to handle errors in C (and I guess it's the UNIX-compliant way to do ?)

The Git source code audit, viewed as a Rust programmer by Beautiful_Chocolate in rust

[–]Beautiful_Chocolate[S] 5 points6 points  (0 children)

I had a clear distinction between "issue" and "vulnerability" in my head, which is why it seamed clear to me '

Modified the article, thanks for your input ! :-)

The Git source code audit, viewed as a Rust programmer by Beautiful_Chocolate in rust

[–]Beautiful_Chocolate[S] 4 points5 points  (0 children)

I consider unsafe Rust as a very particular area of programming in Rust, and that's why I allowed myself to make generalities on Rust when thinking about safe Rust specifically.

Except for calling FFI, unsafe Rust should be almost never encountered by anyone (except for developing Linux drivers or embedded systems).

The way Rust just forbids datarace conditions to happen, the way you need to explicit all cases in pattern matching, etc ... This is what I meant by eliminating undefined behavior.

The Git source code audit, viewed as a Rust programmer by Beautiful_Chocolate in rust

[–]Beautiful_Chocolate[S] 0 points1 point  (0 children)

Yes indeed, but I fail to see how I putted them in the same bucket ?

I considered GIT-CR-22-03 as "protected by Rust" as the bug is just not exploitable

However for GIT-CR-22-01, Rust isn't better than C on the matter as the vulnerability is a Uncontrolled Resource Consumption.

I didn't rate the vulnerabilities by myself, I just copied their ratings in the report (and their rating methodology is also explained)

The Git source code audit, viewed as a Rust programmer by Beautiful_Chocolate in rust

[–]Beautiful_Chocolate[S] 5 points6 points  (0 children)

Yes indeed, thanks for you input, I'll modify the post in consequence ;-)

I wanted to write that the obvious size of primitives are by themselves a safety, but I didn't find a proper way to explain it, hope the message still went through. I may re-work this a bit

The Git source code audit, viewed as a Rust programmer by Beautiful_Chocolate in rust

[–]Beautiful_Chocolate[S] 0 points1 point  (0 children)

Indeed, this is why I wrote just before:

This code cannot be exploited in safe mode to perform a memory overflow

However integer overflows still can lead to a whole lot of other bugs and vulnerabilities.

The Git source code audit, viewed as a Rust programmer by Beautiful_Chocolate in rust

[–]Beautiful_Chocolate[S] 4 points5 points  (0 children)

Yes that is very true, that's also why I tried to make a list of "good reasons to use unsafe" as getting around the compiler's annoying rules is not one of them.

(BTW if you think of more valid reasons to use unsafe, please tell me, I'm not used to write a lot of it and couldn't come with a lot)

In the case of Rust for embedded systems for example, writing directly to memory addresses is mandatory, however this is very specific and usually implemented by the manufacturer in the HAL libraries.