Xqua / pyAlienFX

This project is a multiplatform python software to control the AlienFX device of Alienware computers. It intend to be easily upgradable for future updates of the AlienFX device, as it happened for the M11XR3. And, to be a powerfull GTK apps, that can be linked with plugins throught a deamon server, allowing the LED to be controled accordingly ! Any Help is more than welcome ! Especially testing on different computers !
https://code.google.com/p/pyalienfx/
GNU General Public License v3.0
19 stars 5 forks source link

Question: the color bits #1

Closed snshn closed 10 years ago

snshn commented 10 years ago

Hello. I had a small question about color bits. They don't seem to represent exact 8-bit RGB scheme in my case. I'm working with libusb-1.0, M11Xr3. My patch to the terminal changes the color of the keyboard to match the color of the active window. However colors like 5c5 do not match the HTML hex equivalent of e.g, #55cc55 on my AlienFX. I was wondering if you had to perform any kind of tricks to convert the colors for the usb commands. Thanks!

Xqua commented 10 years ago

Hi

Yes you do ! Colors in rgb 8bit are in 3x8bits (one for each color rgb or 256 level of each color) The led do not support that they support only 16 level of each colors thus the 5c5 is equivalent to 50 c0 50 (sort of) I have a color conversion function in one of the files ! If i remember correctly it is in the pyAlienFX_engine.py !

Happy to hear that someone FINALLY hacked my code ;) !!

Sent from outer space

On May 22, 2014, at 12:03 PM, dotdotdot notifications@github.com wrote:

Hello. I had a small question about color bits. They don't seem to represent exact 8-bit RGB scheme in my case. I'm working with libusb-1.0, M11Xr3. My patch to the terminal changes the color of the keyboard to match the color of the active window. However colors like 5c5 do not match the HTML hex equivalent of e.g, #55cc55 on my AlienFX. I was wondering if you had to perform any kind of tricks to convert the colors for the usb commands. Thanks!

— Reply to this email directly or view it on GitHub.

snshn commented 10 years ago

