Touch your NetBSD

EuroBSDCon 2012 Warszawa, Poland [varˈʃ ava]

Pierre Pronchery

Sunday, October 21st 2012

Background information

This is the picture of some Vodka bottles in København (got competition there)

Background information

 Freelance IT-Security consultant DUEKIN Consulting [email protected]  OSDev hobbyist The DeforaOS Project [email protected]  NetBSD developer [email protected]  Based in Berlin, Germany

Agenda

I. The concept – DeforaOS Project – NetBSD II.Previous steps – Freerunner – AFULTab contest III.Current status – Demo – Technical details

IV.The future Concept: DeforaOS (1/2)

 Open Source project since 2005  Born from my frustration with the existing stuff:

 I just wanted to synchronize IRC chat logs between my two computers!  Rinse, repeat, apply (RSS, bookmarks, playlists, SCM, documents... possibly running programs)  Really:

 Ubiquitous computing  Seamless networking  All the more relevant today...

Concept: DeforaOS (2/2)

Three parts: 1.Self-hosted capability kernel, libc, assembler, compiler... 2.Distributed framework RPC, interfaces, services... 3. desktop, embedded devices... Portable, also meant to run on today's systems Not fully implemented...

Concept: NetBSD

IT'S OUT THERE!!1

(©™ Nike)

Concept: NetBSD

Discovered it at sysadmin school: – « Install and network three different Operating Systems together, sharing user data and authentication; to make it equally difficult to everyone, one of them has to be NetBSD 2.0 » ...but I liked it, using it daily since version 3.0 Personal preference:  Clean, portable, embedded, coherent  ...fun!

Concept: NetBSD on tablets

 Not really new: – – uep(4) – hpctp(4) – sstouch on s3c2440

 Existing touchscreen framework: tpcalib  No modern touchscreen driver though  No for calibration

Previous steps

Step: Openmoko Freerunner

 Worked with Bearstech on hackable:1  Debian-based GNU/ distribution, originally for the Openmoko Freerunner  released in 2008  ARM-based Open Source hardware  Ported the DeforaOS desktop for such embedded platforms  Eventually made it on HTC TouchPro and N900 as well

Step: AFULTab contest (1/3)

 AFUL is a French FOSS user group  Launched an international contest end of 2011:

 Create a 100% OSS tablet within 6 months  Guidelines for hardware: − 10” touchscreen, 6+ hours of battery life − Wireless support, mobile networking...  Planned to use the WeTab tablet  Prepared on a Lenovo IdeaPad S10-3t  Presented at FOSDEM 2012

Step: Back in February... (1/2)

 FOSDEM 2012, BSD Devroom  First functional demonstration:

 uts(4) driver committed (touchscreen)  Many shortcomings:

 Required some patches  Limited screen resolution  No wireless or mobile networking  Had not received the final hardware yet

Step: Back in February... (2/2)

 FOSDEM 2012, BSD Devroom (still)  It looked like this:

Step: WeTab hardware

● Intel Atom N450-based, 1.6 GHz, 1 GB RAM ● 11.6” multi-touch screen, 1366x768 ● Wireless chipset (Atheros) ● Huawei modem built-in, with GPS support ● , 2 USB ports, SD card slot ● 32 GB internal flash ● Front camera, MP

Step: AFULTab contest (2/3)

 A few months later...  Received the WeTab  Co-won the contest in May 2012!  Released extensive documentation: http://www.duekin.com/downloads/papers/WeTab%20Freedom%20Report.  Became a NetBSD developer in the process, khorben@ (breaking USB keyboard drivers since May 2012)

Step: AFULTab contest (3/3)

And it looked like this at the time: (Solutions Linux 2012, NetBSD booth)

Overview

Citroën GT concept car (probably under copyright)

Overview: Under the hood

Reminder: • NetBSD's kernel and base system • Packages from pkgsrc • Default to the DeforaOS embedded desktop Make it a real tablet experience: • Finger-based interaction • Look appealing! Here's my approach...

Overview: Today

Overview: Boot time (1/2)

Splash screen!

Overview: Boot time (2/2)

Splash screen on genfb(4), 800x600 at 16 bpp

 Particular JPEG format (not progressive) Silent boot through boot.cfg, boot -z: banner=Welcome to NetBSD [...] menu=Boot normally:rndseed /var/db/entropy-file;vesa 800x600x16;splash /deforaos.jpeg;boot /netbsd.gz -z menu=Boot normally (text mode):rndseed /var/db/entropy- file;boot /netbsd.gz menu=Boot single user:rndseed /var/db/entropy-file;boot /netbsd.gz -s menu=Disable ACPI:rndseed /var/db/entropy-file;boot /netbsd.gz -2 menu=Drop to boot prompt:prompt default=1 timeout=5

Overview: Instant use

Where “instant” means about 45 seconds (yay!) GDM auto-login:  Can be configured through the graphical user interface  Otherwise in /usr/pkg/etc/gdm/custom.conf: [] AutomaticLoginEnable=True AutomaticLogin=khorben

