RxUsbStringSetDescriptor: Difference between revisions
Appearance
Created page with "==Description== '''Warning:''' Do NOT use this function unless you know your USB device supports it. Executes the Standard Device Request that adds or updates the String Des..." |
|||
Line 28: | Line 28: | ||
==Example Code== | ==Example Code== | ||
<pre> | <pre> | ||
/* add RxUsbStringSetDescriptor */ | |||
rc = RxFuncAdd('RxUsbStringSetDescriptor','usbcalls','RxUsbStringSetDescriptor') | |||
say '+RxUsbStringSetDescriptor(),RC=0x'd2x(rc) | |||
/* invoke RxUsbStringSetDescriptor */ | |||
Index=2 /* second string descriptor index */ | |||
Language=x2d(0409) /* the english language */ | |||
Descriptor=x2c(1203430061006E006F005300630061006E00) | |||
Length=length(Descriptor) /* to replace whole descriptor */ | |||
rc = RxUsbStringSetDescriptor(Handle,Index,Language,Length,Descriptor) | |||
say '*RxUsbStringSetDescriptor(),RC=0x'd2x(rc) | |||
/* drop RxUsbStringSetDescriptor */ | |||
rc = RxFuncDrop('RxUsbStringSetDescriptor') | |||
say '-RxUsbStringSetDescriptor(),RC=0x'd2x(rc) | |||
</pre> | </pre> | ||
Revision as of 23:47, 20 January 2017
Description
Warning: Do NOT use this function unless you know your USB device supports it.
Executes the Standard Device Request that adds or updates the String Descriptor.
Syntax
rc = RxUsbStringSetDescriptor(Handle,Index,Language,Length,Descriptor)
Parameters
- Handle
- the Device Handle received from the previous RxUsbOpen.
- Index
- the Descriptor Index or 0 to supply the array of Language Codes.
- Language
- the Language Code. The Language Code for English is 1033.
- Length
- the desired number of bytes or 0 for the whole String Descriptor.
- Descriptor
- the String Descriptor appropriate for the device.
Return Code
Errors
Remarks
Example Code
/* add RxUsbStringSetDescriptor */ rc = RxFuncAdd('RxUsbStringSetDescriptor','usbcalls','RxUsbStringSetDescriptor') say '+RxUsbStringSetDescriptor(),RC=0x'd2x(rc) /* invoke RxUsbStringSetDescriptor */ Index=2 /* second string descriptor index */ Language=x2d(0409) /* the english language */ Descriptor=x2c(1203430061006E006F005300630061006E00) Length=length(Descriptor) /* to replace whole descriptor */ rc = RxUsbStringSetDescriptor(Handle,Index,Language,Length,Descriptor) say '*RxUsbStringSetDescriptor(),RC=0x'd2x(rc) /* drop RxUsbStringSetDescriptor */ rc = RxFuncDrop('RxUsbStringSetDescriptor') say '-RxUsbStringSetDescriptor(),RC=0x'd2x(rc)