Haha. Thanks a lot, man! I actually took the goround.c code (http://www.dettus.net/alienware/) as a source for my fork of st X11 terminal emulator; I added theme switcher to the code, then decided to add this keyboard thingy. I found the function in your code yesterday. Going to expirement more with it today. Thanks once again!

Xqua commented 10 years ago

Just for your information : I have created a Deamon that talks in TCP/IP with the driver, it is really Alpha stage and crashes, does not catch exception, should do checksum etc ! BUT If you wanna play around hacking into the lights you should give it a look !

snshn commented 10 years ago

I tried creating a kernel-space driver for alienfx, but it's too much of a hassle, when there's libusb and pyalienfx available. The true linux way to do it is to use some library and a kernel driver, I guess, but I'm good enough with libusb right now. Where can I see the latest source of this Daemon you mentioned?

Xqua commented 10 years ago

You can find the source here : https://github.com/Xqua/pyAlienFX/blob/master/pyAlienFX_daemon.py

Otherwise for the Kernel, I know it's the way to go ! And it should actually not be THAT hard because most of it I have done already ! It is basically porting that file : https://github.com/Xqua/pyAlienFX/blob/master/AlienFX/AlienFXEngine.py

And not even all of it ! But I wish I had more time to do it ! The thing is I created pyAlienFX during a year off XD so I had plenty of time to tinker with it ! But now I'm clearly out of time to work on it ! even simple debug and adding computers ...

snshn commented 10 years ago

Hey, thanks a lot for the references, @Xqua! I started writing the kernel driver about a year ago, but then found libusb-based implementations and decided to stick with them for prototyping. If I have time, I may try to finish it, (based on your code, if you allow). Maybe even contribute it to the Linux kernel tree in case they like it enough. Ü AlienFX is a pretty damn awesome idea, in my opinion, it deserves a native support in the kernel and a library to work with it. I love the stuff Dell makes with their Alienware products, very good hardware. Wish the Optimus and AlienFX had a better support, though.

Do you have xmpp by any chance or do you hang out on #irc somewhere? It seems that the fox has a lot to say Ü

Xqua commented 10 years ago

One thing, It seems you want to great some sort of Ambient Light Control, the only thing I am worried about is that you'll fry the controler XD If you keep sending instruction it'll eventually get Black and you nee to reboot ! I'm not electronic engineer so I'm not sure what's wrong and if you can do it without frying the controler ;) Otherwise I'd love to see a Kernel driver ! Secondly, I'd love to see people take my code, hack it, mash it, modify it ! That's the whole freaking idea of Open Source :D !

If you do get a Kernel Driver then anyone can write an interface to it ! I'd love to help make pyAlienFX compatible with the Kernel driver !

Finnally, Alienware does make great product ! I'm so sad they discontinued the 11" line ! ...

I usualy hangs on Freenode, as for XMPP I do use it from time to time but on private server for non NSA recorded conversations ^^

snshn commented 10 years ago

Could you please add me on jabber, I'm fltrz@uberspace.net? (so could OTR from NSA together sometime)

I'm going to try to port that piece of code in python to C and finish my ambient keyboard terminal patch. Thanks for the help!

snshn commented 10 years ago

I figured this out... 8 bit... so I have to divide 255 by 32, (not 16, like I used to do before); then I get the right color. I'm finishing the code right now. Thank you very much for your help, man!

Xqua commented 10 years ago

Indeed :D

Man I'm sorry I'm working on my resarch project so hard recently ! I meant to help more but I really am busy XD

I'll add you on jabber as soon as I have time to even do that !

But congrats ! :D

On 05/06/2014 14:03, dotdotdot wrote:

I figured this out... 8 bit... so I have to divide 255 by 32, (not 16, like I used to do before); then I get the right color. I'm finishing the code right now. Thank you very much for your help, man!


Reply to this email directly or view it on GitHub https://github.com/Xqua/pyAlienFX/issues/1#issuecomment-45253377.

snshn commented 10 years ago

thanks!

Xqua commented 10 years ago

No pb ! Keep me updated and use the Fork tool and pull request ! That way we can incorporate everything together ^^

snshn commented 10 years ago

exciting!

snshn commented 10 years ago

btw, here's my baby: http://vimeo.com/97468635

Xqua commented 10 years ago

Yeah Man !

That's super cool :) I'm afraid you'll fry the controller board but hell it looks awesome !

(Even if it's kind of a geeky thing that I'm not sure I would use everyday ! It would make my head hurt ^^)

Sent from outer space

On Jun 10, 2014, at 10:09 PM, dotdotdot notifications@github.com wrote:

btw, here's my baby: http://vimeo.com/97468635

— Reply to this email directly or view it on GitHub.

snshn commented 10 years ago

So far I only made other people's heads hurt by bragging about this thing.

Not sure about frying the controller... I guess it can really be damaged if I would flash the settings to it each time I switched, but I never save any programs or colors, I just switch the color of one LED module. Even if I hold (Alt+A) and make it cycle all the themes my terminal got, it still does it synchronous with the keyboard color and so far been working great.

Xqua commented 10 years ago

Ahaha yeah you deserve to brag a bit ;)

As for the controler I'm saying that because I've played a lot with mine and know it sometime does weird stuff xD (blink, get dark, etc) randomly. But it remains a 0.1% probablity ^^ !

Anyway as Alienware does not provide any tech spec we are left with reverse engineering ! (I sent them 10 emails XD)

Do you have a Kernel Driver working ?

snshn commented 10 years ago

Yes, I can confirm that I saw my keyboard going dark, it happened once or twice so far... but it would get the proper color again once I switch the theme.

The one I have is a modified stub of a driver from some USB toy (blinking mail notifier or something like that). So far the data people gathered reverse-engineering AlienFX is quite rich, not to mention your project. The code I had was barely working, and it had a file for keyboard spawned in /sys. I could echo a value to it and it would switch the color to that value. The problem is mostly in me being unaware of the capabilities and things like programs and even blinking stuff alienFX has. If I could get the full spec for what we can do with it, I could design a set of files and a library to take advantage of those files to program AlienFX just the way people do on windows, probably even better.

snshn commented 10 years ago

If you want, we could make a repo and contribute to it together... starting from that stub, over the next 10-20 years, we should get something working. We'll need a kernel driver, library and some sort of a Qt front-end to utilize that library to control the device. The hardest part is to design all the hooks and the API both driver <-> library and the public library functions.

Xqua commented 10 years ago

Well for the capabilities I've reverse engineered all those build in Command Center (I sniffed so many USB packets .... and went through all the bytes xD) So if you take a look at my Python interface, you have a pretty much all the capability of Command Center :D (I think ! I haven't look at Windows in a while XD)

