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 CCS Technical Support

Different hid descriptors in one device

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



Joined: 27 Oct 2009
Posts: 19

View user's profile Send private message

Different hid descriptors in one device
PostPosted: Wed Oct 28, 2009 7:35 pm     Reply with quote

Hi!
Is there any way to load my device with first hid descriptor if button is pressed (when power switched on) and with second descriptor is button is not pressed?

Smth like
Code:
void main (void)
{
    // init hardware

    if ( button_pressed )
    {
        descriptor = descriptor1;
    }
    else
    {
        descriptor = descriptor2;
    }

    usb_init_cs();

    while (1)
    {
        // do smth
    }
}



Thanks!
FvM



Joined: 27 Aug 2008
Posts: 2337
Location: Germany

View user's profile Send private message

PostPosted: Thu Oct 29, 2009 1:27 am     Reply with quote

Basically yes. You have to modify void usb_copy_desc_seg_to_ep() in usb.c.
KT315



Joined: 27 Oct 2009
Posts: 19

View user's profile Send private message

PostPosted: Thu Oct 29, 2009 2:59 am     Reply with quote

Emm.. Thanks!


And will there be any effect if i just change
Code:
const char USB_CLASS_SPECIFIC_DESC[] ...
const int16 USB_CLASS_SPECIFIC_DESC_LOOKUP[USB_NUM_CONFIGURATIONS][1]
const int16 USB_CLASS_SPECIFIC_DESC_LOOKUP_SIZE[USB_NUM_CONFIGURATIONS][2]

to
Code:
char USB_CLASS_SPECIFIC_DESC[] ...
int16 USB_CLASS_SPECIFIC_DESC_LOOKUP[USB_NUM_CONFIGURATIONS][1]
int16 USB_CLASS_SPECIFIC_DESC_LOOKUP_SIZE[USB_NUM_CONFIGURATIONS][2]


and edit main function like
Code:

const char my_descriptor2[] = { .... };

void main (void)
{
    // init hardware

    if ( button_pressed )
    {
        for( i =0; i< sizeof(my_descriptor2; i++)
        {
            USB_CLASS_SPECIFIC_DESC[i] = my_descriptor2[i];
        }
        // ..
    }

    usb_init_cs();

    while (1)
    {
        // do smth
    }
}
Rohit de Sa



Joined: 09 Nov 2007
Posts: 282
Location: India

View user's profile Send private message Visit poster's website

PostPosted: Sun Nov 01, 2009 5:25 am     Reply with quote

I'd like to know how this goes. I'd appreciate it if you could post code when you're done :-) Thanks!

Rohit
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