Have you heard from USB yet?

The intent of this forum is to discuss my DOS TSR programs (available at http://bretjohnson.us), how they work and don't work, new/missing features, status of updates, and anything else related to them that may need to be discussed.

Have you heard from USB yet?

Postby watlers world » Sat Oct 31, 2015 12:28 pm

Happy Halloween!

Although it took me a while, I finally picked up an audio device.
I seem to remember that you wanted to see drivers for usb sound cards.
Are you close to breaking the sound barrier yet, Bret?
watlers world
 
Posts: 113
Joined: Sat Feb 04, 2012 3:08 am

Re: Have you heard from USB yet?

Postby Bret » Mon Nov 02, 2015 1:00 pm

Nope, not yet. Still working on adding USB 2.0 (EHCI) support and updating all of the existing drivers (hubs, mice, keyboards, joysticks, printers, disks). Don't have a lot of time to devote to any of it, so progress is painfully slow. I still want to add sound support someday, though.
Bret
 
Posts: 478
Joined: Fri Oct 10, 2008 3:43 am
Location: Rio Rancho, NM

Re: Have you heard from USB yet?

Postby watlers world » Mon Nov 02, 2015 4:17 pm

A tractive effort is the best way to plough a furrowed brow.
Great works produce great joy. I commend you for a job well done.
Glad to hear of your mind in gear.

The original joystick support was simply sublime.
Are there new eccentricities?

My programs have changed very little.
http://turkeys4me.byethost4.com/index.htm
Will future releases support my legacy applications?

I enjoyed reinventing the examples that you proveded for joysticks.
Now I'm a bit curious about the C-media audio device that I have acquired.
Do you think audible output could be easily produced?
watlers world
 
Posts: 113
Joined: Sat Feb 04, 2012 3:08 am

Re: Have you heard from USB yet?

Postby Bret » Tue Nov 03, 2015 5:49 am

The major additions/changes I've been making to the old drivers are adding support for EMS and DPMS memory. With an EMS or DPMS server installed, you can reduce the conventional/upper memory requirements of the drivers down to only a few kB each instead of tens of kB each. I'm also adding support for at least some touch-screen devices to the mouse driver, and CD/DVD support to the disk driver. The touch-screen support in particular may come in pretty handy for what you're doing.

The new stuff should work just fine with your programs. I've not made any major changes to the basic structure, just some "tweaking" where required.

Regarding USB sound, I think it should be possible, but it definitely wont be trivial. The problem is standards.

Fortunately, almost all of the USB audio devices (at least all that I've seen) support the USB audio standards. That's very different than, say, USB serial communications devices (like the USB-to-serial-port converter cables) which almost never follow the USB standards and therefore require a custom driver for each different manufacturer and/or model. Because USB audio devices usually follow the standards, once an audio driver is designed it should work with many/most USB audio devices.

The standards problem with audio is on the DOS side. There are several different audio standards in DOS, and the only one that even comes close to being universally accepted is SoundBlaster. Unfortunately, SoundBlaster is hardware-based (directly uses I/O ports and DMA channels) which makes it a real pain to virtualize. The I/O ports can be virtualized in a manner similar to what USBJSTIK does (which requires MS EMM386 or 386MAX), but I haven't yet investigated how to virtualize the DMA or other stuff that may be required. I'm not 100% sure, but I think the VESA audio interface standard and possibly Gravis Ultra Sound (GUS) may be software-based rather than hardware-based, and would probably be easier to implement than SoundBlaster. Unfortunately, they are not very widely accepted and therefore not very useful to DOS in general.
Bret
 
Posts: 478
Joined: Fri Oct 10, 2008 3:43 am
Location: Rio Rancho, NM

Re: Have you heard from USB yet?

Postby watlers world » Tue Nov 03, 2015 2:49 pm

I'm glad to hear of your success.
Although I do not own a touch-screen, I am touched by your thoughtfulness.
I hope that I can find a USB CD/DVD drive before the next release.

It is encouraging to know that most usb audio devices conform to a uniform standard.
Before you engineer the superhighway to universal program support, perhaps I might try my hand at activating my audio device.

I know that I should unmute the device and turn on the volume.
Do you have any recomendations for isosynchronous data transfer?
watlers world
 
Posts: 113
Joined: Sat Feb 04, 2012 3:08 am

Re: Have you heard from USB yet?

Postby Bret » Wed Nov 04, 2015 4:56 am

Unfortunately, I've not done anything yet with isochronous devices, so can't help much. The only thing I can recommend is that the data go into some kind of "rolling buffer", since you most likely won't be able to process things in real time. This is especially true in Windows, with all of the time-slicing and task-switching that goes on. It's also conceivable that you'll need to synchronize the USB bus to some kind of Windows timer, but I'm not sure exactly how Windows processes sound so don't know for sure.

I'd be interested in seeing what you come up with, since I may be able to leverage it for my programs when I get to that point. Also, like I said, I haven't actually done anything with isochronous devices yet, so it's possible that how I have the USB interface designed for isochronous transfers really doesn't work or is impractical or at least needs some tweaking. If you discover that, let me know and I'll make the necessary adjustments.
Bret
 
Posts: 478
Joined: Fri Oct 10, 2008 3:43 am
Location: Rio Rancho, NM

Re: Have you heard from USB yet?

Postby watlers world » Wed Nov 04, 2015 12:16 pm

Thank you for the help and support.
I shall have a look.
watlers world
 
Posts: 113
Joined: Sat Feb 04, 2012 3:08 am

Re: Have you heard from USB yet?

Postby watlers world » Sat Nov 14, 2015 5:49 am

386 Enhanced Mode
0FEE ptr2 pciusb64
2B9E ptr1 globaldosalloc
Install check
usbuhci installed

function GetHostHWInfo
UHCI
PCI
IRQ#: 11
Root Hub Ports: 02
No Error

function GetHostVendInfo
Vendor:8086 (Intel Corp)
Product:2412h
No Error

function GetDvcHubInfo
attached to hub 1
as device number 2
No Error

function GetDvcStatus
... not being configured ...
No Error

function getdvcvendinfo
Vendor ID:0D8C (C-Media Electronics Inc)
Product ID:013C
No Error

function GetDvcClassInfo
DeviceClass=00
DevicesubClass=00
DeviceProtocol=00
low speed flag=.
Device Protocol=0
usb version=0011
No Error

function DvcPowerInfo
device gets power via USB
Power usage=100 Miliamps
No usb ports
No Error

function FindUnRegIntf
Host Index that Device is attached to
00
Device Address
02
Interface Number
00
Alternate Interface Number
00
No Error

function FindUnRegIntf
Host Index that Device is attached to
00
Device Address
02
Interface Number
01
Alternate Interface Number
00
No Error

function FindUnRegIntf
Host Index that Device is attached to
00
Device Address
02
Interface Number
02
Alternate Interface Number
00
No Error

function FindUnRegIntf
Host Index that Device is attached to
00
Device Address
02
Interface Number
03
Alternate Interface Number
00
No Error

function GetAltIntfInfo
Interface Class=0001 (1)
Interface SubClass=0001 (1)
Interface Protocol=0000 (0)
Interface Audio speaker, microp;
Audio Ctl v1;
Alternate Interface is Selected
Interface is free
No Error

function GetAltIntfInfo
Interface Class=0001 (1)
Interface SubClass=0002 (2)
Interface Protocol=0000 (0)
Interface Audio speaker, microp;
Audio Strm v1;
Alternate Interface is Selected
Interface is free
No Error

function GetAltIntfInfo
Interface Class=0001 (1)
Interface SubClass=0002 (2)
Interface Protocol=0000 (0)
Interface Audio speaker, microp;
Audio Strm v1;
Alternate Interface is Selected
Interface is free
No Error

function GetAltIntfInfo
Interface Class=0003 (3)
Interface SubClass=0000 (0)
Interface Protocol=0000 (0)
Interface Human Interface Device (HID) keyboard, mouse
Human Intf Dvc
Alternate Interface is Selected
Interface is free
No Error


function DoControl DeviceDesRequest
65535
2
65445
No Error

interrupt AX return=0000
interrupt BX return=0010
interrupt CX return=0064
interrupt DX return=0000
DeviceDescriptor:
Length=12 (18)
DescrType=01
USBRelease Version(bcd)=0110 (272)
DvcClass=00
DvcSubClass=00
DvcProtocol=00
MaxPktSize=8
VendorID=0D8C (C-Media Electronics Inc)
ProductID=013C (316)
DeviceRelease Version(bcd)=0100 (256)
Index of Manufacturer String=0001
Index of Product String=0002 (2)
Index of Serial Number String=0000
NumConfigs=0001

function DoControl ConfigDesRequest
65535
2
65446
No Error

interrupt AX return=0000
interrupt BX return=0000
interrupt CX return=0064
interrupt DX return=0000
ConfigDescriptor:
Length=0009
DescrType=02
TotalLength=00FD (253)
NumInterfaces=04
ConfigValue(use in SetRequest)=01
Index of Configuration String=00
Configuration Attributes=0080
MaxBusPower=0032 (50 Miliamps)



After reading about USB audio devices, I can see that I have many descriptors yet to download.
Is there some way to download more than one descriptor at once?


(After some random testing...)
There are No errors after Dobulk,and sometimes even get a return response. :)
No errors for endpoint 7 DoInterruptper.
watlers world
 
Posts: 113
Joined: Sat Feb 04, 2012 3:08 am

Re: Have you heard from USB yet?

Postby watlers world » Tue Nov 17, 2015 11:25 am

I Think this is a "Complete Configuration Descriptor".
function DoControl
65535
2
65445
No Error

interrupt AX return=0000
interrupt BX return=0010
interrupt CX return=0064
interrupt DX return=0000
DeviceDescriptor:
Length=12 (18)
DescrType=01
USBRelease Version(bcd)=0110 (272)
DvcClass=00
DvcSubClass=00
DvcProtocol=00
MaxPktSize=8
VendorID=0D8C (C-Media Electronics Inc)
ProductID=013C (316)
DeviceRelease Version(bcd)=0100 (256)
Index of Manufacturer String=0001
Index of Product String=0002 (2)
Index of Serial Number String=0000
NumConfigs=0001

function DoControl
65535
2
65446
No Error

interrupt AX return=0000
interrupt BX return=0000
interrupt CX return=0064
interrupt DX return=0000
ConfigDescriptor:
Length=0009
DescrType=02
TotalLength=00FD (253)
NumInterfaces=04
ConfigValue(use in SetRequest)=01
Index of Configuration String=00
Configuration Attributes=0080
MaxBusPower=0032 (50 Miliamps)

function DoControl
interrupt AX return=0000
interrupt BX return=0000
interrupt CX return=0064
interrupt DX return=0000
ConfigDescriptor:
Length=0009
DescrType=02
TotalLength=00FD (253)
NumInterfaces=04
ConfigValue(use in SetRequest)=01
Index of Configuration String=00
Configuration Attributes=0080
MaxBusPower=0032 (50 Miliamps)

65535
2
65447
No Error

start ccfg:
1
ConfigDescriptor:
Length=0009
DescrType=02
TotalLength=00FD (253)
NumInterfaces=04
ConfigValue(use in SetRequest)=01
Index of Configuration String=00
Configuration Attributes=0080
MaxBusPower=0032 (50 Miliamps)

2
InterfaceDescriptor:
Length=0009
DescrType=04
Interface Number(0-based)=0000
AlternateSetting=00
NumEndPoints=00 (0)
InterfaceClass=01
InterfaceSubClass=01
InterfaceProtocol=0000
InterfaceIndx=00 (0)
3
Audio specfic descriptor:
DescrTypeAudioInterface
A1CIDescrSubType=A1IntfDescSTypeACHeader
Length=000A
Type=0024
DescrSubType=0001
SpecRelease=0100
TotalLength=0064
NumIntf=0002
ACIIntfNum1=0001
ACIIntfNum2=0002
4
Audio specfic descriptor:
DescrTypeAudioInterface
A1CIDescrSubType=A1IntfDescSTypeACInTerm
Length=000C
Type=0024
DescrSubType=0002
A1ITTerminalID=0001
A1ITTerminalType=0101
A1ITAssocOutTerm=0000
A1ITNumOutChans=0002
A1ITSpatial=0003
A1ITChanNameStr=0000
A1ITTermStr=0000
5
Audio specfic descriptor:
DescrTypeAudioInterface
A1CIDescrSubType=A1IntfDescSTypeACInTerm
Length=000C
Type=0024
DescrSubType=0002
A1ITTerminalID=0002
A1ITTerminalType=0201
A1ITAssocOutTerm=0000
A1ITNumOutChans=0001
A1ITSpatial=0001
A1ITChanNameStr=0000
A1ITTermStr=0000
6
Audio specfic descriptor:
DescrTypeAudioInterface
A1CIDescrSubType=A1IntfDescSTypeACOutTerm
Length=0009
Type=0024
DescrSubType=0003
A1ITTerminalID=0006
A1ITTerminalType=0301
A1ITAssocInTerm=0000
A1OTSourceID=0009
A1OTTermStr=0000
7
Audio specfic descriptor:
DescrTypeAudioInterface
A1CIDescrSubType=A1IntfDescSTypeACOutTerm
Length=0009
Type=0024
DescrSubType=0003
A1ITTerminalID=0007
A1ITTerminalType=0101
A1ITAssocInTerm=0000
A1OTSourceID=0008
A1OTTermStr=0000
8
Audio specfic descriptor:
DescrTypeAudioInterface
A1CIDescrSubType=A1IntfDescSTypeACSelUnit
Length=0007
Type=0024
DescrSubType=0005
A1SUUnitID=0008
A1SUNumInPins=0001
A1SUSourceID1=000A
A1SUSourceIDP=0000
A1SUUnitStr=000A
9
Audio specfic descriptor:
DescrTypeAudioInterface
A1CIDescrSubType=A1IntfDescSTypeACFtrUnit
Length=000A
Type=0024
DescrSubType=0006
A1FUUnitID=0009
A1FUSourceID=000F
A1FUControlSize=0001
ctls=3
control number 0
Mute
control number 1
Volume
control number 2
Volume
A1FUUnitStr=0002
10
Audio specfic descriptor:
DescrTypeAudioInterface
A1CIDescrSubType=A1IntfDescSTypeACFtrUnit
Length=0009
Type=0024
DescrSubType=0006
A1FUUnitID=000A
A1FUSourceID=0002
A1FUControlSize=0001
ctls=2
control number 0
Mute
Volume
Automatic Gain
control number 1
A1FUUnitStr=0000
11
Audio specfic descriptor:
DescrTypeAudioInterface
A1CIDescrSubType=A1IntfDescSTypeACFtrUnit
Length=0009
Type=0024
DescrSubType=0006
A1FUUnitID=000D
A1FUSourceID=0002
A1FUControlSize=0001
ctls=2
control number 0
Mute
Volume
control number 1
A1FUUnitStr=0000
12
Audio specfic descriptor:
DescrTypeAudioInterface
A1CIDescrSubType=A1IntfDescSTypeACMixUnit
Length=000D
Type=0024
DescrSubType=0004
A1MUUnitID=000F
A1MUNumInPins=0002
A1MUSourceID1=0001
A1MUNumOutChans=0002
A1MUSpatial=0003
A1MUChanStr=0000
A1MUPrgControls=0000
A1MUUnitStr=0000
13
InterfaceDescriptor:
Length=0009
DescrType=04
Interface Number(0-based)=0001
AlternateSetting=00
NumEndPoints=00 (0)
InterfaceClass=01
InterfaceSubClass=02
InterfaceProtocol=0000
InterfaceIndx=00 (0)
14
InterfaceDescriptor:
Length=0009
DescrType=04
Interface Number(0-based)=0001
AlternateSetting=01
NumEndPoints=01 (1)
InterfaceClass=01
InterfaceSubClass=02
InterfaceProtocol=0000
InterfaceIndx=00 (0)
15
Audio specfic descriptor:
DescrTypeAudioInterface
A1CIDescrSubType=A1IntfDescSTypeACHeader
Length=0007
Type=0024
DescrSubType=0001
SpecRelease=0101
TotalLength=0001
NumIntf=000E
ACIIntfNum1=0024
ACIIntfNum2=0002
16
Audio specfic descriptor:
DescrTypeAudioInterface
A1CIDescrSubType=A1IntfDescSTypeACInTerm
Length=000E
Type=0024
DescrSubType=0002
A1ITTerminalID=0001
A1ITTerminalType=0202
A1ITAssocOutTerm=0010
A1ITNumOutChans=0002
A1ITSpatial=BB80
A1ITChanNameStr=0000
A1ITTermStr=0044
17
EndpointDescriptor:
Length=0009
DescrType=05
EndPoint Number EPs)(0-15)=0001
EndPoint attributes=09
Max Packet Size EndPoint can handle=C8 (200)
Polling Interval for Data Transfers=01
Refresh Rate(0-9)=00
Synchronization EndPoint=0000
18
Audio specfic descriptor:
DescrTypeAudioEndPoint
Length=0007
Type=0025
A1EPAttribs=0001
Sampling Frequency is Supported!
A1EPLockDelayUnit=0001
A1EPLockDelay=0001
19
InterfaceDescriptor:
Length=0009
DescrType=04
Interface Number(0-based)=0002
AlternateSetting=00
NumEndPoints=00 (0)
InterfaceClass=01
InterfaceSubClass=02
InterfaceProtocol=0000
InterfaceIndx=00 (0)
20
InterfaceDescriptor:
Length=0009
DescrType=04
Interface Number(0-based)=0002
AlternateSetting=01
NumEndPoints=01 (1)
InterfaceClass=01
InterfaceSubClass=02
InterfaceProtocol=0000
InterfaceIndx=00 (0)
21
Audio specfic descriptor:
DescrTypeAudioInterface
A1CIDescrSubType=A1IntfDescSTypeACHeader
Length=0007
Type=0024
DescrSubType=0001
SpecRelease=0107
TotalLength=0001
NumIntf=000E
ACIIntfNum1=0024
ACIIntfNum2=0002
22
Audio specfic descriptor:
DescrTypeAudioInterface
A1CIDescrSubType=A1IntfDescSTypeACInTerm
Length=000E
Type=0024
DescrSubType=0002
A1ITTerminalID=0001
A1ITTerminalType=0201
A1ITAssocOutTerm=0010
A1ITNumOutChans=0002
A1ITSpatial=BB80
A1ITChanNameStr=0000
A1ITTermStr=0044
23
EndpointDescriptor:
Length=0009
DescrType=05
EndPoint Number EPs)(0-15)=0082
EndPoint attributes=09
Max Packet Size EndPoint can handle=64 (100)
Polling Interval for Data Transfers=01
Refresh Rate(0-9)=00
Synchronization EndPoint=0000
24
Audio specfic descriptor:
DescrTypeAudioEndPoint
Length=0007
Type=0025
A1EPAttribs=0001
Sampling Frequency is Supported!
A1EPLockDelayUnit=0000
A1EPLockDelay=0000
25
InterfaceDescriptor:
Length=0009
DescrType=04
Interface Number(0-based)=0003
AlternateSetting=00
NumEndPoints=01 (1)
InterfaceClass=03
InterfaceSubClass=00
InterfaceProtocol=0000
InterfaceIndx=00 (0)
26
Audio specfic descriptor:
DescrTypeAudioDevice
27
EndpointDescriptor:
Length=0007
DescrType=05
EndPoint Number EPs)(0-15)=0087
EndPoint attributes=03
Max Packet Size EndPoint can handle=04 (4)
Polling Interval for Data Transfers=02
Refresh Rate(0-9)=00
Synchronization EndPoint=0000
:end ccfg

