Compare commits
24 Commits
basic-hack
...
1.0.1
Author | SHA1 | Date | |
---|---|---|---|
9ff52fcdb4 | |||
e7f01f4e55 | |||
04a85db303 | |||
61ad141830 | |||
8eacfa6717 | |||
80f2b487f0 | |||
a0f8b27841 | |||
d89fe933f3 | |||
794c231b0d | |||
fa4da6e9d7 | |||
6d3313bd3f | |||
ea210320c6 | |||
bdc4c8f9df | |||
8c1d716632 | |||
600b2a61fe | |||
2f61c061b7 | |||
ba4ca96253 | |||
a48a962653 | |||
ccac725b7f | |||
41ed68eb44 | |||
3d9dd08208 | |||
83d59dfc54 | |||
ce11e4173f | |||
f15ba1d3dc |
4
.gitmodules
vendored
4
.gitmodules
vendored
@ -3,7 +3,7 @@
|
||||
url = https://github.com/intel/tinycbor
|
||||
[submodule "python-fido2"]
|
||||
path = python-fido2
|
||||
url = https://github.com/SoloKeysSec/python-fido2
|
||||
url = https://github.com/solokeys/python-fido2
|
||||
[submodule "crypto/micro-ecc"]
|
||||
path = crypto/micro-ecc
|
||||
url = https://github.com/kmackay/micro-ecc.git
|
||||
@ -12,4 +12,4 @@
|
||||
url = https://github.com/kokke/tiny-AES-c
|
||||
[submodule "targets/stm32l442/dfuse-tool"]
|
||||
path = targets/stm32l442/dfuse-tool
|
||||
url = https://github.com/SoloKeysSec/dfuse-tool
|
||||
url = https://github.com/solokeys/dfuse-tool
|
||||
|
26
README.md
26
README.md
@ -1,7 +1,6 @@
|
||||

