Code Monkey home page Code Monkey logo

Comments (3)

joeslazaro avatar joeslazaro commented on August 19, 2024

I looked further at the lsusb output, and found that the interface number that I needed (0) corresponds to the entry where bInterfaceClass = 1 Audio && bInterfaceSubClass = 1 Control Device

joe@ironforge:~/Projects/HeadsetControl-g430$ lsusb -d 046d: -v

Bus 003 Device 008: ID 046d:0a4d Logitech, Inc. G430 Surround Sound Gaming Headset
Device Descriptor:
  bLength                18
  bDescriptorType         1
  bcdUSB               1.10
  bDeviceClass            0 (Defined at Interface level)
  bDeviceSubClass         0 
  bDeviceProtocol         0 
  bMaxPacketSize0        16
  idVendor           0x046d Logitech, Inc.
  idProduct          0x0a4d G430 Surround Sound Gaming Headset
  bcdDevice            1.20
  iManufacturer           1 Logitech
  iProduct                2 Logitech G430 Gaming Headset
  iSerial                 0 
  bNumConfigurations      1
  Configuration Descriptor:
    bLength                 9
    bDescriptorType         2
    wTotalLength          253
    bNumInterfaces          4
    bConfigurationValue     1
    iConfiguration          0 
    bmAttributes         0x80
      (Bus Powered)
    MaxPower              100mA
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        0
      bAlternateSetting       0
      bNumEndpoints           0
      bInterfaceClass         1 Audio
      bInterfaceSubClass      1 Control Device
      bInterfaceProtocol      0 
      iInterface              0 
...

from headsetcontrol.

Sapd avatar Sapd commented on August 19, 2024

That explains why it works on Mac.
On Mac claiming a device is not needed and not even possible when it's already claimed (which it usually is).

I think when I looked into some other device, it also had a different id.

Instead of using a define, we could make a new struct with information for a device:

// vendor is needed multiple times, so we can define it here
#define VENDOR_LOGITECH 0x046d

struct device {
    uint16_t idVendor;
    uint16_t idProduct;

    int interfaceNumber;
}

// and then initialize every "device" with static initialization
struct device device_g930 = { .idVendor = VENDOR_LOGITECH, .idProduct = 0x0a1f, .interfaceNumber = 3};

On another commit, we could even insert a function pointer into the struct, so we don't need the if switches in send_sidetone.

Such a struct could be also useful later, for having something like a bit mask with driver capabilities (e.g. I implemented locally battery information for corsair void)

from headsetcontrol.

Sapd avatar Sapd commented on August 19, 2024

See #27

from headsetcontrol.

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.