hds2g Member |
posted October 18, 2006 10:09 AM hello.. I want to make two function usb device.. one function is HID mouse Is it possible with only one device(C8051F321)??
If possible, how to make composite device? thank you.. [This message has been edited by hds2g (edited October 18, 2006).] IP: Logged |
Tsuneo Member |
posted October 18, 2006 11:17 AM "Is it possible usb composite device with C8051F321?" Yes, it is realized by a combination of two HID class. Start with the SiLabs mouse example - Add another Interface + HID class + Endpoint(s) descriptor for vender-specific HID. See this SiLabs former HID example for simple vender specific HID It's a good exercise to implement a HID class Tsuneo [This message has been edited by Tsuneo (edited October 18, 2006).] IP: Logged |
hds2g Member |
posted October 18, 2006 08:40 PM thanks for your reply.. I implement vendor-specific firmware. not exist two HID device? and.. one function is HID other function is not HID(I/O device) Is it possible? only two HID device?
IP: Logged |
Tsuneo Member |
posted October 19, 2006 01:57 AM Use of HID protocol is not limited to human interface, like mouse and keyboard. HID is also applied to I/O device. For example, SiLabs USB debug adapter is established on HID. Did you run SiLabs former HID_Example? What it's doing is just I/O device. If you don't apply HID, you should write a custom device driver. Tsuneo [This message has been edited by Tsuneo (edited October 19, 2006).] IP: Logged |
hds2g Member |
posted October 19, 2006 07:47 AM - Add another Interface + HID class + Endpoint(s) descriptor for vender-specific HID. - Add another report descriptor for vender-specific HID - Modify these request - - Set_Configuration - Add endpoint(s) initialization for additional endpoint(s) - - Get_Descriptor - Add handling for additional HID class and report descriptor - - Get_Interface and Set_Interface to support additional interface. - - Get_Report - mandatory for HID, but may not used by the application. - Add handling for the endpoint of vender-specific HID
how to modify..? not exist example? IP: Logged |
Tsuneo Member |
posted October 19, 2006 02:42 PM Is this a commercial product development or your personal project? I remember you are working on USB_INT example. The reason I ask you this question is, a) commercial product development - You can use Windows built-in HID device driver and default INF file for both functions. Therefore, no need to develop / distribute / install / maintain the device driver. - The code amount increases in both of the firmware and the host application. I suppose the difference is 100-150 lines or so, in both side.
- I suppose you've finished your project based on USB_INT. Then, it is easier to combine it to SiLabs HID mouse example, than a) option. - You can use the USB_INT device driver as it is. but you must modify INF file. The INF file modification is simple. Replace the device ID to this format. In this case, the modification of firmware is simplified as follows. And host application will run without any modification.
Tsuneo IP: Logged |
hds2g Member |
posted October 19, 2006 08:15 PM thank you for your reply always.. My project is commercial project.. I already work USB_INT(finished) so.. HID mouse + USB_INT and HID mouse + vendor-specific HID(modify my USB_INT) possible.. but I have no time.. I chose HID mose + USB_INT. later HID mouse + vendor-specific HID.. I have no material.. thanks.. [This message has been edited by hds2g (edited October 19, 2006).] IP: Logged |
hds2g Member |
posted October 20, 2006 12:02 AM my USB_INT descriptor is.. //--------------------------- const configuration_descriptor ConfigDesc = const interface_descriptor InterfaceDesc = const endpoint_descriptor Endpoint1Desc = const endpoint_descriptor Endpoint2Desc = #define STR0LEN 4 code const BYTE String0Desc[STR0LEN] = If I want to two interface.. in configuration descriptor and modify totallength in config desc and add new interface, endpoint desc.. like this? const interface_descriptor newInterfaceDesc = and new endpoint const endpoint_descriptor Endpoint3Desc = and add other HID desc.. It that right? and.. void Get_Interface(void) // This routine returns 0x00, since only one interface if ((USB_State != DEV_CONFIGURED) || // If device is not configured else void Set_Interface(void) how to modify.. [This message has been edited by hds2g (edited October 20, 2006).] [This message has been edited by hds2g (edited October 20, 2006).] IP: Logged |
Patryk Member |
posted October 20, 2006 04:15 AM New descriptors: interface, HID, endpoint (in that sequence, as in Mouse Example). bInterfaceNumber = 1 - OK, but bAlternateSetting = 0, bInterfaceProcotol = 2. HID descriptor: bcdHID = 0x0100 (first byte of that field -LSB- = 0x00, second -MSB- = 0x01). Checking wValue field in Get/Set_Interface(): change Setup.wIndex.c[MSB] || Setup.wIndex.c[LSB] to (Setup.wIndex.i <= 1) // check interface number: 0x00 (USB_INT) or 0x01 (HID). IP: Logged |
Tsuneo Member |
posted October 21, 2006 06:08 AM I posted a demonstration which shows a composite device combined SiLabs USB_HID\MouseExample and USB_INT USB_Mouse_INT_01.zip - When you are asked a device driver, specify the INF folder attached to this zip file. Tsuneo IP: Logged |
hds2g Member |
posted October 22, 2006 09:18 PM very much thank you... thank you.. IP: Logged |
Tsuneo Member |
posted October 23, 2006 02:56 AM Ah, you are just timely. I've searched on a composite device of CDC recently. In this search, I realized how Windows recognizes composite devices. The idea, a composite device combining a generic bulk / interrupt device driver with built-in class drivers, occurs to me. I confirmed it on a Cypress device first, but I've thought another demonstration to make the idea more certainly. Your question was a good opportunity to make another demonstration. Tsuneo IP: Logged |
hds2g Member |
posted October 25, 2006 03:05 AM I have one more question.. my HID mouse has two button.. IN_PACKET[0] => left button(exist) how to modify hid report descriptor..? IP: Logged |
Tsuneo Member |
posted October 25, 2006 06:48 AM You can find an example of the report descriptor for three button mouse in "6.2.2 Report Descriptor" section (p25) of "Device Class Definition for HID 1.11" from USB.org. Compare it to SiLabs MouseExample. You must change three parameters. Tsuneo [This message has been edited by Tsuneo (edited October 25, 2006).] IP: Logged |
hds2g Member |
posted October 27, 2006 02:18 AM thank you.. I succeed HID mouse + vendor specific USB_INT.. thank you very much.. I want to modify from HID mouse + vendor specific USB_INT to HID mouse + HID Digitizer(two HID) so.. only modify int interface descriptor->HID interface descriptor?? what I modify ..
[This message has been edited by hds2g (edited October 27, 2006).] IP: Logged |
Tsuneo Member |
posted October 27, 2006 09:04 AM "so.. only modify int interface descriptor->HID interface descriptor?? and add hid report descriptor?" a) Change VID/PID in the device descriptor To avoid conflict on Windows, As you are going to release the device as an commercial product, you should get an unique VID/PID for the device. See this post to get an unique VID/PID, To delete device instance from driver database, "Device Manager" dialog appears. 3) Expand 'USB I/O controlled devices' 4) Expand 'USB Controller'
c) Add HID class descriptor d) Add HID report descriptor for digitizer e) Get_Descriptor f) Get_Report g) Digitizer implementation When you are going to handle the digitizer only in your original application, vendor-specific HID class is enough. However, If you expect for another application to handle your device as 'digitizer', you should implement HID digitizer class. Of course, the format of report data that is sent/received in the endpoints must follow the selected report descriptor. g-1) Vendor specific HID class g-2) HID digitizer class
Tsuneo |
http://www.cygnal.org/ubb/Forum9/HTML/001042.html