So much of what you want to do is already there ! The real thing that needs to be done I think is clean driver/API/server ? that can be installed in the Kernel by default (push it to the linux team). Moreover one of the major issue I've seen so far is that the new specs for the new AlienFX protocol has changed ! So that the last Alienware computer are not compatible anymore ! That would need to be taken into consideration !

Another thing that I meant to do was a PPA on launchpad ... but seriously XD I've spent so much time on this when I meant to build the foundation for others to build upon ^^

So congrats on getting a Sys call driver already ^^

Now if you want to learn the hooks dive into my python code ! It has most of thems ! The basic idea is that you have a series of packets which are send to the controler, opening ones then configurations, then close and save or execute. The rest is packet creation and sending.

If you need help diving into my code I'll try to answer asap !

snshn commented 10 years ago

Tanks, man. I created the https://github.com/zzyzx/alienfx repo under my organization's name. I'll try to get more people aboard as they get interested. You're welcome to join whenever you get time, thanks for all the help once again man, talk to you soon!

Xqua commented 10 years ago

Hey man,

I'm watching the repo, but I just want to know, why QT5 GUI?

On 13/06/2014 13:17, ... wrote:

Tanks, man. I created the https://github.com/zzyzx/alienfx repo under my organization's name. I'll try to get more people aboard as they get interested. You're welcome to join whenever you get time, thanks for all the help once again man, talk to you soon!

— Reply to this email directly or view it on GitHub https://github.com/Xqua/pyAlienFX/issues/1#issuecomment-46036835.

snshn commented 10 years ago

Hey there!

Qt is something I can accomplish by myself, or with little help. I never worked with GTK interfaces, so Qt5 is just a guess for now. The project is not even in a state of embryo at the moment anyway, Qt6 will probably come out by the time I'm finished with the kernel part. Maybe I could aim at porting your code to use as GUI for it? That will save time and effort...

Xqua commented 10 years ago

Ok, then !

If you get a driver that works for most Alienware machines then I'll port my GTK interface to it ! It would avoid the sudo problem (right now you need root access to write on a USB)

Moreover, it is under CC-By-NC-SA so ... as long as you release your code under the same licence you can port fork crush cut past copy modify delete rename etc my code ^^

On 17/06/2014 08:38, ... wrote:

Hey there!

Qt is something I can accomplish by myself, or with little help. I never worked with GTK interfaces, so Qt5 is just a guess for now. The project is not even in a state of embryo at the moment anyway, Qt6 will probably come out by the time I'm finished with the kernel part. Maybe I could aim at porting your code to use as GUI for it? That will save time and effort...

— Reply to this email directly or view it on GitHub https://github.com/Xqua/pyAlienFX/issues/1#issuecomment-46300890.

snshn commented 10 years ago

Sure, sounds good, man, thanks a lot! Could you please refer me to a description of this license? I'll include it in the repo I got so in the future we'll have the same license for both UI and the driver?

LightHash commented 10 years ago

the colors are r g b alpha. so red is FF 00 00 FF green 00 FF 00 FF blue 00 00 FF FF white FF FF FF FF black 00 00 00 00 its hex

On Tue, Jun 17, 2014 at 9:57 PM, ... notifications@github.com wrote:

Sure, sounds good, man, thanks a lot! Could you please refer me to a description of this license? I'll include it in the repo I got so in the future we'll have the same license for both UI and the driver?

— Reply to this email directly or view it on GitHub https://github.com/Xqua/pyAlienFX/issues/1#issuecomment-46350014.

LightHash commented 10 years ago

i dont rly remember either its been a long time.

On Tue, Jul 8, 2014 at 1:46 AM, Light Hash lighthash@gmail.com wrote:

the colors are r g b alpha. so red is FF 00 00 FF green 00 FF 00 FF blue 00 00 FF FF white FF FF FF FF black 00 00 00 00 its hex

On Tue, Jun 17, 2014 at 9:57 PM, ... notifications@github.com wrote:

Sure, sounds good, man, thanks a lot! Could you please refer me to a description of this license? I'll include it in the repo I got so in the future we'll have the same license for both UI and the driver?

— Reply to this email directly or view it on GitHub https://github.com/Xqua/pyAlienFX/issues/1#issuecomment-46350014.

snshn commented 10 years ago

Thanks! I should probably convert my color to the grayscale equivalent and apply it to the 4th value That way my keyboard will look even more badass.