gonutz / framebuffer

Go library for accessing the framebuffer under Raspbian as a Go Image.
MIT License
41 stars 12 forks source link

Support other models #2

Closed firelizzard18 closed 7 months ago

firelizzard18 commented 7 months ago

I want to use this library on a PC, for which it needs to support profiles other than RGB565

gonutz commented 7 months ago

Hey Ethan,

thanks for the PR, really cool that this library is still in use! :-)

I am looking at your code right now. Unfortunately I have no Raspberry Pi available right now, so I cannot test it. That is why I might take a bit longer before I merge this. I want to at least try some things out in code.

One thing I noticed right away is that your go.mod and go.sum contain a reference to golang.org/x/exp. I guess those can be removed. :-)

firelizzard18 commented 7 months ago

Yeah, I was playing around with generics but it ended up being more trouble than it was worth.

I made a version that eliminates the dependency on CGo by replicating the structures and using the syscall package to call ioctl. Do you want me to merge that in here? I also added some code to make it possible to put the TTY in graphics mode, but that turns out to be problematic so I'm not using it at the moment.

gonutz commented 7 months ago

I saw that repo of yours and I like the idea of removing CGo from the dependency list :-)

To see if that cross-builds to Linux from my Windows machine, I just cloned it and tried to build it. It gives me the following error message:

go-framebuffer\go.mod:3: invalid go version '1.21.6': must match format 1.23

I run go 1.19 and it seems this version does not handle patch versions in the go.mod file. What version do you use and does it not report that problem?

firelizzard18 commented 7 months ago

I think it just defaulted to the go version I set it up with (1.21.6). It appears to build fine with 1.18 - I'm using generics so it can't go earlier than that. I'll change it and merge into this PR.

gonutz commented 7 months ago

Strange, as I said I have go 1.19.3. go 1.19 goes up to version 1.19.13 so this might have been a change between these versions.

Anyway, seeing that you basically re-wrote this whole library, I would suggest we close this PR and people just use your fork instead? The problem I have right now is that I cannot verify that your udpated version still works in a backwards compatible way with my version. As I said, I have no Pi handy right now so I cannot do quality control on your changes, even though I am sure you tested and verified them. I understand you have used this for your own needs and that is great and I really appreciate you taking the time to create a PR. I hope you understand my concerns, though. The good thing in open source is that you can have as many forks as you need :-)

firelizzard18 commented 7 months ago

That's fine, that's pretty much why I made my fork. Of course you're free to integrate my cgo-less ioctl implementation (or any of the other components) into your repo if and when you want to.

gonutz commented 7 months ago

Cool, thanks for you support here, great job! If I ever get my hand on a Pi again, I will sure test drive your library on it :-D