Forum: Old versions

For older version, like VirtualDJ 7.


NOTE: VirtualDJ 7 is not maintained anymore.
Tema: HID Definition implementation - Page: 1

Esta parte del tópico es antigua y puede contener información incorrecta para la nueva versión.

Hi guys, I'm trying to write a simple definition file for a HID device. However I'm having a hard time just making it appear in the MAPPERS section, I know the mapper file is good as it works fine with its MIDI counter part and I copy & pasted the VID & PID from the HID Trace tool. What I am missing from this base def. file?

Second question, what would the correct position bit value be if the target bit is the bit on RED below?


Output of HID Trace:
HID device VID=08e4|PID=015b(105)|Size=16/32

Page: 0

0 1 2 3 4 5 6 7 8 9 A B C D E F
_________________________________________________
0| 01 00 80 80 00 00 00 00 00 00 00 00 00 80 00 00


01234567 89ABCDEF
__________________
0| 00000001 00000000
1| 10000000 10000000
...
7| ...


Definition file:
<?xml version="1.0" encoding="UTF-8"?>
<device name="HID device" type="HID" vid="0x08e4" pid="0x015b" decks ="4" reportsize="16">

<page type="in">
<button bit="25" deck="1" name="PLAY" />
<button bit="26" deck="1" name="CUE" />
</page>

</device>


Mapper file:
<?xml version="1.0" encoding="UTF-8"?>
<mapper device="HID device" description="HID device" version="730" date="16/01/2013">

<map value="PLAY" action="play_pause" />
<map value="CUE" action="cue_stop" />

</mapper>

Mensajes Mon 21 Jan 13 @ 2:07 am
The in and out report sizes are dfiferent (Size=16/32), so you need to specify this in your definition, e.g:

<device name="HID device" type="HID" vid="0x08e4" pid="0x015b" decks ="4" reportsize="16" outreportsize="32">

Mensajes Mon 21 Jan 13 @ 3:39 am
technzPRO InfinityMember since 2011
i always have trouble with defining larger data types in HID so may i present an alternative line for your definiton.

<button name="PLAY" bit="0x18" nbbits="1" value="0x1" inverted="false" deck="1" />

this line should provide everything needed to make the button behave in any way you want.
0x?? means its in hex rather than decimal so rather than you counting the number of bits from the start of the HID page, you just take the left number and tack it before the top number, so the other bit that is 1 would be 0x10 (1 being the number on the left and 0 being the number above)

Mensajes Mon 21 Jan 13 @ 1:23 pm
@Support staff: thanks, I knew I was missing something.


@TechNZ: yeah, I always wonderered (due to the lack of details in the VDJpedia) if the <bit="" > took decimals or hex or both. Is great to know it takes both so that I can just use the HEX grid positions as you suggested. Will make mapping the definition file much easier.

I'll give the above suggestions a try tonite and will report the results...

Mensajes Mon 21 Jan 13 @ 3:00 pm
wait, wouldn't the position bit be 0x18 since the bit in RED is in row 01h and column 08h ???

X| 01234567 89ABCDEF
___________________
0| 00000001 00000000
1| 10000000 10000000

Mensajes Mon 21 Jan 13 @ 3:06 pm
technzPRO InfinityMember since 2011
for sliders and other larger inputs keep the location defined in bits, rather than using bytes or words and just increase nbbits to the correct amount.

nbbits="4" for a byte
nbbits="8" for a word
and so on....

Mensajes Mon 21 Jan 13 @ 6:12 pm
Ok, the buttons seem to be cooperating so far but the sliders are not....

X| 01234567 89ABCDEF
___________________
...
6| 00000001 00000000
7| 11111111 00000011

The corresponding bits for the slider are the ones in RED. I tried the following 2 lines:

<slider bit="0x70" nbbits="10" max="0xFF03" name="CROSSFADER" />

<slider word="0x07" max="0xFF03" name="CROSSFADER" />

Neither line works, VDJ seems to take only in consideration the 1st 8 bits and it keeps disregarding the 2 bits on the second byte because when I move the slider 1 full sweep VDJ actually make 4 sweeps.

From what I can see and understand bits are read right to left (LSb on right, MSb on left) and in the case of multiple bytes, the byte on the left is read first and it then moves to the next byte on the right. So in case of the bits in RED bits 0-7 make up the 1st byte, and the other 2 bits on the far right make up bits 8 and 9 so in total there are 10 bits that change with the slider and they seem to be in the right order. Is this process correct?

What I am missing? I think I'm getting confused with the order in which the bits, bytes and words get read and processed. I also tried max="0x03FF" with the same results...