Are the last three are seen as an Audio specfic subset or a seperate interface?
watlers world
 
Posts: 113
Joined: Sat Feb 04, 2012 3:08 am

Re: Have you heard from USB yet?

Postby Bret » Tue Nov 17, 2015 2:52 pm

I'm not real sure how the audio stuff works in USB -- I've never written a driver for it before. I just it's complicated and confusing to have to interpret all of those descriptors and figure out the relationships between them. I'm not going to be much help for you from this point on, I'm afraid.

But, it does follow the USB audio standard and provides all of the descriptors you need to figure things out.
Bret
 
Posts: 478
Joined: Fri Oct 10, 2008 3:43 am
Location: Rio Rancho, NM

Re: Have you heard from USB yet?

Postby wimpie » Tue Nov 17, 2015 11:08 pm

Hi. About 2 years ago I tried Bret's drivers with my sonix usb pc camera and I got it basically working. See the "Logitech C250 camera has too long descriptors" thread. I have a usb cmedia sound adapter with idVendor:IdProduct=0d8c:000c which is quite similar to yours and which is already working on OS/2. Seeing your posts I decided to try it with Bret's drivers and now I got it basically working too i.e. the isochronous transfers host-to-device and device-to-host do work.
I Think this is a "Complete Configuration Descriptor".

