Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Aurora R6 1.0.23 Support Broken & Crashing Zone Scanner #98

Open
lilithium-hydride opened this issue Dec 5, 2021 · 6 comments
Open

Comments

@lilithium-hydride
Copy link

1. Expected behavior.

  • Alienware Aurora works as per the device list
  • Zone scanner does not crash

2. Actual behavior.

  • alienfx claims to not support the device.
  • Allowing the zone scanner to run produces an error on line 134 of core/zonescanner.py, stating that 'NoneType' object is not iterable.

3. Steps to reproduce the problem.

  • Execute alienfx

4. Specifications like the version of the project, install method, operating system, and hardware.

  • Project Version: Latest from master, as well as the currently out-of-date AUR version (2.3.4-1)
  • Operating System: Artix Linux
  • Hardware Version: Alienware Aurora R6 1.0.23
@Ocean572
Copy link

Ocean572 commented Jan 4, 2023

I am having this same problem

sudo alienfx
You are running alienfx under Python-Version: 3.10.6 (main, Nov 14 2022, 16:10:14) [GCC 11.3.0]
ERROR:root:No Alien FX controller, defined by a supported model, found!
would you like to perform a zonescan? (y/n):y
Performing zonescan...
Welcome. This will help you to scan for alienfx-controllers and their lighting zones.
Traceback (most recent call last):
File "/usr/local/bin/alienfx", line 33, in
sys.exit(load_entry_point('alienfx==2.4.0', 'console_scripts', 'alienfx')())
File "/usr/local/lib/python3.10/dist-packages/alienfx-2.4.0-py3.10.egg/alienfx/ui/console/main.py", line 81, in start
File "/usr/local/lib/python3.10/dist-packages/alienfx-2.4.0-py3.10.egg/alienfx/ui/console/main.py", line 64, in doZonescan
File "/usr/local/lib/python3.10/dist-packages/alienfx-2.4.0-py3.10.egg/alienfx/core/zonescanner.py", line 134, in scan
TypeError: 'NoneType' object is not iterable

@Ocean572
Copy link

Ocean572 commented Jan 4, 2023

Did you fix this?

@lilithium-hydride
Copy link
Author

Nope, I just gave up and decided my colors would have to remain as they had always been and took it as another lesson in why languages should have strong types checked before runtime.

@Ocean572
Copy link

Ocean572 commented Jan 6, 2023

Hopefully, this is fixed soon. Should we provide any more information to fix this bug? I am running Ubuntu 22.04.1 LTS.

Alienware Alienware Aurora R6
Intel® Core™ i7-7700 CPU @ 3.60GHz × 8
Mesa Intel® HD Graphics 630 (KBL GT2) / NV134

@Ocean572
Copy link

Ocean572 commented Mar 22, 2023

Here is updated code that allows zonescanner to run. However, running "lsusb" does not display alienware controller. it is unable to find the device.

