CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

How to change the usb descriptor?

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
young



Joined: 24 Jun 2004
Posts: 285

View user's profile Send private message

How to change the usb descriptor?
PostPosted: Thu Jan 27, 2005 3:28 pm     Reply with quote

I am using the ex_usb_hid.c example from the ccs. the sample so far working fine.
I want to change the Transfer and Receive data bytes. I saw in the sample file, if I want to do that I have to change the usb description,
Quote:

#define USB_EP1_TX_ENABLE 1 //turn on EP1 for IN bulk/interrupt transfers
#define USB_EP1_TX_SIZE 2 //if you change this, be sure to change the hid descriptor

//the following defines needed for the CCS USB PIC driver to enable the RX endpoint 1
#define USB_EP1_RX_ENABLE 1 //turn on EP1 for OUT bulk/interrupt transfers
#define USB_EP1_RX_SIZE 2 //if you change this, be sure to change the hid descriptor


I want to the file provide by ccs, and find out the usb_desc.c file, but I do not know how to change it.

for example, if I want to
#define USB_EP1_TX_SIZE 20 ( this number is secret to me, what is the maximum number for me to define here
and
#define USB_EP1_RX_SIZE 2
How accordingly, I should change the usb desceiption?

Thank you!
young



Joined: 24 Jun 2004
Posts: 285

View user's profile Send private message

PostPosted: Thu Jan 27, 2005 5:38 pm     Reply with quote

I looked into the usb_desc.h file and changed here
Code:

  BYTE CONST USB_HID_DESC[] = {  //len=28
      6, 0, 255,    // Usage Page = Vendor Defined
      9, 1,            // Usage = IO device
      0xa1, 1,       // Collection = Application
      0x19, 1,        // Usage minimum
      0x29, 8,        // Usage maximum

      0x15, 0x80,        // Logical minimum (-128)
      0x25, 0x7F,        // Logical maximum (127)

      0x75, 8,        // Report size = 8 (bits)
      0x95, 2,        // Report count = 16 bits (2 bytes)
      0x81, 2,        // Input (Data, Var, Abs)
      0x19, 1,        // Usage minimum
      0x29, 8,        // Usage maximum
//***********************************************************
      0x91, 8,        // Output (Data, Var, Abs)  //changed to 8 original is 2
//***********************************************************
      0xc0            // End Collection
   };


after I compiled the program, windows could not recognize, and said this is a new device.

please help
Guest








PostPosted: Thu Jan 27, 2005 9:53 pm     Reply with quote

young wrote:
I looked into the usb_desc.h file and changed here
Code:

  BYTE CONST USB_HID_DESC[] = {  //len=28
      6, 0, 255,    // Usage Page = Vendor Defined
      9, 1,            // Usage = IO device
      0xa1, 1,       // Collection = Application
      0x19, 1,        // Usage minimum
      0x29, 8,        // Usage maximum

      0x15, 0x80,        // Logical minimum (-128)
      0x25, 0x7F,        // Logical maximum (127)

      0x75, 8,        // Report size = 8 (bits)
      0x95, 2,        // Report count = 16 bits (2 bytes)
      0x81, 2,        // Input (Data, Var, Abs)
      0x19, 1,        // Usage minimum
      0x29, 8,        // Usage maximum
//***********************************************************
      0x91, 8,        // Output (Data, Var, Abs)  //changed to 8 original is 2
//***********************************************************
      0xc0            // End Collection
   };


after I compiled the program, windows could not recognize, and said this is a new device.

please help

This is not correct.
It sounds like you need to read the USB spec. It's availble for free, do a google search.
Guest








PostPosted: Fri Jan 28, 2005 7:31 am     Reply with quote

any idea where and how I should change the USB descriptor or may be I do not even need to change, but how I can set more data instead of just 2 bytes a time.
young



Joined: 24 Jun 2004
Posts: 285

View user's profile Send private message

PostPosted: Fri Jan 28, 2005 9:52 am     Reply with quote

I found it, it should be
0x95, 2, // Report count = 16 bits (2 bytes)
young



Joined: 24 Jun 2004
Posts: 285

View user's profile Send private message

PostPosted: Fri Jan 28, 2005 10:23 am     Reply with quote

I did with the usb_put_packet(ep1,data,8);

how can i sent data message more than 8 for example 20,or 30 bytes,

I tried usb_puts(ep1,data,30,8,10);

I just received the first 8 bytes, I did not receieve the following bytes, why
did I use usb_puts wrong?
Guest








PostPosted: Fri Jan 28, 2005 11:59 am     Reply with quote

any suggestions?
Guest








PostPosted: Fri Jan 28, 2005 1:47 pm     Reply with quote

I found a solution by sending data packet by packet. anyway, I did not find out usb_puts working if any one success to do that, please let me know.
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group