Yes it is. However, the decoding of some descriptors is not correct. It supports 48000 and 44100 Hz. See output from lsusb for your device:

Code: Select all
Bus 001 Device 004: ID 0d8c:013c C-Media Electronics, Inc.
Device Descriptor:
  bLength                18
  bDescriptorType         1
  bcdUSB               1.10
  bDeviceClass            0 (Defined at Interface level)
  bDeviceSubClass         0
  bDeviceProtocol         0
  bMaxPacketSize0         8
  idVendor           0x0d8c C-Media Electronics, Inc.
  idProduct          0x013c
  bcdDevice            1.00
  iManufacturer           1 C-Media Electronics Inc.
  iProduct                2 USB PnP Sound Device
  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
      AudioControl Interface Descriptor:
        bLength                10
        bDescriptorType        36
        bDescriptorSubtype      1 (HEADER)
        bcdADC               1.00
        wTotalLength          100
        bInCollection           2
        baInterfaceNr( 0)       1
        baInterfaceNr( 1)       2
      AudioControl Interface Descriptor:
        bLength                12
        bDescriptorType        36
        bDescriptorSubtype      2 (INPUT_TERMINAL)
        bTerminalID             1
        wTerminalType      0x0101 USB Streaming
        bAssocTerminal          0
        bNrChannels             2
        wChannelConfig     0x0003
          Left Front (L)
          Right Front (R)
        iChannelNames           0
        iTerminal               0
      AudioControl Interface Descriptor:
        bLength                12
        bDescriptorType        36
        bDescriptorSubtype      2 (INPUT_TERMINAL)
        bTerminalID             2
        wTerminalType      0x0201 Microphone
        bAssocTerminal          0
        bNrChannels             1
        wChannelConfig     0x0001
          Left Front (L)
        iChannelNames           0
        iTerminal               0
      AudioControl Interface Descriptor:
        bLength                 9
        bDescriptorType        36
        bDescriptorSubtype      3 (OUTPUT_TERMINAL)
        bTerminalID             6
        wTerminalType      0x0301 Speaker
        bAssocTerminal          0
        bSourceID               9
        iTerminal               0
      AudioControl Interface Descriptor:
        bLength                 9
        bDescriptorType        36
        bDescriptorSubtype      3 (OUTPUT_TERMINAL)
        bTerminalID             7
        wTerminalType      0x0101 USB Streaming
        bAssocTerminal          0
        bSourceID               8
        iTerminal               0
      AudioControl Interface Descriptor:
        bLength                 7
        bDescriptorType        36
        bDescriptorSubtype      5 (SELECTOR_UNIT)
        bUnitID                 8
        bNrInPins               1
        baSource( 0)           10
        iSelector               0
      AudioControl Interface Descriptor:
        bLength                10
        bDescriptorType        36
        bDescriptorSubtype      6 (FEATURE_UNIT)
        bUnitID                 9
        bSourceID              15
        bControlSize            1
        bmaControls( 0)      0x01
          Mute Control
        bmaControls( 1)      0x02
          Volume Control
        bmaControls( 2)      0x02
          Volume Control
        iFeature                0
      AudioControl Interface Descriptor:
        bLength                 9
        bDescriptorType        36
        bDescriptorSubtype      6 (FEATURE_UNIT)
        bUnitID                10
        bSourceID               2
        bControlSize            1
        bmaControls( 0)      0x43
          Mute Control
          Volume Control
          Automatic Gain Control
        bmaControls( 1)      0x00
        iFeature                0
      AudioControl Interface Descriptor:
        bLength                 9
        bDescriptorType        36
        bDescriptorSubtype      6 (FEATURE_UNIT)
        bUnitID                13
        bSourceID               2
        bControlSize            1
        bmaControls( 0)      0x03
          Mute Control
          Volume Control
        bmaControls( 1)      0x00
        iFeature                0
      AudioControl Interface Descriptor:
        bLength                13
        bDescriptorType        36
        bDescriptorSubtype      4 (MIXER_UNIT)
        bUnitID                15
        bNrInPins               2
        baSourceID( 0)          1
        baSourceID( 1)         13
        bNrChannels             2
        wChannelConfig     0x0003
         Left Front (L)
          Right Front (R)
        iChannelNames           0
        bmControls         0x00
        iMixer                  0
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        1
      bAlternateSetting       0
      bNumEndpoints           0
      bInterfaceClass         1 Audio
      bInterfaceSubClass      2 Streaming
      bInterfaceProtocol      0
      iInterface              0
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        1
      bAlternateSetting       1
      bNumEndpoints           1
      bInterfaceClass         1 Audio
      bInterfaceSubClass      2 Streaming
      bInterfaceProtocol      0
      iInterface              0
      AudioStreaming Interface Descriptor:
        bLength                 7
        bDescriptorType        36
        bDescriptorSubtype      1 (AS_GENERAL)
        bTerminalLink           1
        bDelay                  1 frames
        wFormatTag              1 PCM
      AudioStreaming Interface Descriptor:
        bLength                14
        bDescriptorType        36
        bDescriptorSubtype      2 (FORMAT_TYPE)
        bFormatType             1 (FORMAT_TYPE_I)
        bNrChannels             2
        bSubframeSize           2
        bBitResolution         16
        bSamFreqType            2 Discrete
        tSamFreq[ 0]        48000
        tSamFreq[ 1]        44100
      Endpoint Descriptor:
        bLength                 9
        bDescriptorType         5
        bEndpointAddress     0x01  EP 1 OUT
        bmAttributes            9
          Transfer Type            Isochronous
          Synch Type               Adaptive
          Usage Type               Data
        wMaxPacketSize     0x00c8  1x 200 bytes
        bInterval               1
        bRefresh                0
        bSynchAddress           0
        AudioControl Endpoint Descriptor:
          bLength                 7
          bDescriptorType        37
          bDescriptorSubtype      1 (EP_GENERAL)
          bmAttributes         0x01
            Sampling Frequency
          bLockDelayUnits         1 Milliseconds
          wLockDelay              1 Milliseconds
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        2
      bAlternateSetting       0
      bNumEndpoints           0
      bInterfaceClass         1 Audio
      bInterfaceSubClass      2 Streaming
      bInterfaceProtocol      0
      iInterface              0
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        2
      bAlternateSetting       1
      bNumEndpoints           1
      bInterfaceClass         1 Audio
      bInterfaceSubClass      2 Streaming
      bInterfaceProtocol      0
      iInterface              0
      AudioStreaming Interface Descriptor:
        bLength                 7
        bDescriptorType        36
        bDescriptorSubtype      1 (AS_GENERAL)
        bTerminalLink           7
        bDelay                  1 frames
        wFormatTag              1 PCM
      AudioStreaming Interface Descriptor:
        bLength                14
        bDescriptorType        36
        bDescriptorSubtype      2 (FORMAT_TYPE)
        bFormatType             1 (FORMAT_TYPE_I)
        bNrChannels             1
        bSubframeSize           2
        bBitResolution         16
        bSamFreqType            2 Discrete
        tSamFreq[ 0]        48000
        tSamFreq[ 1]        44100
      Endpoint Descriptor:
        bLength                 9
        bDescriptorType         5
        bEndpointAddress     0x82  EP 2 IN
        bmAttributes            9
          Transfer Type            Isochronous
          Synch Type               Adaptive
          Usage Type               Data
        wMaxPacketSize     0x0064  1x 100 bytes
        bInterval               1
        bRefresh                0
        bSynchAddress           0
        AudioControl Endpoint Descriptor:
          bLength                 7
          bDescriptorType        37
          bDescriptorSubtype      1 (EP_GENERAL)
          bmAttributes         0x01
            Sampling Frequency
          bLockDelayUnits         0 Undefined
          wLockDelay              0 Undefined
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        3
      bAlternateSetting       0
      bNumEndpoints           1
      bInterfaceClass         3 Human Interface Device
      bInterfaceSubClass      0 No Subclass
      bInterfaceProtocol      0 None
      iInterface              0
        HID Device Descriptor:
          bLength                 9
          bDescriptorType        33
          bcdHID               1.00
          bCountryCode            0 Not supported
          bNumDescriptors         1
          bDescriptorType        34 Report
          wDescriptorLength      60
         Report Descriptors:
           ** UNAVAILABLE **
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x87  EP 7 IN
        bmAttributes            3
          Transfer Type            Interrupt
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0004  1x 4 bytes
        bInterval               2