`
from alienfx.core.prober import AlienFXProber
from builtins import str,hex
import alienfx.core.controller as alienfx_controller
import os
import sys
import logging

class Zonescanner:
def init(self, vendorid):
self.vendorid=vendorid
self.maxzone=0x8000 # Greatest possible zone address
self.blinkcolor=[0xF, 0xF, 0xF] # In which color should the zones blink while searching?
self.staticcolor=[0xF, 0xF, 0xF] # In which color should the zones light, when zone is found?
self.speed = 200 # Which speed (for loop/blink) should be used?
# self.slot1command = [2, 8, 1, 0, 0, 0, 0, 0, 0]
self.zonesfound = {} # A Dictionary of all zones found

def askuser(self, question):
    while "Your answer was invalid.":
        # Python 2.x => raw_input / python 3.x => input
        if sys.version_info < (3, 0):
            # Python 2.x
            reply = raw_input((question + ' (y/n): ').lower().strip())
        else:
            # Python 3.x
            reply = input((question + ' (y/n): ').lower().strip())
        if reply.__len__() > 0:
            if reply[0] == 'y':
                return True
            if reply[0] == 'n':
                return False

def askzonename(self):
    question = "Please enter a name for this zone."
    # Python 2.x => raw_input / python 3.x => input
    if sys.version_info < (3, 0):
        # Python 2.x
        reply = raw_input((question + ' : ').lower().strip())
    else:
        # Python 3.x
        reply = input((question + ' : ').lower().strip())
    if reply.__len__() > 0:
        return reply.lower().strip()

def scanzone(self, zone, controllertype, vid, pid):
    myctr=alienfx_controller.AlienFXController(controllertype)

    myctr.vendor_id = vid
    myctr.product_id = pid
    myctr.reset_types = {3: 'all-lights-off', 4: 'all-lights-on'}

    try:
        # Make controller ready
        myctr._driver.acquire()
        myctr._ping()
        myctr._reset('all-lights-off')
        myctr._wait_controller_ready()

        # Make commands
        cmds = []

        # Set current zone to color white blink for initial (boot) state...

        # Step 1: Set things first
        # cmds.append(self.slot1command)  # Save to Slot 1
        cmds.append(myctr.cmd_packet.make_cmd_save_next(1))  # Save next to Slot 1 (boot)
        cmds.append(myctr.cmd_packet.make_cmd_set_blink_colour(1, zone, self.blinkcolor))
        cmds.append(myctr.cmd_packet.make_cmd_save_next(1))  # Save next to Slot 1 (boot)
        cmds.append(myctr.cmd_packet.make_cmd_loop_block_end())  # loop
        cmds.append(myctr.cmd_packet.make_cmd_save())  # save permanent
        myctr._send_cmds(cmds)

        # Step 2: Set speed
        cmds = []
        cmds.append(myctr.cmd_packet.make_cmd_set_speed(self.speed))  # Set speed
        myctr._send_cmds(cmds)

        # Step 3: Set things again, as we are setting for zone 1 (boot)
        cmds = []
        cmds.append(myctr.cmd_packet.make_cmd_set_blink_colour(1, zone, [0xF, 0xF, 0xF]))
        cmds.append(myctr.cmd_packet.make_cmd_loop_block_end())  # loop
        cmds.append([2, 3, 2, 255, 130, 16, 0, 0, 0, 0])  # Don't know exactly what this does... 2,3,2 setting color for second sequence or something like that...
        cmds.append(myctr.cmd_packet.make_cmd_loop_block_end())  # loop
        myctr._send_cmds(cmds)

        # Step 4: Set the execute command.
        cmds = []
        cmds.append(myctr.cmd_packet.make_cmd_transmit_execute())  # Execute...
        myctr._send_cmds(cmds)

    except:
        logging.error("Error while testing current zone...")

    finally:
        myctr._driver.release()
    if self.askuser("Is anything blinking now?"):
        # User saw something blinking
        return True
    return False

def scan(self):
    print("Welcome. This will help you to scan for alienfx-controllers and their lighting zones.")
    afxcontroldevs=AlienFXProber.find_controllers(self.vendorid)  # Get a list of all usb-devices with the given vendor-id
    if afxcontroldevs is not None:
        for controller in afxcontroldevs:
            # Perform zone scanning for each controller found...
            zone = 1  # initial zone from which we start iterating
            vendorstring = "0x" + format(controller.idVendor, '04x')
            devicestring = "0x" + format(controller.idProduct, '04x')
            print("Found device \""+vendorstring + " / " + devicestring + "\". ")
        if self.askuser("Would you like to test a newer controller? Default=Y\r\n"
                        "Note that choosing a wrong controller will result in packet-errors.\r\n"
                        "In this case you might choose another one instead."):
            crev=2  # newer controller revision
        else:
            crev=1  # old controller revision
        print("- Testing zones...")
        while zone <= self.maxzone:
            # Iterate all possible zone codes (have a look at reverse-engineering-knowledgebase.txt for possible codes...)
            print("Testing zone \"0x"+format(zone, '04x')+"\"")
            if self.scanzone(zone, crev, controller.idVendor, controller.idProduct):
                # Zone found
                print("Zone found :)")
                # Ask user for a name, store name and zonecode
                zonename = self.askzonename()
                self.zonesfound[zonename] = zone  # Store name an zone code in Dictionary
            zone = zone*2
        print("")
        print("These are your " + str(len(self.zonesfound.items())) + " zonecodes for the current controller (\"VID: "+vendorstring + " / DEV: " + devicestring + "\"):")
        for z in self.zonesfound.items():
            print(z[0]+": 0x"+format(z[1], '04x'))  # Print out each zone found
        print("")
        print("Current controller finished.")

    print("All controllers done. I hope this was helpful.")

`

@Ocean572
Copy link

My real issue is that alienware controller is not even being recognized in ubuntu 22.04. Someone please help me fix this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants