Fork us on GitHub Follow us on Facebook Follow us on Twitter

Changeset bbf79e0 in mainline


Ignore:
Timestamp:
2010-10-12T12:56:33Z (11 years ago)
Author:
Vojtech Horky <vojtechhorky@…>
Branches:
lfn, master
Children:
2193471
Parents:
e22ce0b
Message:

Virtual keyboard configuration separated

From now on, all descriptors etc. shall be located in kbdconfig.c file.

Location:
uspace/app/virtusbkbd
Files:
2 added
4 edited
1 moved

Legend:

Unmodified
Added
Removed
  • uspace/app/virtusbkbd/Makefile

    re22ce0b rbbf79e0  
    3636
    3737SOURCES = \
    38         report.c \
     38        kbdconfig.c \
    3939        virtusbkbd.c
    4040
  • uspace/app/virtusbkbd/items.h

    re22ce0b rbbf79e0  
    3838#include <sys/types.h>
    3939
    40 typedef uint8_t hid_descriptor_t[];
     40typedef uint8_t report_descriptor_data_t[];
    4141
    4242/* Item types. */
  • uspace/app/virtusbkbd/kbdconfig.c

    re22ce0b rbbf79e0  
    3232/**
    3333 * @file
    34  * @brief HIDE Report Descriptor.
     34 * @brief Keyboard configuration.
    3535 */
    36 #include "report.h"
     36#include "kbdconfig.h"
    3737#include <usb/hidut.h>
     38#include <usb/classes.h>
     39
     40/** Standard device descriptor. */
     41usb_standard_device_descriptor_t std_descriptor = {
     42        .length = sizeof(usb_standard_device_descriptor_t),
     43        .descriptor_type = 1,
     44        .usb_spec_version = 0x110,
     45        .device_class = USB_CLASS_HID,
     46        .device_subclass = 0,
     47        .device_protocol = 0,
     48        .max_packet_size = 64,
     49        .configuration_count = 1
     50};
     51size_t std_descriptor_size = sizeof(std_descriptor);
    3852
    3953/** USB keyboard report descriptor.
    4054 * Copied from USB HID 1.11 (section E.6).
    4155 */
    42 hid_descriptor_t report_descriptor = {
     56report_descriptor_data_t report_descriptor = {
    4357        STD_USAGE_PAGE(USB_HIDUT_PAGE_GENERIC_DESKTOP),
    4458        USAGE1(USB_HIDUT_USAGE_GENERIC_DESKTOP_KEYBOARD),
     
    7993        END_COLLECTION()
    8094};
     95size_t report_descriptor_size = sizeof(report_descriptor);
    8196
    82 size_t report_descriptor_size = sizeof(report_descriptor);
     97/** HID descriptor. */
     98hid_descriptor_t hid_descriptor = {
     99        .length = sizeof(hid_descriptor_t),
     100        .type = 0x21, // HID descriptor
     101        .hid_spec_release = 0x101,
     102        .country_code = 0,
     103        .descriptor_count = 1,
     104        .descriptor1_type = 0x22, // Report descriptor
     105        .descriptor1_length = sizeof(report_descriptor)
     106};
     107size_t hid_descriptor_size = sizeof(hid_descriptor);
     108
    83109
    84110
  • uspace/app/virtusbkbd/report.h

    re22ce0b rbbf79e0  
    7979        ITEM_CREATE1(ITEM_MAIN, TAG_OUTPUT, modifiers)
    8080
    81 extern hid_descriptor_t report_descriptor;
    82 extern size_t report_descriptor_size;
    8381
    8482#endif
  • uspace/app/virtusbkbd/virtusbkbd.c

    re22ce0b rbbf79e0  
    5252#include <usbvirt/ids.h>
    5353
    54 #include "report.h"
     54#include "kbdconfig.h"
    5555
    5656#define LOOPS 5
     
    8080        return EOK;
    8181}
    82 
    83 static usb_standard_device_descriptor_t std_descriptor = {
    84         .length = sizeof(usb_standard_device_descriptor_t),
    85         .descriptor_type = 1,
    86         .usb_spec_version = 0x110,
    87         .device_class = 0x03,
    88         .device_subclass = 0,
    89         .device_protocol = 0,
    90         .max_packet_size = 64,
    91         .configuration_count = 1
    92 };
    9382
    9483/** Keyboard callbacks.
Note: See TracChangeset for help on using the changeset viewer.