Basic USB HID test failing...

The official pyboard running MicroPython.
This is the reference design and main target board for MicroPython.
You can buy one at the store.
Target audience: Users with a pyboard.
fpp
Posts: 64
Joined: Wed Jul 20, 2016 12:08 pm

Re: Basic USB HID test failing...

Post by fpp » Sun Sep 18, 2016 9:01 am

Ah, got it. These are really well made docs !

It also explains the other line I didn't understand, as the value got squashed afterwards :

Code: Select all

buf[0] = 0x01   # Keyboard
If I understand correctly, the choice for the uPy API precludes using a pyboard as a mongrel HID device (kb + mouse + pad), which is allowed by the 9-bit C API ?
Last edited by fpp on Sun Sep 18, 2016 5:00 pm, edited 1 time in total.

User avatar
dhylands
Posts: 3821
Joined: Mon Jan 06, 2014 6:08 pm
Location: Peachland, BC, Canada
Contact:

Re: Basic USB HID test failing...

Post by dhylands » Sun Sep 18, 2016 4:10 pm

Looking at the code, it looks like you might be able to call pyb.usb_mode each time you want to switch modes and pass in a new hid type.

fpp
Posts: 64
Joined: Wed Jul 20, 2016 12:08 pm

Re: Basic USB HID test failing...

Post by fpp » Sun Sep 18, 2016 5:04 pm

The pyboard may be able to do that, but from my recent adventures I have doubts about the capability to reconfigure in real time on the Windows end...
Worth trying on a rainy day though :-)

BTW, do you know how/whom to ask to get a new tutorial added to the docs ? The results of this thread could be a useful addition to the mouse code example...

User avatar
dhylands
Posts: 3821
Joined: Mon Jan 06, 2014 6:08 pm
Location: Peachland, BC, Canada
Contact:

Re: Basic USB HID test failing...

Post by dhylands » Sun Sep 18, 2016 5:28 pm

I'm not sure what the Windows issue would be.

Calling pyb.usb_mode only does actual USB configuration the first time its called. After that, it skips all of th eUSB initialization and just stashes away the hid= parameter which would in effect wind up changing the first byte when you sned the hid data.

The documentation is all stored in the doc tree of the micropython repository, so updating the documentation is done as a PR just like modifying the code.

The mouse tutorial is here:
https://github.com/micropython/micropyt ... _mouse.rst
and the file which links it into the documentation is here:
https://raw.githubusercontent.com/micro ... /index.rst

fpp
Posts: 64
Joined: Wed Jul 20, 2016 12:08 pm

Re: Basic USB HID test failing...

Post by fpp » Mon Sep 19, 2016 6:32 pm

dhylands wrote:I'm not sure what the Windows issue would be.
Calling pyb.usb_mode only does actual USB configuration the first time its called. After that, it skips all of the USB initialization and just stashes away the hid= parameter which would in effect wind up changing the first byte when you send the hid data.
I was referring to my home PC, which had decided once and for all my pyboard was a mouse, despite dozens of pyb.usb_mode calls top the contrary, and was silently discarding the data I sent it because they were not mouse reports :-)
dhylands wrote: The documentation is all stored in the doc tree of the micropython repository, so updating the documentation is done as a PR just like modifying the code.
Ouch... I don't do Github :-(
I could probably write a tutorial in Markdown, but PR's are not in my ballpark.
Strange to place such hurdles against community contributions... whatever happened to good old Wikis ?

User avatar
deshipu
Posts: 1388
Joined: Thu May 28, 2015 5:54 pm

Re: Basic USB HID test failing...

Post by deshipu » Mon Sep 19, 2016 7:07 pm

fpp wrote:Strange to place such hurdles against community contributions... whatever happened to good old Wikis ?
There is a good old wiki too. It's on github.

fpp
Posts: 64
Joined: Wed Jul 20, 2016 12:08 pm

Re: Basic USB HID test failing...

Post by fpp » Mon Sep 19, 2016 7:45 pm

Ah, thanks for reminding me of that !

But it serves a very different purpose than the docs, doesn't it ?
More for the development and porting of uPy itself, than for end-user tutorials or sample code (which seems quite normal).

User avatar
deshipu
Posts: 1388
Joined: Thu May 28, 2015 5:54 pm

Re: Basic USB HID test failing...

Post by deshipu » Mon Sep 19, 2016 10:03 pm

Yes. You can always write your own tutorials somewhere. For instance, I put my workshop materials on readthedocs -- it's very easy to write them using sphinx, and I can make it update automatically from any repository, on bitbucket, github or hosted by myself. If it's bitbucket or github, they even add an "edit" button there, for making pull requests.

User avatar
pythoncoder
Posts: 5956
Joined: Fri Jul 18, 2014 8:01 am
Location: UK
Contact:

Re: Basic USB HID test failing...

Post by pythoncoder » Tue Sep 20, 2016 5:49 am

There are two wikis, the dev one here https://github.com/micropython/micropython/wiki an one for users here http://wiki.micropython.org/Home.
Peter Hinch
Index to my micropython libraries.

fpp
Posts: 64
Joined: Wed Jul 20, 2016 12:08 pm

Re: Basic USB HID test failing...

Post by fpp » Tue Sep 20, 2016 8:41 am

Ah, thanks for that, by focusing on Github I had managed to completely overlook the traditional one on this site...

It does look a bit... redundant, semi-abandoned or at least under-promoted ?

It's the most accessible to me however, so I'll give it a spin...

Post Reply