Coder Social home page Coder Social logo

buzzio's People

Contributors

bbeardsley avatar trascen avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

buzzio's Issues

new BuzzHandsetFinder().FindHandsets() does not update when removing controller

Original issue:
new BuzzHandsetFinder().FindHandsets() still found controllers even if they were detached in the meanwhile.

Background:
I had an issue with my game when no controllers were connected. So I added a "rescan for controllers" feature in order to be able to detect controllers that were connected to the PC recently. For testing purposes, I started without a controller. After attaching the controller, the newly attached controller was found. After removing the controller, I pressed the rescan button again, but the controller still appeared.

Source Code:
I looked at BuzzHandsetDevice.cs, FindBuzzHandsets(), which does not use caching. Also, HIDDevice.cs, FindDevices() does not seem to use caching. So I expected a problem somewhere in my code. I wrote the following minimal example - but its output confuses me even more.

using System;
using System.Linq;
using System.Threading;
using BuzzIO;

namespace ControllerScanTest
{
    class Program
    {
        static void Main()
        {
            while (true)
            {
                var h = new BuzzHandsetFinder().FindHandsets();
                Console.WriteLine(h.Count());
                Thread.Sleep(2000);
            }
        }
    }
}

Output:

0
0
0
1
0
0
0
0
1
0
0

The output is just 1 when I insert the controller. Even when I leave it connected, the next loop it returns 0. That's the opposite of what I found out in my game.

Another try:
I saw that HIDDevice is disposable. BuzzHandsetDevice inherits from HIDDevice, is it's also disposable. However, from the interface we get back from FindHandsets(), it's not possible to dispose the objects.

Adding the following code inside the loop results in exceptions:

                foreach (var device in h)
                {
                    ((HIDDevice) device)?.Dispose();
                }

Question:
What is the correct way to rescan for controllers?

Licence?

What licence is BuzzIO under? I'm particularly interested in the HID code...

Windows 10 Error

Hello,

I have problem with the buzzers on Windows 10.

I have this message error
error qr

CreateFile returns Handle -1

Hi,

The device path is detected, but the Initialise function of HIDDevice.cs the CreateFile function returns -1 as handle. The controllers work fine in the Windows control panel.

image

I'm using Visual Studio Community 2015 and the latest version of the code.
My system is Windows 10 64 bit.

Kind regards,
Bert

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.