Device Status:     0x0000
  (Bus Powered)

Are the last three are seen as an Audio specfic subset or a seperate interface?

These describe a separate HID class interface with interrupt in endpoint 87h. I am not using this.

Wim.
wimpie
 
Posts: 11
Joined: Fri Nov 20, 2009 11:52 pm

Re: Have you heard from USB yet?

Postby Bret » Wed Nov 18, 2015 4:54 am

The HID interface is probably for volume control.
Bret
 
Posts: 478
Joined: Fri Oct 10, 2008 3:43 am
Location: Rio Rancho, NM

Re: Have you heard from USB yet?

Postby watlers world » Thu Nov 19, 2015 11:08 am

Well, that was a mess. :?
I will try to make use of that extra sub type data.

start ccfg:

1
ConfigDescriptor:
Length=0009
DescrType=02
TotalLength=00FD (253)
NumInterfaces=04
ConfigValue(use in SetRequest)=01
Index of Configuration String=00
Configuration Attributes=0080
MaxBusPower=0032 (50 Miliamps)


2
InterfaceDescriptor:
Length=0009
DescrType=04
Interface Number(0-based)=0000
AlternateSetting=00
NumEndPoints=00 (0)
InterfaceClass=01
InterfaceSubClass=01
InterfaceProtocol=0000
Interface Audio speaker,microphone;
Audio, Control v1;
InterfaceIndx=00 (0)


3
0001Audio specfic descriptor:
SUB:AuDiO CoNtRoLe
DescrTypeAudioInterface
A1CIDescrSubType=A1IntfDescSTypeACHeader
Length=000A
Type=0024
DescrSubType=0001
SpecRelease=0100
TotalLength=0064
NumIntf=0002
ACIIntfNum1=0001
ACIIntfNum2=0002
This Audio Header ends at 118


4
0001Audio specfic descriptor:
SUB:AuDiO CoNtRoLe
DescrTypeAudioInterface
A1CIDescrSubType=A1IntfDescSTypeACInTerm
Length=000C
Type=0024
DescrSubType=0002
A1ITTerminalID=0001
A1ITTerminalType=0101
A1ITAssocOutTerm=0000
A1ITNumOutChans=0002
A1ITSpatial=0003
A1ITChanNameStr=0000
A1ITTermStr=0000

5
0001Audio specfic descriptor:
SUB:AuDiO CoNtRoLe
DescrTypeAudioInterface
A1CIDescrSubType=A1IntfDescSTypeACInTerm
Length=000C
Type=0024
DescrSubType=0002
A1ITTerminalID=0002
A1ITTerminalType=0201
A1ITAssocOutTerm=0000
A1ITNumOutChans=0001
A1ITSpatial=0001
A1ITChanNameStr=0000
A1ITTermStr=0000

6
0001Audio specfic descriptor:
SUB:AuDiO CoNtRoLe
DescrTypeAudioInterface
A1CIDescrSubType=A1IntfDescSTypeACOutTerm
Length=0009
Type=0024
DescrSubType=0003
A1ITTerminalID=0006
A1ITTerminalType=0301
A1ITAssocInTerm=0000
A1OTSourceID=0009
A1OTTermStr=0000

7
0001Audio specfic descriptor:
SUB:AuDiO CoNtRoLe
DescrTypeAudioInterface
A1CIDescrSubType=A1IntfDescSTypeACOutTerm
Length=0009
Type=0024
DescrSubType=0003
A1ITTerminalID=0007
A1ITTerminalType=0101
A1ITAssocInTerm=0000
A1OTSourceID=0008
A1OTTermStr=0000

8
0001Audio specfic descriptor:
SUB:AuDiO CoNtRoLe
DescrTypeAudioInterface
A1CIDescrSubType=A1IntfDescSTypeACSelUnit
Length=0007
Type=0024
DescrSubType=0005
A1SUUnitID=0008
A1SUNumInPins=0001
A1SUSourceID1=000A
A1SUSourceIDP=0000
A1SUUnitStr=000A

9
0001Audio specfic descriptor:
SUB:AuDiO CoNtRoLe
DescrTypeAudioInterface
A1CIDescrSubType=A1IntfDescSTypeACFtrUnit
Length=000A
Type=0024
DescrSubType=0006
A1FUUnitID=0009
A1FUSourceID=000F
A1FUControlSize=0001
ctls=3
control number 0
Mute
control number 1
Volume
control number 2
Volume
A1FUUnitStr=0002

10
0001Audio specfic descriptor:
SUB:AuDiO CoNtRoLe
DescrTypeAudioInterface
A1CIDescrSubType=A1IntfDescSTypeACFtrUnit
Length=0009
Type=0024
DescrSubType=0006
A1FUUnitID=000A
A1FUSourceID=0002
A1FUControlSize=0001
ctls=2
control number 0
Mute
Volume
Automatic Gain
control number 1
A1FUUnitStr=0000

11
0001Audio specfic descriptor:
SUB:AuDiO CoNtRoLe
DescrTypeAudioInterface
A1CIDescrSubType=A1IntfDescSTypeACFtrUnit
Length=0009
Type=0024
DescrSubType=0006
A1FUUnitID=000D
A1FUSourceID=0002
A1FUControlSize=0001
ctls=2
control number 0
Mute
Volume
control number 1
A1FUUnitStr=0000