Mensajes Tue 22 Jan 13 @ 12:01 pm
technzPRO InfinityMember since 2011
this is the same sort of trick that the NI gear uses.

ive been trying to come up with theories on how to handle them properly...
i have one final theory of how to do it but i havent got around to doing it.

Mensajes Tue 22 Jan 13 @ 2:24 pm
Try the following:

<slider word="0x07" size="word" endian="little" max="0x3FF" name="CROSSFADER" />

endian="little" reverses the order of the bytes of size="word" or greater, so 11111111 00000011 should become 00000011 11111111

max="0x3FF" should then limit it to the right-most 10 bits.

Mensajes Tue 22 Jan 13 @ 2:59 pm
technzPRO InfinityMember since 2011
I will throw my S2 back on tonight and give this a try


i thought id edit my post and say thanks in advance.
if this works i will be able to completely remove the need for MIDI input for my S2 mapper, now i just need help from atomix to figure out how to get HID output working.

Mensajes Tue 22 Jan 13 @ 3:02 pm
I'll try playing with those settings tonite as well.... thanks so much for the continuous support.

Mensajes Tue 22 Jan 13 @ 3:55 pm
technzPRO InfinityMember since 2011
works perfectly, had to ad a tiny buffer zone at the end of the slider using min and max because they never consistently went to to 0xFFF or 0x000

<slider name="SL1" bit="0x68" size="word" endian="little" max="0xFF0" min="0x00F" />

Mensajes Tue 22 Jan 13 @ 10:46 pm
technzPRO InfinityMember since 2011
now if i can get HID out working then i can drop one of my MIDI mappers completely and have the controller supported without any changes in the controllers software.

Mensajes Tue 22 Jan 13 @ 10:46 pm
Unfortunately, output may more be difficult to work out for yourself without having the technical specification from the manufacturer available to refer to, especially if it's more complex than simply turning specific bits on/off (This is normally the way most HID devices work, but because S2 HID is intended to be exclusive to Traktor, it may be more complex than this.)

You could try defining each output bit in turn and then mapping it to 'blink' to see what effect setting/resetting that bit has on the controller.

Input is easier to work out because you can simply press a button, move a knob, etc. and observe the changes.

Mensajes Wed 23 Jan 13 @ 6:48 am
Support staff wrote :
Unfortunately, output may more be difficult to work out for yourself without having the technical specification from the manufacturer available to refer to, especially if it's more complex than simply turning specific bits on/off (This is normally the way most HID devices work, but because S2 HID is intended to be exclusive to Traktor, it may be more complex than this.)

You could try defining each output bit in turn and then mapping it to 'blink' to see what effect setting/resetting that bit has on the controller.

Input is easier to work out because you can simply press a button, move a knob, etc. and observe the changes.


I understand what you are referring to. Here is my progress of last night. I discovered my device spits out several HID pages, 10 pages from what I was able to notice, so after tweaking with the CONSTANT element I finally got the buttons and sliders working without having them overwrite each other.

I'm stuck at the output side just like TechNZ, here is the code for the decks so far...

X| 01234567 89ABCDEF
___________________
0| 00000001 00000000
1| 10000000 10000000
...

Bits in GREEN are used by CONSTANT, Bits in RED are the PLAY & CUE buttons.

<?xml version="1.0" encoding="UTF-8"?>
<device name="HID device" type="HID" vid="0x08e4" pid="0x015b" reportsize="16" outreportsize="32" decks="4" >

***** INPUTS *****
--- Deck A
<page type="in">
<constant bit="0x00" nbbits="0x14" value="0x01008" />

<button bit="0x18" deck="1" name="PLAY" />
<button bit="0x19" deck="1" name="CUE" />

<slider bit="0x48" size="word" endian="little" signed="true" min="-1000" max="1000" deck="1" name="PITCH" />

</page>


--- Deck C
<page type="in">
<constant bit="0x00" nbbits="0x14" value="0x01004" />

<button bit="0x18" deck="3" name="PLAY" />
<button bit="0x19" deck="3" name="CUE" />

<slider bit="0x48" size="word" endian="little" signed="true" min="-1000" max="1000" deck="3" name="PITCH" />

</page>


--- Deck B
<page type="in">
<constant bit="0x00" nbbits="0x14" value="0x02008" />

<button bit="0x18" deck="2" name="PLAY" />
<button bit="0x19" deck="2" name="CUE" />

<slider bit="0x48" size="word" endian="little" signed="true" min="-1000" max="1000" deck="2" name="PITCH" />

</page>


