r/osdev
•
u/Glum-Cook-9438
•
28d ago
•
1
OH GOD NO
Started working on USB drivers for my hobby 64-bit OS, and oh god no little did I know what have I gotten myself into....
Wish me luck...
My OS project: https://github.com/itay-insert/64-dem.git
547
Upvotes
33
u/Sorry_Difficulty_250 28d ago
lol Good luck! 😁😁
33
u/Individual_Feed_7743 28d ago
Love seeing people take on xHCI work! Best of luck :)
25
u/litescript 28d ago
oh baby. i’m working on drivers for a little embedded project. i feel you. have fun!
19
u/levidurfee 28d ago
Take a break and watch a movie. Maybe watch that new movie, Obsession.
12
u/dacydergoth 28d ago
The spec makes my brain hurt
5
u/zerosign0 28d ago
Yup I can remember (at least) some horror from early usb drivers bugs hmm
3
u/bendgk 27d ago
why are you writing `interfaces[i].endpoints[j]` all over the place… this is completely unreadable.
```
auto endpoint = interfaces[i].endpoints[j];
endpoint.address = endpoint.descriptor.bEndpointAddress;
…
```
Love that you’re writing the code by hand; this is what real learning used to look like! (I’m still very pro LLMs, but love to see people do it the old way!)
7
u/UnmappedStack TacOS | https://github.com/UnmappedStack/TacOS 28d ago
mmmhmmm I see that commit in the screenshot, "...with codex", smh go read a spec and try write it yourself
2
u/MasterOfAutomation 28d ago
That's the stuff dreams are made of!
2
u/Even-Tooth4840 25d ago
Maybe you'll learn how screenshots work along the way
2
u/4dr14n31t0r 18d ago
You remembered me back in the day when I was young and bold. I managed to detect the USB when I'd plug it in the port. I did it using NASM because I didn't want to bother learning how to use C when doing OSDev. Then I hit a wall trying to read or write anything: I couldn't make the damn ring structures work no matter what. Then I realized if I really wanted to make progress I'll have to reverse engineer a xHCI driver that works and compare it with my code to see what's wrong with it. And what's the best place to find the source code of almost any driver? The Linux kernel ofc.
That was years ago. Studying the source code of the Linux kernel seemed a task so daunting that I decided to pospone it until I felt ready. It won't be easy but I will any day now. I want to learn Android development for now first.
1
u/Sqydev 28d ago
🤩
1
u/sethkills 27d ago
What’s the matter, son, too many magic numbers?!
1
u/doscore 27d ago
Welcome to the stack from hell lol
1
u/Randum_Gouy 27d ago
:)
Best of luck!
1
u/No_Code9 27d ago
Just ask claude
1
u/Maui-The-Magificent 27d ago
Mmmm.... yes, I have built an XHIC interface. If you want to make it easier for yourself, enumerate the device and then map the device yourself in the kernel... please for the love of god don't do a proper job and be dynamic...
1
u/CircuitBreakerChip 26d ago
One of my favourites interfacing
1
u/lattice_defect 26d ago
gross windows
1
u/belbel-dev-1124 26d ago
É qual licença? Permissão para usar?
1
u/hartmanbrah 26d ago
Yep, I recall wanting to do that a few years back. I pride myself on enjoying the fall down the rabbit hole, but I took one look at that spec... NOPE!
1
u/idontlikegudeg 26d ago
Ambitious! Thumbs up!
1
u/Acceptable-Affect-77 26d ago
an addiction
1
u/Immediate_Form7831 25d ago
Scariest part is the "push directly to master" IMHO
1
u/Responsible-Milk-508 25d ago
use vim
1
u/SaCorv 25d ago edited 25d ago
Whats the point of if (max_length - offset < 2)?
Your next if statement already covers it
It even would be more readable to have first if as
length < 2
And second as
max_length - offset < length
Tbh its better to avoid complex if statements all together
1
u/wrillo 24d ago
memcpy. I wonder which is greater, the number of vulnerabilities that AI will introduce or the number of vulnerabilities it finds in old hand code.
1
u/BlackHat-Maxwain 21d ago
Okay this is off topic but I have the same speakers as you, is one of them way quieter than the other for you too??