12
0001Audio specfic descriptor:
SUB:AuDiO CoNtRoLe
DescrTypeAudioInterface
A1CIDescrSubType=A1IntfDescSTypeACMixUnit
Length=000D
Type=0024
DescrSubType=0004
A1MUUnitID=000F
A1MUNumInPins=0002
A1MUSourceID1=0001
A1MUNumOutChans=0002
A1MUSpatial=0003
A1MUChanStr=0000
A1MUPrgControls=0000
A1MUUnitStr=0000

13
End of Audio Header

InterfaceDescriptor:
Length=0009
DescrType=04
Interface Number(0-based)=0001
AlternateSetting=00
NumEndPoints=00 (0)
InterfaceClass=01
InterfaceSubClass=02
InterfaceProtocol=0000
Interface Audio speaker,microphone;
Audio, Streaming v1;
InterfaceIndx=00 (0)


14
InterfaceDescriptor:
Length=0009
DescrType=04
Interface Number(0-based)=0001
AlternateSetting=01
NumEndPoints=01 (1)
InterfaceClass=01
InterfaceSubClass=02
InterfaceProtocol=0000
Interface Audio speaker,microphone;
Audio, Streaming v1;
InterfaceIndx=00 (0)


15
0001Audio specfic descriptor:
SUB:AuDiO StReAmInG
DescrTypeAudioInterface
A1CIDescrSubType=A1IntfDescSTypeASGeneral
Length=0007
Type=0024
DescrSubType=0001
A1SITermLink =0001
A1SIDelay=0001
A1SIFormatTag=0001
PCM Pulse Code Modulation

16
0001Audio specfic descriptor:
SUB:AuDiO StReAmInG
DescrTypeAudioInterface
A1CIDescrSubType=A1IntfDescSTypeASFmtType
Length=000E
Type=0024
DescrSubType=0002
A1FT1FormatType =0001
A1FT1NumChans=0002
A1FT1SubSlotSize=0002
A1FT1Resolution=0010
A1FT1SampFreqType=0002
A1FT1SampleFreq1=$BB80 =48000
A1FT1SampleFreq2=$4400

17
EndpointDescriptor:
Length=0009
DescrType=05
EndPoint Number EPs)(0-15)=0001
EndPoint attributes=09
Max Packet Size EndPoint can handle=C8 (200)
Polling Interval for Data Transfers=01
Refresh Rate(0-9)=00
Synchronization EndPoint=0000

18
0001Audio specfic descriptor:
SUB:AuDiO StReAmInG
DescrTypeAudioEndPoint
Length=0007
Type=0025
A1EPAttribs=0001
Sampling Frequency is Supported!
A1EPLockDelayUnit=0001
A1EPLockDelay=0001

19
InterfaceDescriptor:
Length=0009
DescrType=04
Interface Number(0-based)=0002
AlternateSetting=00
NumEndPoints=00 (0)
InterfaceClass=01
InterfaceSubClass=02
InterfaceProtocol=0000
Interface Audio speaker,microphone;
Audio, Streaming v1;
InterfaceIndx=00 (0)


20
InterfaceDescriptor:
Length=0009
DescrType=04
Interface Number(0-based)=0002
AlternateSetting=01
NumEndPoints=01 (1)
InterfaceClass=01
InterfaceSubClass=02
InterfaceProtocol=0000
Interface Audio speaker,microphone;
Audio, Streaming v1;
InterfaceIndx=00 (0)


21
0001Audio specfic descriptor:
SUB:AuDiO StReAmInG
DescrTypeAudioInterface
A1CIDescrSubType=A1IntfDescSTypeASGeneral
Length=0007
Type=0024
DescrSubType=0001
A1SITermLink =0007
A1SIDelay=0001
A1SIFormatTag=0001
PCM Pulse Code Modulation

22
0001Audio specfic descriptor:
SUB:AuDiO StReAmInG
DescrTypeAudioInterface
A1CIDescrSubType=A1IntfDescSTypeASFmtType
Length=000E
Type=0024
DescrSubType=0002
A1FT1FormatType =0001
A1FT1NumChans=0001
A1FT1SubSlotSize=0002
A1FT1Resolution=0010
A1FT1SampFreqType=0002
A1FT1SampleFreq1=$BB80 =48000
A1FT1SampleFreq2=$4400

23
EndpointDescriptor:
Length=0009
DescrType=05
EndPoint Number EPs)(0-15)=0082
EndPoint attributes=09
Max Packet Size EndPoint can handle=64 (100)
Polling Interval for Data Transfers=01
Refresh Rate(0-9)=00
Synchronization EndPoint=0000

24
0001Audio specfic descriptor:
SUB:AuDiO StReAmInG
DescrTypeAudioEndPoint
Length=0007
Type=0025
A1EPAttribs=0001
Sampling Frequency is Supported!
A1EPLockDelayUnit=0000
A1EPLockDelay=0000

25
InterfaceDescriptor:
Length=0009
DescrType=04
Interface Number(0-based)=0003
AlternateSetting=00
NumEndPoints=01 (1)
InterfaceClass=03
InterfaceSubClass=00
InterfaceProtocol=0000
Interface Human Interface Device (HID) keyboard, mouse
Human Intf Dvc
InterfaceIndx=00 (0)


26
0003HID specfic descriptor:
HID

27
EndpointDescriptor:
Length=0007
DescrType=05
EndPoint Number EPs)(0-15)=0087
EndPoint attributes=03
Max Packet Size EndPoint can handle=04 (4)
Polling Interval for Data Transfers=02
Refresh Rate(0-9)=00
Synchronization EndPoint=0000
:end ccfg



Thanks wimpie!
Thanks Bret!
watlers world
 
Posts: 113
Joined: Sat Feb 04, 2012 3:08 am

Re: Have you heard from USB yet?

Postby watlers world » Thu Nov 19, 2015 11:27 am

Seeing all that data makes me hopeful.
Perhaps I will be able to enable the device.

After reading about audio devices, I thought the way to communicate might look somewhat like the following code.

const AUDIO_cur=$01;
const AUDIO_min=$02;
const AUDIO_max=$03;
const AUDIO_res=$04;