--- Deck D
<page type="in">
<constant bit="0x00" nbbits="0x14" value="0x02004" />

<button bit="0x18" deck="4" name="PLAY" />
<button bit="0x19" deck="4" name="CUE" />

<slider bit="0x48" size="word" endian="little" signed="true" min="-1000" max="1000" deck="4" name="PITCH" />

</page>
...


***** OUTPUTS *****
--- Deck A
<page type="out">
<constant bit="0x00" nbbits="0x14" value="0x01008" />

<led bit="0x19" deck="1" name="LED_PLAY" default="PLAY" />
<led bit="0x1B" deck="1" name="LED_CUE" default="CUE" />

</page>


--- Deck C
<page type="out">
<constant bit="0x00" nbbits="0x14" value="0x01004" />

<led bit="0x19" deck="3" name="LED_PLAY" default="PLAY" />
<led bit="0x1B" deck="3" name="LED_CUE" default="CUE" />


</page>


--- Deck B
<page type="out">
<constant bit="0x00" nbbits="0x14" value="0x02008" />

<led bit="0x19" deck="2" name="LED_PLAY" default="PLAY" />
<led bit="0x1B" deck="2" name="LED_CUE" default="CUE" />

</page>


--- Deck D
<page type="out">
<constant bit="0x00" nbbits="0x14" value="0x02004" />

<led bit="0x19" deck="4" name="LED_PLAY" default="PLAY" />
<led bit="0x1B" deck="4" name="LED_CUE" default="CUE" />


</page>


I'm using the 1st. 20 bits to differentiate between the pages for the Decks, bits @ 0x18 and 0x19 correspond to the PLAY & CUE buttons.
The buttons & PITCH slider work perfectly in all decks and taking in consideration the DECK CHANGE funcionality. I tried the same concept with the LEDs and divided the output in pages same as the input. LEDs for Decks A/C work fine, but Decks B/D do not lit up at all.

What suggestions do you have for this? Could all the outputs just be in 1 page? Since my output page is 32 bytes in lenght, I guess it could be possible. Is it possible my pages are not defined correctly even though those few buttons seem to be working properly?

Is there a tool like MIDI Trace or Chackl's MIDI Definer that would let us submit pages to the controller? HIDTrace does not have this ability.

As a workaround could I just turn chunks of bits ON at a time on a given page to help determine finding the location of the LED's?

for instance:
<led bit="0x00" nbbits="256" deck="1" name="LED_PLAY" default="PLAY" />

would this turn all bits ON in the 32byte output page and therefore all LED's ON when I hit PLAY?

Mensajes Wed 23 Jan 13 @ 2:51 pm
technzPRO InfinityMember since 2011
ThereThere is a price of software called USBlyzer that could help you with finding your outputs.
They offer a fully functional trial which can be used again by changing the system date/time back.

It is a very handy utility but it gives the output in hex so you may have to count bits and convert back to binary


Also due to the fact that most LEDs only have 2 states and only require one bit. You might find that all the LEDs are in fact on a single report.

Mensajes Wed 23 Jan 13 @ 3:08 pm
technzPRO InfinityMember since 2011
zacek100 wrote :

***** INPUTS *****
--- Deck A
<page type="in">

not sure if this is how you formatted your comments/headers in you definition.
but if you did do them like this change them to <!-- COMMENT ---> and replace 'COMMENT' with whatever text you want,

Mensajes Wed 23 Jan 13 @ 7:05 pm
I tried the comment tags on the def. file before but the mapper failed to load, so I just left the tags out and VDJ does not seem to complain... weird.

Mensajes Wed 23 Jan 13 @ 7:44 pm
technzPRO InfinityMember since 2011
comment tags should work perfectly, maybe you had an unclosed tag or something

Mensajes Wed 23 Jan 13 @ 7:56 pm
argh! this is driving me bunkers... I think I got all the essential LEDs for DECKs A, C, D but I cannot get the CUE/PLAY indicators to work for Deck B, so weird. I'll gather the HID page info and post it, maybe you guys can shed some light into the problem.

By the way, I used:

<constant dword="0x0" value"0x01000000" />

<led dword="0x1" deck="1" name="LED_PLAY" default="PLAY" />
<led dword="0x2" deck="1" name="LED_PLAY" default="PLAY" />
...
<led dword="0xF" deck="1" name="LED_PLAY" default="PLAY" />


in my output HID page and that quickly allowed me to determine in what page where all the indicators at, in this case all the indicators where on OUTPUT page 1

Mensajes Thu 24 Jan 13 @ 5:34 pm
Página : [>] [>>]
27%