Giter VIP home page Giter VIP logo

csud's People

Contributors

chadderz121 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

csud's Issues

device mode

had a quick glance over the readme and other issues, and dont see a clear answer

does this driver support both host and device modes? or only host mode?

i'm interested in using it to emulate a usb device on an rpi4, where the dwc controller is routed to the USB-C port

Null pointer write in KeyboardPoll

It has been reported that the KeyboardPoll method has the side effect of overwritting addresses 0 and 4. Have not tested this myself, said to occur if the keyboard has no activiy for a short time. Not always written as 0. Presumably due to writing to a NULL pointer.

"packed" attribute missing on nested structs

I struggled many hours today to find out why the csud driver would initialize correctly but then fail to iterate the root hub. The problem was that since GCC4.4(?) the packed attribute has to be set on nested structs too if they need to be bit-packed. Example:

struct UsbConfigurationDescriptor {
    u8 DescriptorLength; // +0x0
    enum DescriptorType DescriptorType : 8; // +0x1
    u16 TotalLength; // +0x2
    u8 InterfaceCount; // +0x4
    u8 ConfigurationValue; // +0x5
    u8 StringIndex; // +0x6
    struct {
        unsigned _reserved0_4 : 5; // @0
        bool RemoteWakeup : 1; // @5
        bool SelfPowered : 1; // @6
        unsigned _reserved7 : 1; // @7
    } Attributes; // +0x7
    u8 MaximumPower; // +0x8
} __attribute__ ((__packed__));

sizeof(struct UsbConfigurationDescriptor) returns 12 for me, not 9 as the code implies. This breaks the descriptor discovery loop in UsbConfigure() because of wrong offsets.

Adding the packed attribute on the inner struct "Attributes" fixed the problem for me:

...
    struct {
        unsigned _reserved0_4 : 5; // @0
        bool RemoteWakeup : 1; // @5
        bool SelfPowered : 1; // @6
        unsigned _reserved7 : 1; // @7
    } __attribute__ ((__packed__)) Attributes; // +0x7
    u8 MaximumPower; // +0x8
} __attribute__ ((__packed__));

For reference, I am running GCC 4.7.4:
arm-none-eabi-gcc (GNU Tools for ARM Embedded Processors) 4.7.4 20130913 (release) [ARM/embedded-4_7-branch revision 202601]

Cheers,
Lukas

wchar_t warnings

Got a few of these warnings when compiling it into my code based on BakingPi.

arm-none-eabi-ld --no-undefined build/_start.o build/mailbox.o build/printk.o build/fb.o b
uild/gpio.o build/font_8x8.o build/fb_test.o build/main.o build/led.o build/timer.o -Map k
ernel.map -L libs -lcsud -o build/output.elf -T kernel.ld
arm-none-eabi-ld: warning: libs/libcsud.a(device.keyboard.c.o) uses 2-byte wchar_t yet the
 output is to use 4-byte wchar_t; use of wchar_t values across objects may fail
arm-none-eabi-ld: Warning: libs/libcsud.a(device.keyboard.c.o): Unknown EABI object attrib
ute 44

I see -fshort-wchar is used. Any reason for that? Should I include it also in my makefile?

Thanks for this driver (and your tutorial!). (Hit ctrl-enter accidentally.. Sorry for the partial submit)

Apostrophes and parens in intro text

On MacOS, apostrophes and parens in the makefile intro text (shown by the 'all' target) cause errors in the shell. eg:

James-MacBook:csud jamescone$ make
/bin/sh: -c: line 0: unexpected EOF while looking for matching `''
/bin/sh: -c: line 1: syntax error: unexpected end of file
make: *** [all] Error 2
James-MacBook:csud jamescone$

I ahve a patch, but the markup mangles it. I've failed to work out how to attach it.

Unable to compile

When I attempt to compile using "make driver config=FINAL type=LOWLEVEL target=RPI config=FINAL gnu=arm-none-eabi " I get the following:

make: *** No rule to make target 'build', needed by 'libcsud.a'. Stop.

Am I missing something? or is it just a misconfiguration?
Thanks in advance.

Out of memory!

Debug log:

CSUD: USB driver version 1.0
CSUD: HID driver version 1.0
CSUD: Hub driver version 1.0
CSUD: Keyboard driver version 1.0
CSUD: Mouse driver version 1.0
HCD: Reserving memory.
Platform: First memory allocation, reserving 16KiB of heap, 256 entries.
Platform: malloc(0x400) = 0xa9db8. (1023/16384)
Platform: Out of memory! We should've had more allocations in platform.c.
Platform: Out of memory! We should've had more allocations in platform.c.
HCD: Hardware: OT2.80a (BCM2708a)
HCD: Internal DMA mode.
HCD: Hardware configuration: 00000000 228ddd50 0ff000e8 1ff00020
HCD: Host configuration: 00200000
HCD: Disabling interrupts.
HCD: Powering USB on.
HCD: Load completed.
HCD: Start core.
Platform: Out of memory! We should've had more allocations in platform.c.
USBD: Abort, HCD failed to start.
Platform: free(0xa9db8) (-1/16384)

Unguarded if clause

source/device/hid/keyboard.c:163:7: warning: this 'if' clause does not guard... [-Wmisleading-indentation]

if (parse->Report[i]->Fields[j].Usage.Keyboard >= KeyboardLeftControl
&& parse->Report[i]->Fields[j].Usage.Keyboard <= KeyboardRightGui)
LOG_DEBUGF("KBD: Modifier %d detected! Offset=%x, size=%x\n", parse->Report[i]->Fields[j].Usage.Keyboard, parse->Report[i]->Fields[j].Offset, parse->Report[i]->Fields[j].Size);
data->KeyFields[(u16)parse->Report[i]->Fields[j].Usage.Keyboard - (u16)KeyboardLeftControl] =
&parse->Report[i]->Fields[j];

Are both lines supposed to be guarded by the if statement, or only the LOG_DEBUGF?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.