{Set Audio Device Report}
function SetAudioRep(UnitId:byte;CSRC:byte;CS:byte;length:byte):byte; begin
with lpProtModePtr^ do begin
{I14RSetupReqType:=$21;{byte}
I14RSetupReqType:=SRRTOut or SRRTTypeClass or SRRTRecipInterface;{byte}
I14RSetupReq:=CSRC or SRRTOut;{byte} {1 or zero for mute}
{I14RSetupValue(LSB) Channel Number}
{I14RSetupValue(MSB) Control Selector}
I14RSetupValue:=$100*CS;{word Unit Control Selectors}
I14RInterfaceNum:=0;
I14RSetupIndex:=$100*unitid;{word Desc.UnitID}
I14RSetupLength:=length;{word}{we wish to send 1 byte to the device}
end;
end;

{Get Audio Device Report}
function GetAudioRep(UnitId:byte;CSRC:byte;CS:byte;length:byte):byte; begin
with lpProtModePtr^ do begin
{I14RSetupReqType:=$A1;{byte}
I14RSetupReqType:=SRRTin or SRRTTypeClass or SRRTRecipInterface;{byte}
I14RSetupReq:=CSRC or SRRTin;{byte}
{I14RSetupValue (LSB) Channel Number}
{I14RSetupValue(MSB) Control Selector}
I14RSetupValue:=$100*CS;{word}
I14RInterfaceNum:=0;
{pFeaUnitDesc->bUnitId}
I14RSetupIndex:=$100*unitid;{word; unit to target}
I14RSetupLength:=length;{word}{we wish to get 1 byte from the device}
end;
end;
watlers world
 
Posts: 113
Joined: Sat Feb 04, 2012 3:08 am

Re: Have you heard from USB yet?

Postby wimpie » Fri Nov 20, 2015 2:55 am

I will try to make use of that extra sub type data.

I have compared it to the lsusb output and I found some minor differences:

Ad 1- I see MaxBusPower=0032 (50 Miliamps). The implied unit of measure here is 2 mA. Thus (100 Miliamps).

Ad 12 - I see A1MUSourceID1=0001 but I don't see A1MUSourceID2=000D. I am not sure but it seems to be missing.

Ad 16 - I see A1FT1SampleFreq2=$4400. I expect here to see A1FT1SampleFreq2=$AC44 =44100. It is a 3 byte value.

Ad 22 - I see A1FT1SampleFreq2=$4400. I expect here to see A1FT1SampleFreq2=$AC44 =44100. It is a 3 byte value.

Perhaps I will be able to enable the device.

I must say that I was able to produce sound with my cmedia device even without using the audio control interface at all.
Having said that I looked into the SetAudioRep() and GetAudioRep() functions and these seem to do the job.

{Channel Number is 1 or zero for mute}
{I14RSetupValue(LSB) Channel Number}
{I14RSetupValue(MSB) Control Selector}

{Interface Number is zero for the audio control interface of your device}
{I14RSetupIndex(LSB) Interface Number}
{I14RSetupIndex(MSB) Unit Identifier}
wimpie
 
Posts: 11
Joined: Fri Nov 20, 2009 11:52 pm

Re: Have you heard from USB yet?

Postby watlers world » Sat Nov 21, 2015 6:05 am

I'll try printing the descriptors again.

start ccfg:

1
ConfigDescriptor:
Length=0009
DescrType=02
TotalLength=00FD (253)
NumInterfaces=04
ConfigValue(use in SetRequest)=01
Index of Configuration String=00
Configuration Attributes=0080
MaxBusPower=0032 (50 2mA Miliamp units)

unspecified class

2
InterfaceDescriptor:
Length=0009
DescrType=04
Interface Number(0-based)=0000
AlternateSetting=00
NumEndPoints=00 (0)
InterfaceClass=01
InterfaceSubClass=01
InterfaceProtocol=0000
Interface Audio speaker,microphone;
Audio, Control v1;
InterfaceIndx=00 (0)

SUB:AuDiO CoNtRoLe

3
0001Audio specfic descriptor:
SUB:AuDiO CoNtRoLe
DescrTypeAudioInterface
A1CIDescrSubType=A1IntfDescSTypeACHeader
Length=000A
Type=0024
DescrSubType=0001
SpecRelease=0100
TotalLength=0064
NumIntf=0002
ACIIntfNum1=0001
ACIIntfNum2=0002
This Audio Header ends at 118


4
0001Audio specfic descriptor:
SUB:AuDiO CoNtRoLe
DescrTypeAudioInterface
A1CIDescrSubType=A1IntfDescSTypeACInTerm
Length=000C
Type=0024
DescrSubType=0002
A1ITTerminalID=0001
A1ITTerminalType=0101 USB Streaming (on AudioStreaming Interface)
A1ITAssocOutTerm=0000
A1ITNumOutChans=0002
A1ITSpatial=0003
A1ITChanNameStr=0000
A1ITTermStr=0000

5
0001Audio specfic descriptor:
SUB:AuDiO CoNtRoLe
DescrTypeAudioInterface
A1CIDescrSubType=A1IntfDescSTypeACInTerm
Length=000C
Type=0024
DescrSubType=0002
A1ITTerminalID=0002
A1ITTerminalType=0201 Generic Microphone
A1ITAssocOutTerm=0000
A1ITNumOutChans=0001
A1ITSpatial=0001
A1ITChanNameStr=0000
A1ITTermStr=0000

6
0001Audio specfic descriptor:
SUB:AuDiO CoNtRoLe
DescrTypeAudioInterface
A1CIDescrSubType=A1IntfDescSTypeACOutTerm
Length=0009
Type=0024
DescrSubType=0003
A1ITTerminalID=0006
A1ITTerminalType=0301 Generic Speaker
A1ITAssocInTerm=0000
A1OTSourceID=0009
A1OTTermStr=0000

7
0001Audio specfic descriptor:
SUB:AuDiO CoNtRoLe
DescrTypeAudioInterface
A1CIDescrSubType=A1IntfDescSTypeACOutTerm
Length=0009
Type=0024
DescrSubType=0003
A1ITTerminalID=0007
A1ITTerminalType=0101 USB Streaming (on AudioStreaming Interface)
A1ITAssocInTerm=0000
A1OTSourceID=0008
A1OTTermStr=0000

8
0001Audio specfic descriptor:
SUB:AuDiO CoNtRoLe
DescrTypeAudioInterface
A1CIDescrSubType=A1IntfDescSTypeACSelUnit
Length=0007
Type=0024
DescrSubType=0005
A1SUUnitID=0008
A1SUNumInPins=0001
A1SUSourceID1=000A
A1SUSourceIDP=0000
A1SUUnitStr=000A

9
0001Audio specfic descriptor:
SUB:AuDiO CoNtRoLe
DescrTypeAudioInterface
A1CIDescrSubType=A1IntfDescSTypeACFtrUnit
Length=000A
Type=0024
DescrSubType=0006
A1FUUnitID=0009
A1FUSourceID=000F
A1FUControlSize=0001
ctls=3
control number 0
Mute
control number 1
Volume
control number 2
Volume
A1FUUnitStr=0002

10
0001Audio specfic descriptor:
SUB:AuDiO CoNtRoLe
DescrTypeAudioInterface
A1CIDescrSubType=A1IntfDescSTypeACFtrUnit
Length=0009
Type=0024
DescrSubType=0006
A1FUUnitID=000A
A1FUSourceID=0002
A1FUControlSize=0001
ctls=2
control number 0
Mute
Volume
Automatic Gain
control number 1
A1FUUnitStr=0000

11
0001Audio specfic descriptor:
SUB:AuDiO CoNtRoLe
DescrTypeAudioInterface
A1CIDescrSubType=A1IntfDescSTypeACFtrUnit
Length=0009
Type=0024
DescrSubType=0006
A1FUUnitID=000D
A1FUSourceID=0002
A1FUControlSize=0001
ctls=2
control number 0
Mute
Volume
control number 1
A1FUUnitStr=0000

12
0001Audio specfic descriptor:
SUB:AuDiO CoNtRoLe
DescrTypeAudioInterface
A1CIDescrSubType=A1IntfDescSTypeACMixUnit
Length=000D
Type=0024
DescrSubType=0004
A1MUUnitID=000F
A1MUNumInPins=0002
A1MUSourceID[1]=0001
A1MUSourceID[2]=000D
A1MUNumOutChans=0002
A1MUSpatial=0003
A1MUChanStr=0000
A1MUPrgControls=0000

13
End of Audio Header

InterfaceDescriptor:
Length=0009
DescrType=04
Interface Number(0-based)=0001
AlternateSetting=00
NumEndPoints=00 (0)
InterfaceClass=01
InterfaceSubClass=02
InterfaceProtocol=0000
Interface Audio speaker,microphone;
Audio, Streaming v1;
InterfaceIndx=00 (0)

SUB:AuDiO StReAmInG

14
InterfaceDescriptor:
Length=0009
DescrType=04
Interface Number(0-based)=0001
AlternateSetting=01
NumEndPoints=01 (1)
InterfaceClass=01
InterfaceSubClass=02
InterfaceProtocol=0000
Interface Audio speaker,microphone;
Audio, Streaming v1;
InterfaceIndx=00 (0)

SUB:AuDiO StReAmInG

15
0001Audio specfic descriptor:
SUB:AuDiO StReAmInG
DescrTypeAudioInterface
A1CIDescrSubType=A1IntfDescSTypeASGeneral
Length=0007
Type=0024
DescrSubType=0001
A1SITermLink =0001
A1SIDelay=0001
A1SIFormatTag=0001
PCM Pulse Code Modulation

16
0001Audio specfic descriptor:
SUB:AuDiO StReAmInG
DescrTypeAudioInterface
A1CIDescrSubType=A1IntfDescSTypeASFmtType
Length=000E
Type=0024
DescrSubType=0002
A1FT1FormatType =0001
A1FT1NumChans=0002
A1FT1SubSlotSize=0002
A1FT1Resolution=0010 (16-bit)
A1FT1SampFreqType=0002
A1FT1SampleFreq1=$BB80 =48000hz
A1FT1SampleFreq2=$AC44 =44100hz

17
EndpointDescriptor:
Length=0009
DescrType=05
$01 EndPoint Number EPs)(0-15)=1
EDDirectionOut
EndPoint attributes=09
EDAttrData
EDAttrAdaptive
EDAttrIsoch
Max Packet Size EndPoint can handle=C8 (200)
Polling Interval for Data Transfers=01
Refresh Rate(0-9)=00
Synchronization EndPoint=0000
SUB:AuDiO StReAmInG

18
0001Audio specfic descriptor:
SUB:AuDiO StReAmInG
DescrTypeAudioEndPoint
Length=0007
Type=0025
A1EPAttribs=0001
Sampling Frequency is Supported!
A1EPLockDelayUnit=0001
A1EPLockDelay=0001

19
InterfaceDescriptor:
Length=0009
DescrType=04
Interface Number(0-based)=0002
AlternateSetting=00
NumEndPoints=00 (0)
InterfaceClass=01
InterfaceSubClass=02
InterfaceProtocol=0000
Interface Audio speaker,microphone;
Audio, Streaming v1;
InterfaceIndx=00 (0)

SUB:AuDiO StReAmInG

20
InterfaceDescriptor:
Length=0009
DescrType=04
Interface Number(0-based)=0002
AlternateSetting=01
NumEndPoints=01 (1)
InterfaceClass=01
InterfaceSubClass=02
InterfaceProtocol=0000
Interface Audio speaker,microphone;
Audio, Streaming v1;
InterfaceIndx=00 (0)

SUB:AuDiO StReAmInG

21
0001Audio specfic descriptor:
SUB:AuDiO StReAmInG
DescrTypeAudioInterface
A1CIDescrSubType=A1IntfDescSTypeASGeneral
Length=0007
Type=0024
DescrSubType=0001
A1SITermLink =0007
A1SIDelay=0001
A1SIFormatTag=0001
PCM Pulse Code Modulation

22
0001Audio specfic descriptor:
SUB:AuDiO StReAmInG
DescrTypeAudioInterface
A1CIDescrSubType=A1IntfDescSTypeASFmtType
Length=000E
Type=0024
DescrSubType=0002
A1FT1FormatType =0001
A1FT1NumChans=0001
A1FT1SubSlotSize=0002
A1FT1Resolution=0010 (16-bit)
A1FT1SampFreqType=0002
A1FT1SampleFreq1=$BB80 =48000hz
A1FT1SampleFreq2=$AC44 =44100hz

23
EndpointDescriptor:
Length=0009
DescrType=05
$82 EndPoint Number EPs)(0-15)=2
EDDirectionIn
EndPoint attributes=09
EDAttrData
EDAttrAdaptive
EDAttrIsoch
Max Packet Size EndPoint can handle=64 (100)
Polling Interval for Data Transfers=01
Refresh Rate(0-9)=00
Synchronization EndPoint=0000
SUB:AuDiO StReAmInG

