Author Topic: Joysticks  (Read 14879 times)

gbr

  • Member
  • ***
  • Posts: 23
Joysticks
« on: December 02, 2012, 04:47:18 am »
Hello Ian and all !
Some time ago I received a good amount of help from this forum.
Thank you Ian

I am restarting with joysticks extensions after a period of rest due to health.
I would like to ask some questions about Joystick axes   
What is theorytically the maximum number of AXIS that the Wlndows game controller can display correctly ?

Using Report 1 and 2
So far I can display 5 axis plus the pointers making 7
If I manage to display a 8th one it shows but move the setting with the previous axis
At least there it shows
But I discovered a source for an ATMEL of which I used the HID Report Descriptor in my
18F4550 source
I used  exactly the source
And that not even boot the chip 

Is there a reason for that
A descriptor is a descriptor why is it not working at all ??

Jan Axelson

  • Administrator
  • Frequent Contributor
  • *****
  • Posts: 3033
    • Lakeview Research
Re: Joysticks
« Reply #1 on: December 02, 2012, 05:34:09 pm »

gbr

  • Member
  • ***
  • Posts: 23
Re: Joysticks
« Reply #2 on: December 03, 2012, 03:28:42 am »
Thanks Ian,
I think that this documentation does not take into consideration the "Pointer"
that has 2 axis in itself and i always present  regardless of the other axes
The unit  I am refering to has worked perfectly for next to 2 years and it had the complication
of using 2 pots to move the mouse and a possibility to :
at the touch of one button it could send any characters to simulate entries from the keyboard
It was used for the flight simulator IL2 and never gave me any trouble
Axis (Pointer)    2
Z axis               1
x rotation   1
y      1
z      1
Slider      1 ====7 working
As I want to cancell the mouse action I tried to implement at least one extra axis (Dial or Wheel)as I said it shows on the Game cntroller but moves with the pot used by
Wheel or Dial    1 = 8 showing but moving in the same time as the Z rotation
I have checked and rechecked times again and cannot find any mistake
I do not want to clutter this web side
But if you are or anybody else want the 2 HID Reports I will post them here (the one I did  and the one for the other chip ( Atmel I think )) they could then be used with "C" as mine is in Pic18 assembly 
The Atmel one I cannot say if it shows in windows normal Game Controller tester 

gbr

  • Member
  • ***
  • Posts: 23
Re: Joysticks
« Reply #3 on: December 07, 2012, 02:57:36 pm »
I finally managed to get it working
ID 1
HID 1
ID 1
x 10 bits in pointer window
y 10 bits in pointer window
z 10 bits Top
Rx 8 bits 2d
Ry 8 bits 3d
Rz 8 bits 4th
10 buttons of which one can send a string of characters

ID 2
Slider 10 bits 5th
Wheel 8 bits  6th

I cancelled the mouse action on HID 2
keeping

HID 2
to send the keyboard characters sequence

I fault-found my mistakes with Device Monitoring Studio( cheapest version )
Diverse errors of writing places

So that confirm that windows can detect 8 axis and use them correctly
You got to be very careful with the writing into the buffers( and modify-test ONE instruction at a time )
 
I though this precision would be welcome
Thank you for your interest,  if ,see below
And thanks Ian for this forum


The HID report descriptor for the 8 axes
============================
HidReportdescriptor1:
 dw 0x05,0x01   ; Usage_Page (Generic Desktop)
 dw 0x09,0x04   ; Usage (Joystick)
 dw 0xA1,0x01   ; Collection (Application)

 DW 0X85,1   ; Report ID 1
 dw 0x09,0x04   ; Usage Joystick
 dw 0xA1,0x00   ; Collection (Physical)

 dw 0x35,00           ; Physical min 0
 dw 0x46,0xFF,03   ; Physical max 1023
 dw 0x16,00,0xFE   ; Logical Minimum (-511)
 dw 0x26,0xFF,0x01   ; Logical Maximum ( 511)

 dw 0x09,0x30      ; Usage (X)       #1
 dw 0x09,0x31      ; Usage (Y)       #2
 dw 0x09,0x32      ; Osage (Z)         #3
 dw 0x75,0x10      ; Report_Size (16) using 16 to avoid padding
 dw 0x95,0x03      ; Report_Count 3   count 3 * 2 = 6 + 1 rep ID = 7
 dw 0x81,0x02      ; Input (Data, Var, Abs)
 dw 0x35,00           ; Physical min 0
 dw 0x46,0xFF,00   ; Physical max 255
 dw 0x15,0x81        ; Logical min -127
 dw 0x25,0x7F      ; Logical max 127
 dw 0x09,0x33      ; rX      #4      8
 dw 0x09,0x34      ; rY      #5      9
 dw 0x09,0x35      ; rZ      #6   Count =   10
 dw 0x75,0x08      ; Report_Size 8
 dw 0x95,0x03      ; Report_Count 3
 dw 0x81,0x02      ; Input (Data, Var, Abs)
 dw 05,09          ; USAGE_PAGE (Button)
 dw 19h,1           ; USAGE_MINIMUM (Button 1)
 dw 29h,10          ; USAGE_MAXIMUM (Button 10)
 dw 15h,0              ; LOGICAL_MINIMUM (0)
 dw 25h,1              ; LOGICAL_MAXIMUM 1
 dw 75h,1              ; REPORT_SIZE 1
 dw 95h,10          ; REPORT_COUNT (10)
 dw 81h,2          ; INPUT (Data,Var,Abs)      10 Bits + padding =2 bytes
 dw 0x75,1      ; For
 dw 0x95,6      ; 6 bits
 dw 0x81,3      ; Padding
      ; Total nb of bytes in ID1 = 12

   ;********* REPORT ID 2 ***********
 DW 0X85,2   ; REP ID 2
 dw 0x05,0x01   ;Usage_Page (Generic Desktop)
      ; For the RUDDER reading(combined HALVES)
 dw 0x09,0x36      ; Usage Slider      
 dw 0x35,00           ; Phys min 0
 dw 0x46,0xFF,03   ; Phys max 1023
 dw 0x16,00,0xfe   ; Logical Minimum (-511)
 dw 0x26,0xff,0x01   ; Logical Maximum ( 511)
 dw 0x75,0x10      ;Report_Size (16)  Using 16 to avoid padding

 dw 0x95,0x01      ;Report_Count 1
 dw 0x81,0x02      ;Input (Data, Var, Abs) 2 bytes
;addition of 1 channel
 dw 0x09,0x37      ; Dial    
 dw 0x46,0xFF,00   ; phys max 255
 dw 0x15,0x81        ; log min -127
 dw 0x25,0x7F      ; log max 127
 dw 0x75,0x08      ;Report_Size 8
 dw 0x95,0x01      ;Report_Count 1
 dw 0x81,0x02      ;Input (Data, Var, Abs)
 dw 0xC0       ; End_Collection.
      ; Total nb of bytes in ID2 = 4
endof1:
   Double1 equ Endof1 - HidReportdescriptor1
   LenOFdescr1 equ Double1/2
 

Jan Axelson

  • Administrator
  • Frequent Contributor
  • *****
  • Posts: 3033
    • Lakeview Research
Re: Joysticks
« Reply #4 on: December 08, 2012, 10:37:26 am »
Thanks for posting what you learned. I'm glad to hear you got it working.