|
||||
[](https://solokeys.com/kickstarter)
|
||||
[](https://travis-ci.com/SoloKeysSec/solo)
|
||||
[](https://discourse.solokeys.com)
|
||||
[](https://github.com/solokeys/solo/blob/master/LICENSE)
|
||||
[](https://travis-ci.com/solokeys/solo)
|
||||
[](https://discourse.solokeys.com)
|
||||
[](https://keybase.io/team/solokeys.public)
|
||||
|
||||
|
||||
@ -35,20 +34,25 @@ Solo for Hacker is a special version of Solo that let you customize its firmware
|
||||
|
||||
You can only buy Solo for Hacker at [solokeys.com](https://solokeys.com), as we don't sell it on Amazon and other places to avoid confusing customers. If you buy a Hacker, you can permanently lock it into a regular Solo, but viceversa you can NOT take a regular Solo and turn it a Hacker.
|
||||
|
||||
If you have a Solo for Hacker, here's how you can load your own code on it. You can find more details, including how to permanently lock it, in our [documentation](https://solo.solokeys.io/building/).
|
||||
If you have a Solo for Hacker, here's how you can load your own code on it. You can find more details, including how to permanently lock it, in our [documentation](https://docs.solokeys.io/solo/building/).
|
||||
|
||||
```bash
|
||||
git clone --recurse-submodules https://github.com/SoloKeysSec/solo
|
||||
git clone --recurse-submodules https://github.com/solokeys/solo
|
||||
cd solo
|
||||
|
||||
cd targets/stm32l432
|
||||
make cbor
|
||||
make all-hacker
|
||||
python ../../tools/solotool.py program solo.hex
|
||||
cd ../..
|
||||
|
||||
make env3
|
||||
source env3/bin/activate
|
||||
python tools/solotool.py program targets/stm32l432/solo.hex
|
||||
```
|
||||
|
||||
If you forgot the `--recurse-submodules` when cloning, simply `git submodule update --init --recursive`.
|
||||
For example, if you want to turn off any blue light emission, you can edit [`led_rgb()`](https://github.com/SoloKeysSec/solo/blob/master/targets/stm32l432/src/led.c#L15) and force:
|
||||
|
||||
For example, if you want to turn off any blue light emission, you can edit [`led_rgb()`](https://github.com/solokeys/solo/blob/master/targets/stm32l432/src/led.c#L15) and force:
|
||||
```
|
||||
uint32_t b = 0;
|
||||
```
|
||||
@ -65,7 +69,7 @@ A frequently asked question is whether Solo for Hacker is less secure than regul
|
||||
Clone Solo and build it
|
||||
|
||||
```bash
|
||||
git clone --recurse-submodules https://github.com/SoloKeysSec/solo
|
||||
git clone --recurse-submodules https://github.com/solokeys/solo
|
||||
cd solo
|
||||
make all
|
||||
```
|
||||
@ -93,12 +97,12 @@ Or any client example such as:
|
||||
python python-fido2/examples/credential.py
|
||||
```
|
||||
|
||||
You can find more details in our [documentation](https://solo.solokeys.io), including how to build on the the NUCLEO-L432KC development board.
|
||||
You can find more details in our [documentation](https://docs.solokeys.io/solo/), including how to build on the the NUCLEO-L432KC development board.
|
||||
|
||||
|
||||
# Documentation
|
||||
|
||||
Check out our [official documentation](https://solo.solokeys.io).
|
||||
Check out our [official documentation](https://docs.solokeys.io/solo/).
|
||||
|
||||
|
||||
# Contributors
|
||||
|
@ -1,4 +0,0 @@
|
||||
Welcome to the technical documentation for [solokeyssec/solo](https://github.com/solokeyssec/solo).
|
||||
|
||||
For now, you can read the repository `README.md`, more documentation to come!
|
||||
|
@ -1 +0,0 @@
|
||||
../README.md
|
@ -68,6 +68,10 @@ reconnect each time you program Solo.
|
||||
python tools/solotool.py monitor <serial-port>
|
||||
```
|
||||
|
||||
#### Linux Users:
|
||||
|
||||
[See issue 62](https://github.com/solokeys/solo/issues/62).
|
||||
|
||||
### Building a Solo release
|
||||
|
||||
If you want to build a release of Solo, we recommend trying a Hacker build first
|
@ -1,6 +1,6 @@
|
||||
We are very open to contributions!
|
||||
|
||||
[Currently](https://github.com/solokeyssec/solo/issues), most work will go towards
|
||||
[Currently](https://github.com/solokeys/solo/issues), most work will go towards
|
||||
|
||||
* implementing STM32L432
|
||||
* implementing NFC
|
||||
@ -8,7 +8,7 @@ We are very open to contributions!
|
||||
|
||||
In the future, we would love to see creative plugins/extensions, putting the TRNG and other features of the STM32L432 to good use!
|
||||
|
||||
Feel free to send a [pull request](https://github.com/SoloKeysSec/solo/pulls) at any time, we don't currently have a formal contribution process.
|
||||
Feel free to send a [pull request](https://github.com/solokeys/solo/pulls) at any time, we don't currently have a formal contribution process.
|
||||
|
||||
If you want to discuss your plans in quasi-realtime beforehand, you can also join our [solokeys.public](https://keybase.io/team/solokeys.public) Keybase team.
|
||||
|
@ -21,7 +21,7 @@ When you register a service with a FIDO2 or U2F authenticator, the
|
||||
authenticator must generate a new keypair unique to that service. This keypair
|
||||
could be stored on the authenticator to be used in subsequent authentications,
|
||||
but now a certain amount of memory needs to be allocated for this. On embedded
|
||||
devices, there isn't much memory to spare and users will allows frustratingly
|
||||
devices, there isn't much memory to spare and users will always frustratingly
|
||||
hit the limit of this memory.
|
||||
|
||||
The answer to this problem is to do key wrapping. The authenticator just
|
BIN
docs/solo/images/favicon.ico
Normal file
BIN
docs/solo/images/favicon.ico
Normal file
Binary file not shown.
After Width: | Height: | Size: 15 KiB |
Before Width: | Height: | Size: 3.9 KiB After Width: | Height: | Size: 3.9 KiB |
4
docs/solo/index.md
Normal file
4
docs/solo/index.md
Normal file
@ -0,0 +1,4 @@
|
||||
Welcome to the technical documentation for [solokeys/solo](https://github.com/solokeys/solo).
|
||||
|
||||
For now, you can read the repository `README.md`, more documentation to come!
|
||||
|
1
docs/solo/repo-readme.md
Symbolic link
1
docs/solo/repo-readme.md
Symbolic link
@ -0,0 +1 @@
|
||||
../../README.md
|
@ -1,6 +1,6 @@
|
||||
# tl;dr
|
||||
|
||||
Create [`/etc/udev/99-solo.rules`](https://github.com/SoloKeysSec/solo/blob/master/99-solo.rules) and add the following (which assumes your user is in group `plugdev`):
|
||||
Create [`/etc/udev/99-solo.rules`](https://github.com/solokeys/solo/blob/master/99-solo.rules) and add the following (which assumes your user is in group `plugdev`):
|
||||
|
||||
```
|
||||
# Solo
|
||||
@ -69,4 +69,4 @@ udevadm trigger
|
||||
| U2F Zero | 0483 | a2ca |
|
||||
|
||||
## You got this all wrong, I can't believe it!
|
||||
Are you suffering from [us being wrong](https://xkcd.com/386/)? Please, send us a [pull request](https://github.com/SoloKeysSec/solo/pulls) and prove us wrong :D
|
||||
Are you suffering from [us being wrong](https://xkcd.com/386/)? Please, send us a [pull request](https://github.com/solokeys/solo/pulls) and prove us wrong :D
|
13
fido2/ctap.c
13
fido2/ctap.c
@ -1,21 +1,21 @@
|
||||
/*
|
||||
* Copyright (C) 2018 SoloKeys, Inc. <https://solokeys.com/>
|
||||
*
|
||||
*
|
||||
* This file is part of Solo.
|
||||
*
|
||||
*
|
||||
* Solo is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
*
|
||||
* Solo is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with Solo. If not, see <https://www.gnu.org/licenses/>
|
||||
*
|
||||
*
|
||||
* This code is available under licenses for commercial use.
|
||||
* Please contact SoloKeys for more information.
|
||||
*/
|
||||
@ -1030,7 +1030,8 @@ uint8_t ctap_get_assertion(CborEncoder * encoder, uint8_t * request, int length)
|
||||
}
|
||||
|
||||
printf1(TAG_GA,"resulting order of creds:\n");
|
||||
for (int j = 0; j < GA.credLen; j++)
|
||||
int j;
|
||||
for (j = 0; j < GA.credLen; j++)
|
||||
{
|
||||
printf1(TAG_GA,"CRED ID (# %d)\n", GA.creds[j].credential.id.count);
|
||||
}
|
||||
|
23
fido2/u2f.c
23
fido2/u2f.c
@ -1,21 +1,21 @@
|
||||
/*
|
||||
* Copyright (C) 2018 SoloKeys, Inc. <https://solokeys.com/>
|
||||
*
|
||||
*
|
||||
* This file is part of Solo.
|
||||
*
|
||||
*
|
||||
* Solo is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
*
|
||||
* Solo is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with Solo. If not, see <https://www.gnu.org/licenses/>
|
||||
*
|
||||
*
|
||||
* This code is available under licenses for commercial use.
|
||||
* Please contact SoloKeys for more information.
|
||||
*/
|
||||
@ -234,12 +234,15 @@ static int16_t u2f_authenticate(struct u2f_authenticate_request * req, uint8_t c
|
||||
}
|
||||
|
||||
count = ctap_atomic_count(0);
|
||||
|
||||
hash[0] = (count >> 24) & 0xff;
|
||||
hash[1] = (count >> 16) & 0xff;
|
||||
hash[2] = (count >> 8) & 0xff;
|
||||
hash[3] = (count >> 0) & 0xff;
|
||||
crypto_sha256_init();
|
||||
|
||||
crypto_sha256_update(req->app,32);
|
||||
crypto_sha256_update(&up,1);
|
||||
crypto_sha256_update((uint8_t *)&count,4);
|
||||
crypto_sha256_update(hash,4);
|
||||
crypto_sha256_update(req->chal,32);
|
||||
|
||||
crypto_sha256_final(hash);
|
||||
@ -248,7 +251,11 @@ static int16_t u2f_authenticate(struct u2f_authenticate_request * req, uint8_t c
|
||||
crypto_ecc256_sign(hash, 32, sig);
|
||||
|
||||
u2f_response_writeback(&up,1);
|
||||
u2f_response_writeback((uint8_t *)&count,4);
|
||||
hash[0] = (count >> 24) & 0xff;
|
||||
hash[1] = (count >> 16) & 0xff;
|
||||
hash[2] = (count >> 8) & 0xff;
|
||||
hash[3] = (count >> 0) & 0xff;
|
||||
u2f_response_writeback(hash,4);
|
||||
dump_signature_der(sig);
|
||||
|
||||
return U2F_SW_NO_ERROR;
|
||||
|
30
mkdocs.yml
30
mkdocs.yml
@ -1,21 +1,23 @@
|
||||
site_name: Solo
|
||||
site_name: Solo Technical Documentation
|
||||
site_author: SoloKeys
|
||||
site_description: 'Documentation for the SoloKeys solo software'
|
||||
repo_url: 'https://github.com/solokeyssec/solo'
|
||||
repo_name: 'solokeyssec/solo'
|
||||
copyright: 'Copyright © 2018 SoloKeys'
|
||||
site_url: 'https://docs.solokeys.io/solo/'
|
||||
repo_url: 'https://github.com/solokeys/solo'
|
||||
repo_name: 'solokeys/solo'
|
||||
copyright: 'Copyright © 2018 - 2019 SoloKeys'
|
||||
|
||||
nav:
|
||||
- Home: index.md
|
||||
- README.md: repo-readme.md
|
||||
- FIDO2 Implementation: fido2-impl.md
|
||||
- Signed update process: signed-updates.md
|
||||
- Building: building.md
|
||||
- Code documentation: code-overview.md
|
||||
- Contributing Code: contributing.md
|
||||
- Contributing Docs: documenting.md
|
||||
- What the udev?!: udev.md
|
||||
- Home: solo/index.md
|
||||
- FIDO2 Implementation: solo/fido2-impl.md
|
||||
- Build instructions: solo/building.md
|
||||
- Signed update process: solo/signed-updates.md
|
||||
- Code documentation: solo/code-overview.md
|
||||
- Contributing Code: solo/contributing.md
|
||||
- Contributing Docs: solo/documenting.md
|
||||
- udev Rules: solo/udev.md
|
||||
- About: solo/repo-readme.md
|
||||
|
||||
theme:
|
||||
name: material
|
||||
logo: 'images/logo.svg'
|
||||
logo: 'solo/images/logo.svg'
|
||||
favicon: 'solo/images/favicon.ico'
|
||||
|
@ -5,27 +5,27 @@ endif
|
||||
merge_hex=python ../../tools/solotool.py mergehex
|
||||
|
||||
all:
|
||||
$(MAKE) -f application.mk -j8 solo.hex DEBUG=$(DEBUG) EXTRA_DEFINES='-DFLASH_ROP=1'
|
||||
$(MAKE) -f application.mk -j8 solo.hex PREFIX=$(PREFIX) DEBUG=$(DEBUG) EXTRA_DEFINES='-DFLASH_ROP=1'
|
||||
|
||||
all-hacker:
|
||||
$(MAKE) -f application.mk -j8 solo.hex DEBUG=$(DEBUG) EXTRA_DEFINES='-DSOLO_HACKER -DFLASH_ROP=0'
|
||||
$(MAKE) -f application.mk -j8 solo.hex PREFIX=$(PREFIX) DEBUG=$(DEBUG) EXTRA_DEFINES='-DSOLO_HACKER -DFLASH_ROP=0'
|
||||
|
||||
all-locked:
|
||||
$(MAKE) -f application.mk -j8 solo.hex EXTRA_DEFINES='-DFLASH_ROP=2'
|
||||
$(MAKE) -f application.mk -j8 solo.hex PREFIX=$(PREFIX) EXTRA_DEFINES='-DFLASH_ROP=2'
|
||||
|
||||
debugboot-app:
|
||||
$(MAKE) -f application.mk -j8 solo.hex DEBUG=2 \
|
||||
$(MAKE) -f application.mk -j8 solo.hex DEBUG=2 PREFIX=$(PREFIX)\
|
||||
LDSCRIPT=linker/stm32l4xx_extra.ld EXTRA_DEFINES='-DAPPLICATION_START_PAGE=16 -DSOLO_HACKER'
|
||||
|
||||
debugboot-boot:
|
||||
$(MAKE) -f bootloader.mk -j8 bootloader.hex DEBUG=1 \
|
||||
$(MAKE) -f bootloader.mk -j8 bootloader.hex PREFIX=$(PREFIX) DEBUG=1 \
|
||||
LDSCRIPT=linker/bootloader_stm32l4xx_extra.ld EXTRA_DEFINES='-DAPPLICATION_START_PAGE=16 -DSOLO_HACKER'
|
||||
|
||||
boot-sig-checking:
|
||||
$(MAKE) -f bootloader.mk -j8 bootloader.hex DEBUG=0
|
||||
$(MAKE) -f bootloader.mk -j8 bootloader.hex PREFIX=$(PREFIX) DEBUG=0
|
||||
|
||||
boot-no-sig:
|
||||
$(MAKE) -f bootloader.mk -j8 bootloader.hex EXTRA_DEFINES='-DSOLO_HACKER' DEBUG=0
|
||||
$(MAKE) -f bootloader.mk -j8 bootloader.hex PREFIX=$(PREFIX) EXTRA_DEFINES='-DSOLO_HACKER' DEBUG=0
|
||||
|
||||
build-release-locked: clean2 boot-sig-checking clean all-locked
|
||||
$(merge_hex) solo.hex bootloader.hex all.hex
|
||||
|
@ -1,4 +1,4 @@
|
||||
# STM32L4xx Solo
|
||||
# STM32L432 Solo
|
||||
|
||||
Check out our [official documentation](https://solo.solokeys.io/building/)
|
||||
Check out our [official documentation](https://docs.solokeys.io/solo/building/)
|
||||
for instructions on building and programming!
|
||||
|
@ -1,7 +1,7 @@
|
||||
CC=arm-none-eabi-gcc
|
||||
CP=arm-none-eabi-objcopy
|
||||
SZ=arm-none-eabi-size
|
||||
AR=arm-none-eabi-ar
|
||||
CC=$(PREFIX)arm-none-eabi-gcc
|
||||
CP=$(PREFIX)arm-none-eabi-objcopy
|
||||
SZ=$(PREFIX)arm-none-eabi-size
|
||||
AR=$(PREFIX)arm-none-eabi-ar
|
||||
|
||||
# ST related
|
||||
SRC = src/main.c src/init.c src/redirect.c src/flash.c src/rng.c src/led.c src/device.c
|
||||
@ -17,7 +17,6 @@ SRC += ../../fido2/ctap_parse.c ../../fido2/main.c
|
||||
# Crypto libs
|
||||
SRC += ../../crypto/sha256/sha256.c ../../crypto/micro-ecc/uECC.c ../../crypto/tiny-AES-c/aes.c
|
||||
|
||||
|
||||
OBJ1=$(SRC:.c=.o)
|
||||
OBJ=$(OBJ1:.s=.o)
|
||||
|
||||
@ -48,7 +47,7 @@ DEFINES = -DDEBUG_LEVEL=$(DEBUG) -D$(CHIP) -DAES256=1 -DUSE_FULL_LL_DRIVER -DAP
|
||||
|
||||
CFLAGS=$(INC) -c $(DEFINES) -Wall -fdata-sections -ffunction-sections $(HW) -g
|
||||
LDFLAGS_LIB=$(HW) $(SEARCH) -specs=nano.specs -specs=nosys.specs -Wl,--gc-sections -u _printf_float -lnosys
|
||||
LDFLAGS=$(HW) $(LDFLAGS_LIB) -T$(LDSCRIPT) -Wl,-Map=$(TARGET).map,--cref -ltinycbor
|
||||
LDFLAGS=$(HW) $(LDFLAGS_LIB) -T$(LDSCRIPT) -Wl,-Map=$(TARGET).map,--cref -Wl,-Bstatic -ltinycbor
|
||||
|
||||
|
||||
.PRECIOUS: %.o
|
||||
|
@ -1,7 +1,7 @@
|
||||
CC=arm-none-eabi-gcc
|
||||
CP=arm-none-eabi-objcopy
|
||||
SZ=arm-none-eabi-size
|
||||
AR=arm-none-eabi-ar
|
||||
CC=$(PREFIX)arm-none-eabi-gcc
|
||||
CP=$(PREFIX)arm-none-eabi-objcopy
|
||||
SZ=$(PREFIX)arm-none-eabi-size
|
||||
AR=$(PREFIX)arm-none-eabi-ar
|
||||
|
||||
# ST related
|
||||
SRC = bootloader/main.c bootloader/bootloader.c
|
||||
@ -46,7 +46,7 @@ DEFINES = -DDEBUG_LEVEL=$(DEBUG) -D$(CHIP) -DAES256=1 -DUSE_FULL_LL_DRIVER -DAP
|
||||
|
||||
CFLAGS=$(INC) -c $(DEFINES) -Wall -fdata-sections -ffunction-sections $(HW) -g
|
||||
LDFLAGS_LIB=$(HW) $(SEARCH) -specs=nano.specs -specs=nosys.specs -Wl,--gc-sections -lnosys
|
||||
LDFLAGS=$(HW) $(LDFLAGS_LIB) -T$(LDSCRIPT) -Wl,-Map=$(TARGET).map,--cref
|
||||
LDFLAGS=$(HW) $(LDFLAGS_LIB) -T$(LDSCRIPT) -Wl,-Map=$(TARGET).map,--cref -Wl,-Bstatic
|
||||
|
||||
|
||||
.PRECIOUS: %.o
|
||||
|
@ -213,7 +213,7 @@ static uint8_t USBD_Composite_Init (USBD_HandleTypeDef *pdev, uint8_t cfgidx) {
|
||||
|
||||
static uint8_t USBD_Composite_DeInit (USBD_HandleTypeDef *pdev, uint8_t cfgidx) {
|
||||
int i;
|
||||
for(int i = 0; i < NUM_INTERFACES; i++) {
|
||||
for(i = 0; i < NUM_INTERFACES; i++) {
|
||||
if (USBD_Classes[i]->DeInit(pdev, cfgidx) != USBD_OK) {
|
||||
return USBD_FAIL;
|
||||
}
|
||||
|
@ -56,11 +56,15 @@
|
||||
#ifndef SOLO_HACKER
|
||||
#define USBD_MANUFACTURER_STRING "Solo Keys"
|
||||
#define USBD_PRODUCT_FS_STRING "Solo"
|
||||
#define USBD_SERIAL_NUM "solocafebabe"
|
||||
#ifndef USBD_SERIAL_NUM
|
||||
#define USBD_SERIAL_NUM "0123456789ABCDEF"
|
||||
#endif
|
||||
#else
|
||||
#define USBD_MANUFACTURER_STRING "Solo Keys"
|
||||
#define USBD_PRODUCT_FS_STRING "Solo HACKER (Unlocked)"
|
||||
#define USBD_SERIAL_NUM "solocafebabe"
|
||||
#ifndef USBD_SERIAL_NUM
|
||||
#define USBD_SERIAL_NUM "0123456789ABCDEF"
|
||||
#endif
|
||||
#endif
|
||||
|
||||
uint8_t *USBD_HID_DeviceDescriptor(USBD_SpeedTypeDef speed, uint16_t *length);
|
||||
|
@ -114,15 +114,10 @@ USBD_ClassTypeDef USBD_HID =
|
||||
NULL,
|
||||
|
||||
|
||||
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
// USBD_HID_GetFSCfgDesc,
|
||||
// USBD_HID_GetFSCfgDesc,
|
||||
// USBD_HID_GetFSCfgDesc,
|
||||
// USBD_HID_GetDeviceQualifierDesc,
|
||||
USBD_HID_GetFSCfgDesc,
|
||||
USBD_HID_GetFSCfgDesc,
|
||||
USBD_HID_GetFSCfgDesc,
|
||||
USBD_HID_GetDeviceQualifierDesc,
|
||||
};
|
||||
|
||||
#define USBD_HID_CfgHSDesc USBD_HID_OtherSpeedCfgDesc
|
||||
@ -250,38 +245,38 @@ void usb_hid_recieve_callback(uint8_t ep)
|
||||
HID_PACKET_SIZE);
|
||||
}
|
||||
|
||||
static void dump_pma()
|
||||
{
|
||||
|
||||
register uint32_t _wRegBase = (uint32_t)USB;
|
||||
_wRegBase += (uint32_t)(USB)->BTABLE + 0x400;
|
||||
|
||||
uint16_t * pma_ptr = (uint16_t *)_wRegBase;
|
||||
uint16_t val;
|
||||
uint32_t offset = (uint32_t)(USB)->BTABLE;
|
||||
|
||||
printf1(TAG_GREEN,"btable: %02lx\r\n",offset);
|
||||
|
||||
for (int i = 0; i < 2; i++)
|
||||
{
|
||||
uint16_t addr_tx = pma_ptr[i * 4 + 0];
|
||||
uint16_t cnt_tx = pma_ptr[i * 4 + 1];
|
||||
uint16_t addr_rx = pma_ptr[i * 4 + 2];
|
||||
uint16_t cnt_rx = pma_ptr[i * 4 + 3];
|
||||
|
||||
printf1(TAG_GREEN,"EP%d addr_tx == %02x, count_tx == %02x\r\n", i, addr_tx,cnt_tx );
|
||||
printf1(TAG_GREEN,"EP%d addr_rx == %02x, count_rx == %02x\r\n", i, addr_rx,cnt_rx );
|
||||
}
|
||||
|
||||
uint16_t ep1_tx = pma_ptr[1 * 4 + 0];
|
||||
|
||||
for (int i = 0; i < 32; i++)
|
||||
{
|
||||
val = pma_ptr[ep1_tx + i];
|
||||
printf1(TAG_GREEN,"%04x ",val);
|
||||
}
|
||||
printf1(TAG_GREEN,"\r\n");
|
||||
}
|
||||
// static void dump_pma()
|
||||
// {
|
||||
//
|
||||
// register uint32_t _wRegBase = (uint32_t)USB;
|
||||
// _wRegBase += (uint32_t)(USB)->BTABLE + 0x400;
|
||||
//
|
||||
// uint16_t * pma_ptr = (uint16_t *)_wRegBase;
|
||||
// uint16_t val;
|
||||
// uint32_t offset = (uint32_t)(USB)->BTABLE;
|
||||
//
|
||||
// printf1(TAG_GREEN,"btable: %02lx\r\n",offset);
|
||||
//
|
||||
// for (int i = 0; i < 2; i++)
|
||||
// {
|
||||
// uint16_t addr_tx = pma_ptr[i * 4 + 0];
|
||||
// uint16_t cnt_tx = pma_ptr[i * 4 + 1];
|
||||
// uint16_t addr_rx = pma_ptr[i * 4 + 2];
|
||||
// uint16_t cnt_rx = pma_ptr[i * 4 + 3];
|
||||
//
|
||||
// printf1(TAG_GREEN,"EP%d addr_tx == %02x, count_tx == %02x\r\n", i, addr_tx,cnt_tx );
|
||||
// printf1(TAG_GREEN,"EP%d addr_rx == %02x, count_rx == %02x\r\n", i, addr_rx,cnt_rx );
|
||||
// }
|
||||
//
|
||||
// uint16_t ep1_tx = pma_ptr[1 * 4 + 0];
|
||||
//
|
||||
// for (int i = 0; i < 32; i++)
|
||||
// {
|
||||
// val = pma_ptr[ep1_tx + i];
|
||||
// printf1(TAG_GREEN,"%04x ",val);
|
||||
// }
|
||||
// printf1(TAG_GREEN,"\r\n");
|
||||
// }
|
||||
|
||||
/**
|
||||
* @brief USBD_HID_Init
|
||||
|
@ -71,6 +71,6 @@ void hw_init(void);
|
||||
#define SOLO_BUTTON_PIN LL_GPIO_PIN_0
|
||||
|
||||
#define SKIP_BUTTON_CHECK_WITH_DELAY 0
|
||||
#define SKIP_BUTTON_CHECK_FAST 1
|
||||
#define SKIP_BUTTON_CHECK_FAST 0
|
||||
|
||||
#endif
|
||||
|
@ -208,7 +208,7 @@ void usb_init()
|
||||
// Enable USB Clock
|
||||
SET_BIT(RCC->APB1ENR1, RCC_APB1ENR1_USBFSEN);
|
||||
|
||||
|
||||
#if DEBUG_LEVEL > 0
|
||||
USBD_Composite_Set_Classes(&USBD_HID, &USBD_CDC);
|
||||
in_endpoint_to_class[HID_EPIN_ADDR & 0x7F] = 0;
|
||||
out_endpoint_to_class[HID_EPOUT_ADDR & 0x7F] = 0;
|
||||
@ -222,6 +222,10 @@ void usb_init()
|
||||
//
|
||||
// USBD_RegisterClass(&Solo_USBD_Device, &USBD_CDC);
|
||||
USBD_CDC_RegisterInterface(&Solo_USBD_Device, &USBD_Interface_fops_FS);
|
||||
#else
|
||||
USBD_Init(&Solo_USBD_Device, &Solo_Desc, 0);
|
||||
USBD_RegisterClass(&Solo_USBD_Device, &USBD_HID);
|
||||
#endif
|
||||
|
||||
USBD_Start(&Solo_USBD_Device);
|
||||
}
|
||||
|
Reference in New Issue
Block a user