24
0001Audio specfic descriptor:
SUB:AuDiO StReAmInG
DescrTypeAudioEndPoint
Length=0007
Type=0025
A1EPAttribs=0001
Sampling Frequency is Supported!
A1EPLockDelayUnit=0000
A1EPLockDelay=0000

25
InterfaceDescriptor:
Length=0009
DescrType=04
Interface Number(0-based)=0003
AlternateSetting=00
NumEndPoints=01 (1)
InterfaceClass=03
InterfaceSubClass=00
InterfaceProtocol=0000
Interface Human Interface Device (HID) keyboard, mouse
Human Intf Dvc
InterfaceIndx=00 (0)

HID

26
0003HID specfic descriptor:
HID
HidDescriptor:
Length=0021
DescrType=00
HID Class Release(version) Spec (BCD)=0001
HID Country Code=0001
HID Number of Class Descriptors=0022
Length of Class Descriptor=0700 (1792)


27
EndpointDescriptor:
Length=0007
DescrType=05
$87 EndPoint Number EPs)(0-15)=7
EDDirectionIn
EndPoint attributes=03
EDAttrData
EDAttrInterrupt
Max Packet Size EndPoint can handle=04 (4)
Polling Interval for Data Transfers=02
Refresh Rate(0-9)=00
Synchronization EndPoint=0000
HID
:end ccfg


I can set and get report values from $09,$0A and $0D.
I hope that will be sufficient.


I read a little about I14RRTDoIsoch.
I14RRTDoIsoch looks similar to I14RRTDoInterruptPer.
Looks like... If i can get a single I14RRTDoIsoch started, It should loop forever.
Can I test I14RRTDoIsoch without adjusting the volume of the device on or turning mute off?
I guess random I14RDataAddrOff data should produce a static looping noise.

I allocated a 256 byte realmode memory location for I14RIsochSchedOff/I14RIsochSchedSeg.
It looks like I14RFrameTiming is the starting point within the Schedule Table Offset.
I don't see any size parameter for the table here.
Does this mean that the table is a fixed size and the entire table is always used?

"Invalid Entry in Isoch Array Data"
watlers world
 
Posts: 113
Joined: Sat Feb 04, 2012 3:08 am

Re: Have you heard from USB yet?

Postby watlers world » Sat Nov 21, 2015 1:49 pm

I setup a function to test Isochronous.

