Browsed by
Author: Jon Steege

ESP32-2432S028 and Ubuntu 22.04 Error with Arduino IDE and ttyUSB0 not connecting

ESP32-2432S028 and Ubuntu 22.04 Error with Arduino IDE and ttyUSB0 not connecting

I just received an ESP32-2432S028 in the mail and plugged it in to USB and fired up the Arduino IDE to try and mess with it. But no dice.. It turns out this particular dev board uses CH341 serial to USB converter, for which a standard driver is in fact included with the kernal. DMESG reports the device gets connected as ttyUSB0, but then the following happens:


[1089016.769711] usb 1-12: USB disconnect, device number 7
[1089026.049960] usb 1-12: new full-speed USB device number 8 using xhci_hcd
[1089026.341566] usb 1-12: New USB device found, idVendor=1a86, idProduct=7523, bcdDevice=81.33
[1089026.341575] usb 1-12: New USB device strings: Mfr=0, Product=2, SerialNumber=0
[1089026.341580] usb 1-12: Product: USB Serial
[1089026.350406] ch341 1-12:1.0: ch341-uart converter detected
[1089026.364430] usb 1-12: ch341-uart converter now attached to ttyUSB0
[1089026.965382] input: BRLTTY 6.4 Linux Screen Driver Keyboard as /devices/virtual/input/input105
[1089027.081355] usb 1-12: usbfs: interface 0 claimed by ch341 while 'brltty' sets config #1
[1089027.088620] ch341-uart ttyUSB0: ch341-uart converter now disconnected from ttyUSB0
[1089027.088678] ch341 1-12:1.0: device disconnected


Sadly, or perhaps rather not for accesibility sake, the device gets identified as a screen based keyboard by the Braile TTY system, and disconnects the CH341 in favor of using the screen keyboard through BRLTTY.

If you are not a blind person, then it is unlikely you need BRLTTY, and in this case, the fix is to simply remove the BRLTTY system to get back to the ch341 getting used directly and not substituted out by BRLTTY. To do this, simply execute sudo apt remove brltty and then re-connect

Retrieving files from GoPro 9 on Linux

Retrieving files from GoPro 9 on Linux

To retrieve files from a GoPro 9 Black on linux, you need to change a default factory setting on the camera. The setting is under Connections -> USB, and you need to change the connection type from “gopro connect” to “MTP”. Once you do that, you can plug your gopro into a USB 3 or USB-c port and transfer files from a mounted file directory. Most modern distros recognize it as a cell-phone device. From there, the files can be found by double clicking the Hero9 item in the file chooser, and then by going to the DCIM folder.

Spring Security 5 OIDC login with Onelogin

Spring Security 5 OIDC login with Onelogin

I recently did an integration with Spring Security 5 and Spring Boot 2 using onelogin as the OIDC provider. I was having many issues getting Spring Oauth to just work, so here are some notes about how I made it work in onelogin. In particular, I had many issues, after going through the whole flow, while calling the token endpoint to finally get an auth token. Which ends up being pretty well all the way to the end of the regular flow.

The error I was getting was:

Authentication request failed: org.springframework.security.oauth2.core.OAuth2AuthenticationException: [invalid_token_response] An error occurred while attempting to retrieve the OAuth 2.0 Access Token Response: 401 Unauthorized

The first thing you will need is the following dependencies on your classpath:

implementation("org.springframework.boot:spring-boot-starter-security")
implementation ("org.springframework.security:spring-security-oauth2-client:5.3.4.RELEASE")
implementation ("org.springframework.security:spring-security-oauth2-jose:5.3.4.RELEASE")
implementation("org.springframework.boot:spring-boot-starter-web")

Next, you need to make sure you have all (3!) of your application.yml attributes to allow spring boot to autoconfig your client. IT should look about like this:

spring:
  application:
    name: demo-oauth-oidc
  thymeleaf:
    cache: false
  security:
    oauth2:
      client:
        provider:
          onelogin:
            issuer-uri: https://<my domain>.onelogin.com/oidc/2
        registration:
          onelogin:
            client-id: <onelogin client id>
            client-secret: <onelogin secret>

Note above, under provider and registration, I used the same word, onelogin. This ends up being how you can refer to that particular auth mechanism in many places in the code, as well as the associated URLs in the system for that scheme. If you want to use multiple auth schemes, you can simply add additional new entities under provider and registration sections with unique names.

Once you have those dependencies, you need to configure onelogin from within the onelogin tile configuration system to allow spring to interact. The following settings need to be set:

  • Set your login URL in onelogin Configuration
    • <myUrl>/oauth2/authorization/onelogin
  • Set your redirect URLs in onelogin Configuration
    • <myUrl>/login/oauth2/code/onelogin
  • In the onelogin SSO section, set application type = web
  • In the onelogin SSO section, set Token Endpoint Authentication method to Basic

Once you have all these things in place, you should be able to ./gradlew bootRun your app and navigate to <myurl>/login to initiate the onelogin oauth SSO OICD process!