Overview: Calibration (1/2)

 Patch for wsconsctl, see PR kern/45872 $ wsconsctl -f /dev/wsmouse2 -ma type=touch-panel calibration.minx=0 calibration.miny=0 calibration.maxx=32767 calibration.maxy=32767 calibration.samples=0,0,0,0:32767,32767,1365,76 7:72,0,3,0:0,140,0,3 repeat.buttons=none repeat.delay.first=0 repeat.delay.decrement=0 repeat.delay.minimum=0

 No proper tool for initial calibration though Overview: Calibration (2/2)

Good to know: device mode through usbhidctl $ usbhidctl -f /dev/uhid1 \ Device_Configuration.Finger.Device_Mode=2

Overview: X11 support

 xf86-input-mouse needs support for absolute coordinates (through wscons)  Both base and pkgsrc should be patched now  Needs more work: wrong coordinates when the screen is rotated...

Overview: Gtk+ settings

• ~/.Xdefaults, set DPI: !Xft Xft*dpi: 132 • ~/.gtkrc-2.0, some possibilities: gtk-icon-sizes=...:panel-smaller=24,24:panel- small=32,32:panel-large=48,48 gtk-touchscreen-mode=1 • Additional tweaking through the Gtk+ engine: – Larger scrollbars... • Third button emulation: export GTK_MODULES=libgtkstylus.so

Overview: DeforaOS desktop (1/2)

● wip/deforaos-desktop, meta-package: – deforaos-browser deforaos-editor – deforaos-framer deforaos-keyboard – deforaos-locker deforaos-mixer – deforaos-panel deforaos-pdfviewer – deforaos-phone deforaos-player – deforaos-surfer deforaos-todo – libgtkstylus matchbox-wm (for now) • For embedded devices, set in /etc/mk.conf: PKG_DEFAULT_OPTIONS+=embedded

Overview: DeforaOS desktop (2/2)

User's ~/.Xclients file: #!/bin/sh export GTK_MODULES=libgtkstylus.so eval `ssh-agent -s` clipit & desktop & dhcpcd-gtk & locker & panel & phone & exec matchbox-window-manager -use_titlebar no \ -use_cursor no -use_desktop_mode plain

Overview: Screensaver, unlocking

Overview: powerd integration

• Panel notifications: _message() { DISPLAY=:0.0 /usr/bin/su -- "khorben" \ - "/etc/powerd/actions/message '$1' '$2'" } • Power management, /etc/powerd/scripts/*: _message -E 'All hell loose, power down.'

Overview: Mobile networking

DeforaOS Phone calls pppd in pty mode, see /etc/ppp/peers/phone: notty defaultroute local noauth usepeerdns mru 296 mtu 296 Name resolution via resolvconf(8), see the /etc/ppp/ip-up and ip-down scripts: [ “$USEPEERDNS” -eq 1 ] && /sbin/resolvconf -a “$1” \ < /etc/ppp/resolv.conf /sbin/resolvconf -d “$1”

Overview: Wireless networking

 dhcpcd-gtk from Roy Marples  In wpa_supplicant.conf, set: ctrl_interface=/var/run/wpa_supplicant ctrl_interface_group=wheel update_config=1  In rc.conf, set: dhcpcd=YES dhcpcd_flags=”-bq” wpa_supplicant=YES wpa_supplicant_flags="-B -iath0 -c/etc/wpa_supplicant.conf"

Overview: GPS support

• Add /dev/ttyU2 and /dev/ttyU3: # cd /dev && ./MAKEDEV ttyU2 ttyU3 • Enable the GPS plug-in in DeforaOS Phone • Click “Start” in the GPS preferences there • Install and configure geography/gpsd • Start wip/foxtrotgps: GLib (gthread-posix.c): Unexpected error from C library during 'pthread_mutex_unlock': Operation not permitted. Aborting. Abort trap (core dumped) • More work required...

Overview: Hardware support

 Fully supported:

 Video camera, uvideo(4)  Some issues remaining:

 Touchscreen, uts(4) (multi-touch...)  3G modem, u3g(4) (maybe not related)  Wireless support, ath(4) (likewise)  Video driver, x11/xf86-video-intel (HDMI output)  Needs more ♥

 GPS, via u3g(4) and wip/foxtrotgps  Power management (suspend, permissions)

Future

Future: I can haz potentialz

 NetBSD on the Nokia N900 (hi rhaamo!)  A NetBSD-based Open Source phone?

Future: DeforaOS on Github

Future: More on DeforaOS

• Make the ubiquitous seamless networking computing goodness happen! • Also, switch to Gtk+ 3: – Finger scrolling? – (almost ready) • Other ideas?

Future: But for now...

 DeforaOS Project, http://www.defora.org/  NetBSD Project, http://www.netbsd.org/  DUEKIN Consulting at http://www.duekin.com/  Myself at http://people.defora.org/~khorben/ @khorben on Twitter