Client libraries, integration examples, and advanced capture solutions for the INSEN Controller Interface.
Professional-grade cyber security tools and advanced capture solutions for penetration testers, security researchers, and digital forensics professionals.
Access cutting-edge penetration testing tools, network analysis software, and digital forensics solutions. Secure crypto payments, instant delivery, and lifetime support.
Cross-platform C library with full API coverage, error handling, and real-time monitoring capabilities.
Go implementation demonstrating controller monitoring with modern Go practices and concurrent design.
Professional Python-based management tool with firmware flashing, monitoring, and diagnostics.
Complete client libraries and examples for all major programming languages
Node.js client library with serialport integration
Python client with asyncio and pyserial support
Modern C++ implementation with CMake build system
Low-level C library for embedded systems
Concurrent Go implementation with goroutines
Memory-safe Rust client with Cargo package
Cross-platform Java library with Maven build
Browse all repositories and examples
This example demonstrates how to use the C client library to monitor controller input in real-time. The library provides a complete API for communicating with the INSEN firmware.
# Linux/macOS
make
# Windows (MinGW)
gcc -o insen_example.exe example.c insen_client.c
# Run example
./insen_example /dev/ttyUSB0
#include <stdio.h>
#include <stdlib.h>
#include <signal.h>
#include "insen_client.h"
static volatile int running = 1;
void signal_handler(int sig) {
printf("\\nShutting down...\\n");
running = 0;
}
int main(int argc, char* argv[]) {
if (argc < 2) {
printf("Usage: %s <port>\\n", argv[0]);
return 1;
}
// Set up signal handler
signal(SIGINT, signal_handler);
// Initialize INSEN client
insen_client_t client;
int result = insen_init(&client, argv[1]);
if (result != INSEN_SUCCESS) {
printf("Failed to connect: %s\\n",
insen_get_error_string(result));
return 1;
}
printf("✓ Connected to INSEN device!\\n");
// Monitor controllers
while (running) {
insen_controller_state_t state;
result = insen_get_controller_input(&client, 0, &state);
if (result == INSEN_SUCCESS) {
printf("Left: X=%6d Y=%6d | Right: X=%6d Y=%6d\\n",
state.left_stick_x, state.left_stick_y,
state.right_stick_x, state.right_stick_y);
}
usleep(10000); // 100Hz polling
}
insen_cleanup(&client);
return 0;
}
A clean Go implementation that demonstrates modern Go practices for serial communication and controller monitoring.
# Initialize Go module
go mod init insen-client
go get go.bug.st/serial
# Run example
go run main.go /dev/ttyUSB0
package main
import (
"bufio"
"context"
"fmt"
"log"
"os"
"os/signal"
"strings"
"time"
"go.bug.st/serial"
)
type INSENClient struct {
port serial.Port
}
func NewINSENClient(portName string) (*INSENClient, error) {
mode := &serial.Mode{
BaudRate: 115200,
Parity: serial.NoParity,
DataBits: 8,
StopBits: serial.OneStopBit,
}
port, err := serial.Open(portName, mode)
if err != nil {
return nil, fmt.Errorf("failed to open port: %w", err)
}
return &INSENClient{port: port}, nil
}
func (c *INSENClient) SendCommand(cmd string) (string, error) {
_, err := c.port.Write([]byte(cmd + "\\n"))
if err != nil {
return "", err
}
scanner := bufio.NewScanner(c.port)
if scanner.Scan() {
return scanner.Text(), nil
}
return "", fmt.Errorf("no response received")
}
func (c *INSENClient) MonitorController(ctx context.Context, id int) {
ticker := time.NewTicker(10 * time.Millisecond) // 100Hz
defer ticker.Stop()
for {
select {
case <-ctx.Done():
return
case <-ticker.C:
response, err := c.SendCommand(fmt.Sprintf("GET %d", id))
if err != nil {
log.Printf("Error getting controller data: %v", err)
continue
}
if strings.HasPrefix(response, "INPUT") {
fmt.Printf("Controller %d: %s\\n", id, response)
}
}
}
}
func main() {
if len(os.Args) < 2 {
fmt.Printf("Usage: %s <port>\\n", os.Args[0])
os.Exit(1)
}
client, err := NewINSENClient(os.Args[1])
if err != nil {
log.Fatalf("Failed to create client: %v", err)
}
defer client.port.Close()
// Setup graceful shutdown
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
c := make(chan os.Signal, 1)
signal.Notify(c, os.Interrupt)
go func() {
<-c
log.Println("Shutting down...")
cancel()
}()
// Get firmware info
info, err := client.SendCommand("INFO")
if err != nil {
log.Fatalf("Failed to get info: %v", err)
}
fmt.Printf("INSEN Info: %s\\n", info)
// Monitor controller 0
client.MonitorController(ctx, 0)
}
The Python AIO (All-In-One) tool provides a complete solution for firmware management, monitoring, and diagnostics.
# Flash firmware
python insen_aio.py flash
# Monitor controllers
python insen_aio.py monitor
# Setup wizard
python insen_aio.py setup
# GUI mode
python insen_aio.py gui
#!/usr/bin/env python3
"""
INSEN All-In-One Tool
Professional controller interface management
"""
import serial
import time
import argparse
import sys
from typing import Optional, Dict, Any
class INSENDevice:
def __init__(self, port: str, baudrate: int = 115200):
self.port_name = port
self.baudrate = baudrate
self.connection: Optional[serial.Serial] = None
def connect(self) -> bool:
"""Connect to INSEN device"""
try:
self.connection = serial.Serial(
self.port_name,
self.baudrate,
timeout=1.0
)
return True
except Exception as e:
print(f"Connection failed: {e}")
return False
def send_command(self, cmd: str) -> Optional[str]:
"""Send command and get response"""
if not self.connection:
return None
try:
self.connection.write(f"{cmd}\\n".encode())
response = self.connection.readline().decode().strip()
return response
except Exception as e:
print(f"Command failed: {e}")
return None
def get_firmware_info(self) -> Dict[str, Any]:
"""Get firmware information"""
info = self.send_command("INFO")
if info:
parts = info.split("|")
return {
"version": parts[0] if len(parts) > 0 else "Unknown",
"build_date": parts[1] if len(parts) > 1 else "Unknown",
"makcu_compatible": "MAKCU_COMPATIBLE" in info,
"status": "OK" if "STATUS_OK" in info else "Error"
}
return {}
def monitor_controllers(self):
"""Monitor controller input in real-time"""
print("Starting controller monitoring... Press Ctrl+C to stop")
print("=" * 50)
try:
while True:
# Get controller list
controllers = self.send_command("LIST")
if controllers and "CONTROLLERS" in controllers:
# Monitor each controller
for i in range(4): # Support up to 4 controllers
input_data = self.send_command(f"GET {i}")
if input_data and "INPUT" in input_data:
print(f"Controller {i}: {input_data}")
time.sleep(0.01) # 100Hz polling
except KeyboardInterrupt:
print("\\nMonitoring stopped")
def flash_firmware(self, firmware_path: str):
"""Flash firmware to device"""
print(f"Flashing firmware: {firmware_path}")
print("This feature requires esptool.py integration")
# Implementation would use esptool.py for flashing
def disconnect(self):
"""Disconnect from device"""
if self.connection:
self.connection.close()
self.connection = None
def main():
parser = argparse.ArgumentParser(description="INSEN AIO Tool")
parser.add_argument("action", choices=["flash", "monitor", "setup", "info"])
parser.add_argument("--port", default="/dev/ttyUSB0", help="Serial port")
parser.add_argument("--firmware", help="Firmware file for flashing")
args = parser.parse_args()
# Create device instance
device = INSENDevice(args.port)
if not device.connect():
print("Failed to connect to INSEN device")
sys.exit(1)
try:
if args.action == "info":
info = device.get_firmware_info()
print("INSEN Firmware Information:")
for key, value in info.items():
print(f" {key}: {value}")
elif args.action == "monitor":
device.monitor_controllers()
elif args.action == "flash":
if args.firmware:
device.flash_firmware(args.firmware)
else:
print("Please specify firmware file with --firmware")
elif args.action == "setup":
print("INSEN Setup Wizard")
print("This will guide you through initial configuration")
finally:
device.disconnect()
if __name__ == "__main__":
main()
INSEN supports text-based serial commands for easy integration:
INFO
Get firmware information
STATUS
Get system status
LIST
List connected controllers
GET <id>
Get controller input data
Controller input responses include all necessary data:
INPUT|0|-1234,5678|890,-2345|128,64|0x000F|3|85|1234567
Format:
- Controller ID
- Left stick X,Y
- Right stick X,Y
- Left trigger, Right trigger
- Button bitmask (hex)
- D-pad state
- Battery level
- Timestamp
Standard serial configuration for all platforms: