Belcarra / gadgetconfig

gadgetconfig uses USB Device Definition JSON files to configure and use Gadget USB Devices implemented with libcomposite.
MIT License
19 stars 5 forks source link

Question about error enabling hid-example.json #2

Closed ajlennon closed 3 years ago

ajlennon commented 3 years ago

Hi,

I am able to enable e.g. belcarra-acm-rndis.json but when I try to enable hid-example.json from the repo I get

root@stm32mp1-dxua-1:/usr/lib/python3.8/site-packages/commentjson-0.9.0-py3.8.egg-info# gadgetconfig --enable g2
[  285.552483] Need at least one configuration in g2.
[  285.562810] configfs-gadget 49000000.usb-otg: failed to start g2: -22
[  285.578144] Need at least one configuration in g2.
[  285.586636] configfs-gadget 49000000.usb-otg: failed to start g2: -22
OSError: [Errno 22] Invalid argument

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/bin/gadgetconfig", line 11, in <module>
    load_entry_point('gadgetconfig==0.0.30', 'console_scripts', 'gadgetconfig')()
  File "/usr/lib/python3.8/site-packages/gadgetconfig/__init__.py", line 142, in main
    m.enable_current(args.enable)
  File "/usr/lib/python3.8/site-packages/gadgetconfig/manage.py", line 225, in enable_current
    self.update_udc(name, self.udclist[0])
  File "/usr/lib/python3.8/site-packages/gadgetconfig/manage.py", line 203, in update_udc
    f.close()
OSError: [Errno 22] Invalid argument

Can you advise at all? Thanks!

stuartlynne commented 3 years ago

I'm not handling the report_desc apparently. I'll have a look over the weekend and get back to you.

On Thu, Dec 10, 2020 at 2:00 AM Alex Lennon notifications@github.com wrote:

Hi,

I am able to enable e.g. belcarra-acm-rndis.json but when I try to enable hid-example.json from the repo I get

root@stm32mp1-dxua-1:/usr/lib/python3.8/site-packages/commentjson-0.9.0-py3.8.egg-info# gadgetconfig --enable g2 [ 285.552483] Need at least one configuration in g2. [ 285.562810] configfs-gadget 49000000.usb-otg: failed to start g2: -22 [ 285.578144] Need at least one configuration in g2. [ 285.586636] configfs-gadget 49000000.usb-otg: failed to start g2: -22 OSError: [Errno 22] Invalid argument

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/usr/bin/gadgetconfig", line 11, in load_entry_point('gadgetconfig==0.0.30', 'console_scripts', 'gadgetconfig')() File "/usr/lib/python3.8/site-packages/gadgetconfig/init.py", line 142, in main m.enable_current(args.enable) File "/usr/lib/python3.8/site-packages/gadgetconfig/manage.py", line 225, in enable_current self.update_udc(name, self.udclist[0]) File "/usr/lib/python3.8/site-packages/gadgetconfig/manage.py", line 203, in update_udc f.close() OSError: [Errno 22] Invalid argument

Can you advise at all? Thanks!

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/Belcarra/gadgetconfig/issues/2, or unsubscribe https://github.com/notifications/unsubscribe-auth/AACIUWKXUDJEJCVIL6NOTR3SUCL4DANCNFSM4UUYW42Q .

-- __O____ -\<,____ ____()/()___


Stuart_Lynnestuart.lynne@gmail.com604-518-1749(m)__604-461-7532(h)

ajlennon commented 3 years ago

That's great. Thanks @stuartlynne

stuartlynne commented 3 years ago

Fixed. The dev item, functions/hid.usb0/dev, is read only. I was trapping the exception but treating it as a failure and exiting.

Changed to pass and it appears to work correctly.

gadgetconfig --add hid-example.json --enable g1

sysfstree --usb-gadget _main: pinclude: [] [/sys/kernel/config/usb_gadget] └──[g1] ├──bcdDevice: 0x0001 ├──bcdUSB: 0x0200 ├──bDeviceClass: 0x00 ├──bDeviceProtocol: 0x00 ├──bDeviceSubClass: 0x00 ├──bMaxPacketSize0: 0x40 ├──idProduct: 0x0104 ├──idVendor: 0x1d6b ├──UDC: fe980000.usb ├──[configs] │ └──[The only one.1] │ ├──bmAttributes: 0x80 │ ├──MaxPower: 2 │ ├──some_name -> /sys/kernel/config/usb_gadget/g1/functions/hid.usb0 │ └──[strings] │ └──[0x409] │ ├──configuration: 1xHID ├──[functions] │ └──[hid.usb0] │ ├──dev: 234:0 │ ├──protocol: 1 │ ├──report_desc: 05 01 09 06 a1 01 05 07 19 e0 29 e7 15 00 25 01 │ │ : 75 01 95 08 81 02 95 01 75 08 81 03 95 05 75 01 │ │ : 05 08 19 01 29 05 91 02 95 01 75 03 91 03 95 06 │ │ : 75 08 15 00 25 65 05 07 19 00 29 65 81 00 c0 │ ├──report_length: 8 │ ├──subclass: 0 ├──[os_desc] │ ├──b_vendor_code: 0x00 │ ├──qw_sign: │ ├──use: 0 ├──[strings] │ └──[0x409] │ ├──manufacturer: Foo Inc. │ ├──product: Bar Gadget │ ├──serialnumber: 0123456789

On Fri, Dec 11, 2020 at 2:16 AM Alex Lennon notifications@github.com wrote:

That's great. Thanks @stuartlynne https://github.com/stuartlynne

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/Belcarra/gadgetconfig/issues/2#issuecomment-743106837, or unsubscribe https://github.com/notifications/unsubscribe-auth/AACIUWKU4NG6DPPA4GOQEN3SUHWP7ANCNFSM4UUYW42Q .

-- __O____ -\<,____ ____()/()___


Stuart_Lynnestuart.lynne@gmail.com604-518-1749(m)__604-461-7532(h)

ajlennon commented 3 years ago

Oh great thanks !

ajlennon commented 3 years ago

Thanks for that - I tested and that works for me!

Belcarra commented 3 years ago

Good!

If you have any questions or suggestions, feel free to ask.

On Tue, Dec 15, 2020 at 4:08 AM Alex Lennon notifications@github.com wrote:

Thanks for that - I tested and that works for me!

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub https://github.com/Belcarra/gadgetconfig/issues/2#issuecomment-745247595, or unsubscribe https://github.com/notifications/unsubscribe-auth/AALJH5BHBSU7TOIRQGVCUHTSU5GSVANCNFSM4UUYW42Q .

-- Belcarra Embedded USB Software Stuart_Lynne sl@belcarra.com 604-461-7532 Alternates: 604-283-7475 and 604-518-1749(cell) http://usblan.belcarra.com http://www.belcarra.com