Giter Club home page Giter Club logo

Comments (16)

briankendall avatar briankendall commented on July 30, 2024

It doesn't surprise me that the device's GUID switches around. 😞 Those numbers are supposed to remain the same for a specific physical device, but Windows seems to get nearly everything wrong about how it orders controllers.

Adding a feature to devreorder that allows you to pick a device by its full instance ID would be a good idea for use cases like yours. If I have the time I'll see about adding it, though these days I barely have the time!

In the meantime, there is something you can do as a stopgap that might work. This method is what I used to reorder my controllers before I wrote devreorder:

What I did was I wrote a batch script that would run every time the system started up where it simulated unplugging and reconnecting my controllers. Since reconnecting the controller would cause it to jump up to the top of the order of DirectInput devices, it allowed me to keep everything in the right order, for the most part.

The batch script used the command devcon remove to remove any devices I wanted to move to the top of the list, then devcon rescan to force Windows to redetect and reinstall them. So you might try something like this:

devcon remove "< device instance ID of controller #4 >"
timeout /T 5
devcon rescan
devcon remove "< device instance ID of controller #3 >"
timeout /T 5
devcon rescan
devcon remove "< device instance ID of controller #2 >"
timeout /T 5
devcon rescan
devcon remove "< device instance ID of controller #1 >"
timeout /T 5
devcon rescan

You can use wildcard characters like * when writing out the device instance ID, but you might want to use the device's full ID. I'm not sure if five seconds is long enough to wait between removing and rescanning, but play around with it and see what works. If you can manage to get it to work when calling devcon remove for everything and then doing just one rescan afterwards, all the better.

The batch script needs to be run with elevated permissions. You can do this manually by running in an administrator command prompt, but if you want it to happen automatically, especially when Windows boots up, you can use a Scheduled Task with the "start a program" action and set it to run with the highest privileges.

The pitfalls of this approach though are that you're actually telling Windows to "uninstall" the devices rather than simply treating them like they were unplugged. Sometimes Windows gets into a state where it thinks it needs to reboot before the devices will work again. And sometimes it would still manage to get the devices in the wrong order. (In fact the whole reason I wrote devreorder is because I got fed up with this not working consistently!) But your use case is different than mine, so you might be able to finagle this into working for you.

I'll leave this issue open for now since the real solution would be adding support for device instance IDs to devreorder.

from devreorder.

lesliehu16 avatar lesliehu16 commented on July 30, 2024

Hi briankendall,

Thank you for this very informative reply. I tried the script that you showed. So far so good, hope they won't shuffle anymore. The only downside to that which is very minor I believe is first, I need to wait before everything is done as I placed the batch script in windows startup folder and second is the ding sound, does not sound so neat as I'm polishing a dedicated Windows just for games. But this will do for now, I will keep my eye on any update to your program. Thanks again for the remedy. :)

from devreorder.

Cyphersphere avatar Cyphersphere commented on July 30, 2024

I'm having exactly the same problem. It looks like devcon is not standard on windows anymore, but pnputil should work. Thank you Brian for the info, I think I can work around this now.

from devreorder.

SurajGupta avatar SurajGupta commented on July 30, 2024

@briankendall - This project is so awesome; well done!
I would vote for adding a feature that allows you to pick a device by its full instance ID. I too am running into the issue where multiple controllers will use the same id depending on the order in which they are turned on (my controllers use bluetooth). With the ability to specify full instance IDs, I think this problem goes away entirely. Is this a relatively straight-forward feature or more complicated? I totally get the demands of time; I've had to push so many hobby projects to the backlog. I would be happy to pay for a resource on Upwork or similar to add this feature if you thought it was a relatively low lift and could provide some guidance that I could pass along. This is a space I am completely unfamiliar with. Thank you!

from devreorder.

briankendall avatar briankendall commented on July 30, 2024

This would be a relatively straight forward feature so long as there's a reasonable way to get the full instance ID of a device given its DIDEVICEINSTANCE structure that's provided when enumerating DirectInput devices. Given that, I could set up a new format for specifying the instance ID in devreorder.ini (say putting the entry in parenthesis or something) so that it would know to compare to the instance ID. So far though I haven't found a way to get the full instance ID. There's surely a way to do it, but after some cursory searching I haven't found an answer.

from devreorder.

SurajGupta avatar SurajGupta commented on July 30, 2024

from devreorder.

briankendall avatar briankendall commented on July 30, 2024

Sounds good! I've posted a question on Stack Overflow hoping that someone there might be able to help, though I've been finding that site to be of limited usefulness lately. Do let me know if you find anything. I think that is the hardest aspect of implementing this feature.

from devreorder.

SurajGupta avatar SurajGupta commented on July 30, 2024

Thanks for posting that; I was going to start with SO! Agreed; SO isn't what it used to be. Like why was this question downvoted?? Anyways, this might still be the best place for us to start. I upvoted and when enough time has passed (I think it's 2 days) I can add a fat bounty to the question and coordinate with you on which answer you think is the best. If we don't get traction using this route then I'll look for someone on Upwork.

from devreorder.

briankendall avatar briankendall commented on July 30, 2024

I've placed a bounty on the question. Hopefully that'll get us closer to an answer. I'm not sure if it's possible to add to an existing bounty, but if it is feel free to do so.

from devreorder.

SurajGupta avatar SurajGupta commented on July 30, 2024

You beat me to it! It doesn't look like I can add another bounty. Let's monitor and reassess based on answers.

from devreorder.

briankendall avatar briankendall commented on July 30, 2024

I think I've figured out how to get at the devices' full instance ID. I'm going to try and make an experimental build of devreorder that allows ordering devices using that, but I'm insanely busy this month and I don't know when I'll have a chance to finish it. If I can't do it in the next week I might not have another chance until July. But I do intend to get to this without letting it languish much longer.

from devreorder.

SurajGupta avatar SurajGupta commented on July 30, 2024

That's great news! I sincerely appreciate all the time you are putting into this.

from devreorder.

SurajGupta avatar SurajGupta commented on July 30, 2024

Hi @briankendall ! Just checking-in to see if you've had some time to work on this?

from devreorder.

briankendall avatar briankendall commented on July 30, 2024

Thanks for checking in. Sadly I've had very little time these last couple of months to work on it. I might be able to finally get something done in August though since my schedule will be more clear.

from devreorder.

SurajGupta avatar SurajGupta commented on July 30, 2024

Appreciate it!

from devreorder.

SurajGupta avatar SurajGupta commented on July 30, 2024

Hey @briankendall - Just checking-in on this...

from devreorder.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.