diff --git a/CMakeLists.txt b/CMakeLists.txt index 750ccac..830715e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,7 +1,10 @@ cmake_minimum_required(VERSION 3.13) set(PROJECT webkeyboard) set(PICO_SDK_PATH /home/kenji/programming/pico/c/pico-sdk) -set(PICO_BOARD pico_w) +if (NOT DEFINED PICO_BOARD) + set(PICO_BOARD pico_w) +endif() +#set(PICO_BOARD pico2_w) include (${PICO_SDK_PATH}/external/pico_sdk_import.cmake) project(${PROJECT} C CXX ASM) @@ -38,6 +41,8 @@ target_sources(${PROJECT} PRIVATE pico_enable_stdio_usb(${PROJECT} 1) +set_target_properties(${PROJECT} PROPERTIES OUTPUT_NAME "${PROJECT}-${PICO_BOARD}") + pico_add_extra_outputs(${PROJECT}) target_include_directories(${PROJECT} PRIVATE ${CMAKE_CURRENT_LIST_DIR}) diff --git a/README.md b/README.md index b794f3c..376eb4d 100644 --- a/README.md +++ b/README.md @@ -2,11 +2,11 @@ ## About -This project turns a Raspberry Pi Pico W into a web-based USB HID keyboard -device. Users can access a webpage served over HTTP to enter keyboard input -onto the host device of the Raspberry Pi Pico W. Input keys can be entered -through a keyboard on the client device or by pressing on the keys on the -graphical interface served on the webpage. +This project turns a Raspberry Pi Pico W or Raspberry Pi Pico 2 W into a +web-based USB HID keyboard device. Users can access a webpage served over HTTP +to enter keyboard input onto the host device of the Raspberry Pi Pico (2) W. +Input keys can be entered through a keyboard on the client device or by +pressing on the keys on the graphical interface served on the webpage. ![Web interface for Web Keyboard](web-ui.jpg) @@ -14,18 +14,19 @@ graphical interface served on the webpage. [Installation and demo video](https://youtu.be/uORnxt5DLTw) -Download the webkeyboard.uf2 file from the latest +Download the appropriate firmware file for your board, either +webkeyboard-pico_w.uf2 or webkeyboard-pico2_w.uf2, from the latest [release](https://git.kkozai.com/kenji/webkeyboard/releases) and flash -onto the Raspberry Pi Pico W by holding down the BOOTSEL button while plugging -into your computer so that it appears as a USB drive, then transfer the -firmware file onto the Pico W. After unmounting, connect the Raspberry Pi Pico -W with a micro USB cable to the host computer or other device. +onto the Raspberry Pi Pico (2) W by holding down the BOOTSEL button while +plugging into your computer so that it appears as a USB drive, then transfer the +firmware file onto the Pico (2) W. After unmounting, connect the Raspberry Pi +Pico (2) W with a micro USB cable to the host computer or other device. -On initial boot, the Raspberry Pi Pico W will enter Access Point mode with +On initial boot, the Raspberry Pi Pico (2) W will enter Access Point mode with SSID "picokb" and password "password". Connect to this network with another device and open a browser window to http://192.168.0.1. Go to the "Configure W-Fi" page and enter the SSID and password to the -network that you would like the Raspberry Pi Pico W to connect. Optionally, +network that you would like the Raspberry Pi Pico (2) W to connect. Optionally, also enter a hostname for the device and static IP information. Hit the "Save" button to save the network information to device flash. diff --git a/usb_descriptors.c b/usb_descriptors.c index 2efd843..9f0699d 100644 --- a/usb_descriptors.c +++ b/usb_descriptors.c @@ -86,7 +86,7 @@ uint8_t const desc_fs_configuration[] = // Interface number, string index, protocol, report descriptor len, EP In address, size & polling interval TUD_CDC_DESCRIPTOR(ITF_NUM_CDC, 4, EPNUM_CDC_NOTIF, 8, EPNUM_CDC_OUT, EPNUM_CDC_IN, 64), - TUD_HID_DESCRIPTOR(ITF_NUM_HID, 5, HID_ITF_PROTOCOL_NONE, sizeof(desc_hid_report), EPNUM_HID, CFG_TUD_HID_EP_BUFSIZE, 5), + TUD_HID_DESCRIPTOR(ITF_NUM_HID, 5, HID_ITF_PROTOCOL_NONE, sizeof(desc_hid_report), EPNUM_HID, CFG_TUD_HID_EP_BUFSIZE, 8), }; // Invoked when received GET CONFIGURATION DESCRIPTOR @@ -110,6 +110,8 @@ char const* string_desc_arr [] = "Raspberry Pi", // 1: Manufacturer "Pico Web Keyboard", // 2: Product NULL, // 3: Serials, should use chip ID + "Pico Web Keyboard CDC", // 4: CDC + "Pico Web Keyboard HID", // 5: HID }; static uint16_t _desc_str[32+1]; diff --git a/usb_descriptors.h b/usb_descriptors.h index 84f9488..c62af77 100644 --- a/usb_descriptors.h +++ b/usb_descriptors.h @@ -41,7 +41,7 @@ enum ITF_NUM_TOTAL }; -#define USB_PID 0x0ebd +#define USB_PID 0x0EBD #define USB_VID 0xCEC0 #define USB_BCD 0x0200