function s64DoIsochronous(b0,b1,b2,b3:byte;w4,w5,wv6,wv7,wv8,wvo9,wvs10,wv11,wv12,wv13:word;v14,v15:byte):byte; begin
with lpProtModePtr^ do begin
I14RRequestType:=I14RRTDoIsoch;
I14RHostIndex := b0;
I14RFlags:=b1;
I14RDeviceAddress:=b2;{Address of Device being configured (2-127)}
I14REndPoint:=b3;{1-15}
I14RPeriodicity:=w4;
I14RDataAddrOff:=w5;
I14RDataAddrSeg:=wv6;
I14RDataSize:=wv7;
I14RFrameTiming:=wv8;
I14RIsochSchedOff:=wvo9;
I14RIsochSchedSeg:=wvs10;
I14RCallBackAddrOff:=wv11;{Large Return Address (CS:IP)} {word}
I14RCallBackAddrSeg:=wv12;{} {word}
I14RUserPktID:=wv13;{Value to return in BX on Large Return}{word}
I14RSetupReqType:=v14;{setup request type}
I14RInterfaceNum:=v15; {//Interface Number}
end;
{send the structure location to the usb driver}
usbuhci;
{we have called an interrupt}
end;
{end of function}







clearintregs;
cleardata;
lpprotmodeptr3^.test[0]:=$20;lpprotmodeptr3^.test[1]:=0;lpprotmodeptr3^.test[2]:=0;lpprotmodeptr3^.test[3]:=0;
lpprotmodeptr3^.test[4]:=$10;lpprotmodeptr3^.test[5]:=0;lpprotmodeptr3^.test[6]:=0;lpprotmodeptr3^.test[7]:=0;
lpprotmodeptr3^.test[8]:=$10;lpprotmodeptr3^.test[9]:=0;lpprotmodeptr3^.test[10]:=0;lpprotmodeptr3^.test[11]:=0;
lpprotmodeptr3^.test[12]:=$30;lpprotmodeptr3^.test[13]:=0;lpprotmodeptr3^.test[14]:=0;lpprotmodeptr3^.test[15]:=0;

write('function DoIsochronous');
closureid:=$33;
s64DoIsochronous(
0, {host index}
$41{I14RFlagIn}, {flags}
2, {device address}
1,{end point 1}
$10, {Schedule repeats after $10 frames} {interval/periodicty}
so1{PtrRec(lpRealModePtr2).seg}, {pointer}
se1{PtrRec(lpRealModePtr2).ofs}, {size}
100, {data size}
3,{I14RFrameTiming/Starting frame index}
PtrRec(lpRealModePtr3).ofs, {offset}
PtrRec(lpRealModePtr3).seg, {location}
Loword(longint(CallBackAddr5)),{offset}
Hiword(longint(CallBackAddr5)),{segment}
closureid, {user packet id}
85 {setup request type}
,0{//Interface Number});

BXRegister:=RRegs.bx;
CXRegister:=RRegs.cx;
DXRegister:=RRegs.dx;
RequestHandle:=RRegs.CX;
WriteDecimal (BXRegister);
write('Write Configuration Value');
WriteDecimal (ConfigValue);
write(iferr(RRegs.ax));

I get this error.
Invalid Entry in Isoch Array Data
watlers world
 
Posts: 113
Joined: Sat Feb 04, 2012 3:08 am

Re: Have you heard from USB yet?

Postby wimpie » Sat Nov 21, 2015 11:25 pm

I can set and get report values from $09,$0A and $0D.
I hope that will be sufficient.

For my cmedia device I do not use these at all.

To start I need the following steps:
1. Use I14RRTDoControl to set endpoint sample frequency.
2. Use I14RRTDoControl to set alternate interface to 1.
3. Use I14RRTDoIsoch to schedule isochronous transaction.

To stop I need the following steps:
4. Use I14RRTClose to close transaction handle.
5. Use I14RRTDoControl to set alternate interface to 0.
But I must say that for now I omitted step 5.

I read a little about I14RRTDoIsoch.
I14RRTDoIsoch looks similar to I14RRTDoInterruptPer.
Looks like... If i can get a single I14RRTDoIsoch started, It should loop forever.
Can I test I14RRTDoIsoch without adjusting the volume of the device on or turning mute off?
I guess random I14RDataAddrOff data should produce a static looping noise.

Yes. Once it starts, it loops forever and you can test it that way.
Yes. Provided that you set it up for host-to-device transfers.

I allocated a 256 byte realmode memory location for I14RIsochSchedOff/I14RIsochSchedSeg.
It looks like I14RFrameTiming is the starting point within the Schedule Table Offset.
I don't see any size parameter for the table here.
Does this mean that the table is a fixed size and the entire table is always used?

Yes. I14RFrameIndex is the starting point when I14RFlagSpecificFrame is set.
Yes. I14RPeriodicity defines the number of entries in the schedule and data arrays.
The schedule array defines the maximum sizes of the individual frames in the data array.
On device-to-host transfers empty, partial or whole frames are received from the device.
On host-to-device transfers whole frames are always sent to the device.

I setup a function to test Isochronous.I get this error.
Invalid Entry in Isoch Array Data

May be because $41{I14RFlagIn}, {flags} means device-to-host?
wimpie
 
Posts: 11
Joined: Fri Nov 20, 2009 11:52 pm

Re: Have you heard from USB yet?

Postby Bret » Sun Nov 22, 2015 6:53 am

Wimpie:

Thanks for helping Watler's World out with this. You're being much more helpful than I could be in this situation.
Bret
 
Posts: 478
Joined: Fri Oct 10, 2008 3:43 am
Location: Rio Rancho, NM

Re: Have you heard from USB yet?

Postby watlers world » Sun Nov 22, 2015 1:32 pm

After setting I14RFlagOut, I had much better luck.
Only step three is needed to create audible output.

(3. Use I14RRTDoIsoch to schedule isochronous transaction.)

Although I'm not yet shure how to change the bitrate, I'm glad to hear the device working.
Would my function SetAudioRep be able to change the bitrate?


Will I still need step 2? (Use I14RRTDoControl to set alternate interface to 1.)
I'm not shure... I see somthing that sounds close.

{; SetAltIntfReq DB SRRTOut+SRRTTypeStandard+SRRTRecipInterface
; DB SRRQSetAltInterface
; SetAltIntfAltIntf DB ? ;Alternate Value to set Interface to
; DB 0
; SetAltIntfIntf DB ? ;Interface to Set
; DB 0
; DW 0
}

Perhaps it is something like a GetReportDescrReq.

function SetAltInterfaceDescrReq(size:byte;interface,settoalt:word):byte; begin
with lpProtModePtr^ do begin
I14RSetupReqType:=SRRTOut+SRRTTypeStandard+SRRTRecipInterface;{byte}
I14RInterfaceNum:=interface;
I14REndPoint:=settoalt; {// Also I14RAltInterface}
I14RSetupReq:=SRRQSetAltInterface;{byte}
I14RSetupValue:=$100*DescrTypeInterface;{word}
I14RSetupIndex:=0;{word}
I14RSetupLength:=size+1;{word}
end;
end;
watlers world
 
Posts: 113
Joined: Sat Feb 04, 2012 3:08 am

Re: Have you heard from USB yet?

Postby wimpie » Sun Nov 22, 2015 11:56 pm

Although I'm not yet shure how to change the bitrate, I'm glad to hear the device working.
Would my function SetAudioRep be able to change the bitrate?

Nice. Very exciting :) to hear that first sound!

Right now SetAudioRep() handles interface class requests.
The Sampling Frequency Control uses endpoint class requests.
I would modify SetAudioRep() to handle both types of requests.

USB Device Class definition for Audio Devices - Revision 1.0
Chapter 5 - Section 5.2.3.2 - Endpoint Control Requests

{bmRequestType is $A2 for Get Endpoint Control Request}
{bmRequestType is $22 for Set Endpoint Control Request}
{I14RSetupReqType bmRequestType}

{bRequest is $81 for GET_CUR}
{bRequest is $01 for SET_CUR}
{I14RSetupReq bRequest}

{Control selector is 1 for Sampling Frequency Control}
{I14RSetupValue(LSB) 0}
{I14RSetupValue(MSB) Control Selector}

{Endpoint Number is $01 for host-to-device}
{EndPoint Number is $82 for device-to-host}
{I14RSetupIndex(LSB) Endpoint Number}
{I14RSetupIndex(MSB) 0}

Will I still need step 2? (Use I14RRTDoControl to set alternate interface to 1.)
I'm not shure... I see somthing that sounds close.
{; SetAltIntfReq DB SRRTOut+SRRTTypeStandard+SRRTRecipInterface
Perhaps it is something like a GetReportDescrReq.

Yes. Step 2 is required to reserve bandwidth and to prepare the device.

Set Interface is a Standard Device Request.
Most likely SetAltIntfReq() will do, but I don't know its implementation.

Universal Serial Bus Specification - Revision 1.1
Chapter 9 - Section 9.4 - Standard Device Requests

{bmRequestType is $01 for Set Interface}
{I14RSetupReqType bmRequestType}

{bRequest is $0B for SET_INTERFACE}
{I14RSetupReq bRequest}

{Alternative Setting is 1 to enable streaming}
{Alternative Setting is 0 to disable streaming}
{I14RSetupValue(LSB) Alternative Setting}
{I14RSetupValue(MSB) 0}

{Interface Number is 1 for host-to-device}
{Interface Number is 2 for device-to-host}
{I14RSetupIndex(LSB) Interface Number}
{I14RSetupIndex(MSB) 0}
wimpie
 
Posts: 11
Joined: Fri Nov 20, 2009 11:52 pm

Re: Have you heard from USB yet?

Postby wimpie » Mon Nov 23, 2015 12:16 am

Bret wrote:Wimpie: Thanks for helping Watler's World out with this. You're being much more helpful than I could be in this situation.

My :) pleasure. I really want Watler's World to succeed without having to reinvent the wheel.
wimpie
 
Posts: 11
Joined: Fri Nov 20, 2009 11:52 pm

Re: Have you heard from USB yet?

Postby watlers world » Tue Nov 24, 2015 9:48 am

The left and right volume work.
Both 48000 and 44100 seem to work.
I think I can set and get endpoints now.

function GetInterfaceDescrReq(interf:byte):byte; begin
with lpProtModePtr^ do begin
I14RSetupReqType:=SRRTIn+SRRTTypeStandard+SRRTRecipInterface;{byte}
I14RSetupReq:=SRRQGetAltInterface;{byte}
I14RSetupValue:=0;{word}
I14RSetupIndex:=interf;{word}
I14RSetupLength:=1;{word}
end;
end;

function SetInterfaceDescrReq(interfacenumber,alternativesetting:byte):byte; begin
with lpProtModePtr^ do begin
I14RSetupReqType:=SRRTOut or SRRTTypeStandard or SRRTRecipInterface;{byte}
I14RSetupReq:=SRRQSetAltInterface;{byte}
I14RSetupValue:=($100*0)+alternativesetting;{word }
I14RSetupIndex:=($100*0)+interfacenumber;{word}
I14RSetupLength:=0;{word}
end;
end;

I have yet to send the USB device any real audio/music data bits.
The usb device says that it is 5.1 channel 3D.
I would guess from the descriptors
A1FT1NumChans=0002 {stereo}
A1FT1SubSlotSize=0002
A1FT1Resolution=0010 (16-bit)

How was your luck in this area?
Did you have to preprocess or interleave audio data before output?

Thank you for all the help and support.
watlers world
 
Posts: 113
Joined: Sat Feb 04, 2012 3:08 am

Re: Have you heard from USB yet?

Postby wimpie » Wed Nov 25, 2015 2:39 am

The left and right volume work.
Both 48000 and 44100 seem to work.
I think I can set and get endpoints now.


Nice. :) I think so too.
GetInterfaceDescrReq() looks o.k.
SetInterfaceDescrReq() looks o.k.

I have yet to send the USB device any real audio/music data bits.
The usb device says that it is 5.1 channel 3D.
I would guess from the descriptors
A1FT1NumChans=0002 {stereo}
A1FT1SubSlotSize=0002
A1FT1Resolution=0010 (16-bit)

It is 16 bit stereo for output and 16 bit mono for input.

Did you have to preprocess or interleave audio data before output?

For stereo output the 16 bit samples are interleaved left/right,left/right and so on.
It is exactly how these samples are present in a corresponding wave audio file.

How was your luck in this area?

My cmedia device needs to receive samples at the proper bit rate.
For 48000Hz it requires exactly 48 samples to be sent every 1 frame.
For 44100Hz it requires 441 samples to be sent every 10 frames.

Therefore I implemented a frame size array with 10 entries.
For 48000Hz the sizes are: 192,192,192,192,192,192,192,192,192,192.
For 44100Hz the sizes are: 180,176,176,176,176,176,176,176,176,176.

I think ;) you are almost there.
wimpie
 
Posts: 11
Joined: Fri Nov 20, 2009 11:52 pm

Re: Have you heard from USB yet?

Postby watlers world » Wed Nov 25, 2015 11:27 am

I'm happy to have the excellent advice and examples.
The usb sound card plays 48khz *.wav file music very well.
Next, I will try to make a driver or *.wav player.

Thank you wimpie!
Thank you Bret!
I hope that you both have a Happy Thanksgiving! :D
watlers world
 
Posts: 113
Joined: Sat Feb 04, 2012 3:08 am

Next

Return to Programs

Who is online

Users browsing this forum: No registered users and 1 guest

cron