Make Your Own USB Gadget Kernel and Userspace

Total Page:16

File Type:pdf, Size:1020Kb

Make Your Own USB Gadget Kernel and Userspace USB gadget Congfs Userspace Make your own USB gadget Kernel and userspace Andrzej Pietrasiewicz Samsung R&D Institute Poland Warsaw, Poland [email protected] August 20, 2014 LinuxCon North America 2014 Make your own USB gadget 1 / 34 USB gadget Congfs Userspace Table of Contents 1 USB gadget USB and functions USB gadget Gadget implementation in Linux 2 Congfs The idea, example On implementation Status 3 Userspace libusbg & tools gadgetd & application API 4 Q&A LinuxCon North America 2014 Make your own USB gadget 2 / 34 USB gadget USB and functions Congfs USB gadget Userspace Gadget implementation in Linux host += function flash drive USB: host, device 4G MODEM 16 GB extend the host with some function(s) LinuxCon North America 2014 Make your own USB gadget 3 / 34 USB gadget USB and functions Congfs USB gadget Userspace Gadget implementation in Linux USB device composition CONFIG 1 CONFIG 2 CONFIG 3 functions LinuxCon North America 2014 Make your own USB gadget 4 / 34 USB gadget USB and functions Congfs USB gadget Userspace Gadget implementation in Linux enumeration Device connected, presents itself Host decides what to do and how to talk to it LinuxCon North America 2014 Make your own USB gadget 5 / 34 USB gadget USB and functions Congfs USB gadget Userspace Gadget implementation in Linux gadget = UDC + function(s) A piece in hardware: UDC/OTG/ Functions: HW or SW << something >> usb_gadget_driver HOST UDC (e.g. s3c-hsotg) "gadget" Linux system LinuxCon North America 2014 Make your own USB gadget 6 / 34 USB gadget USB and functions Congfs USB gadget Userspace Gadget implementation in Linux composite framework factor out repeated parts of code drivers/usb/gadget/composite.c reusable functions' implementations f_acm.c f_serial.c f_obex.c f_ecm.c, f_ecm_subset.c, f_eem.c, f_ncm.c, f_rndis.c f_phonet.c f_mass_storage.c f_uvc.c f_uac1.c, f_uac2.c f_midi.c ... LinuxCon North America 2014 Make your own USB gadget 7 / 34 USB gadget USB and functions Congfs USB gadget Userspace Gadget implementation in Linux gadgets proper: g_xyz.c / g_xyz kernel modules hardcoded (!) congurations/functions/identity module parameters LinuxCon North America 2014 Make your own USB gadget 8 / 34 USB gadget USB and functions Congfs USB gadget Userspace Gadget implementation in Linux Greg Fact Why I don't want He doesn't want my code! your code Fact Linux Kernel Maintainers, He wouldn't want your code, why are they so grumpy either :O Greg Kroah-Hartman [email protected] LinuxCon North America 2014 Make your own USB gadget 9 / 34 USB gadget USB and functions Congfs USB gadget Userspace Gadget implementation in Linux Greg Fact Why I don't want He doesn't want my code! your code Fact Linux Kernel Maintainers, He wouldn't want your code, why are they so grumpy either :O Greg Kroah-Hartman [email protected] LinuxCon North America 2014 Make your own USB gadget 9 / 34 USB gadget The idea, example Congfs On implementation Userspace Status Separate code from data decouple the information on actual gadget composition from implementation only provide building blocks (mechanism, not policy) LinuxCon North America 2014 Make your own USB gadget 10 / 34 USB gadget The idea, example Congfs On implementation Userspace Status Let the user decide at runtime action lesystem create make directory destroy remove directory specify value write get value read (execute for directory) group things symlink ungroup things remove symlink Command reference mkdir, rmdir echo 'something' > file, cat file, ls directory ln -s, rm LinuxCon North America 2014 Make your own USB gadget 11 / 34 drwxr-xr-x . drwxr-xr-x ./strings drwxr-xr-x ./configs drwxr-xr-x ./functions -rw-r--r-- ./UDC -rw-r--r-- ./bcdUSB $ mount none cfg -t configfs cfg/usb_gadget -rw-r--r-- ./bcdDevice $ mkdir cfg/usb_gadget/g1 -rw-r--r-- ./idProduct $ cd cfg/usb_gadget/g1 -rw-r--r-- ./idVendor -rw-r--r-- ./bMaxPacketSize0 $ echo "0x05e8" > idVendor -rw-r--r-- ./bDeviceProtocol $ echo "0xa4a1" > idProduct -rw-r--r-- ./bDeviceSubClass $ mkdir strings/0x409 -rw-r--r-- ./bDeviceClass $ echo "serialnumber" > strings/0x409/serialnumber $ echo "manufacturer" > strings/0x409/manufacturer $ echo "RNDIS Gadget" > strings/0x409/product USB gadget The idea, example Congfs On implementation Userspace Status Example Example's prologue $ modprobe libcomposite LinuxCon North America 2014 Make your own USB gadget 12 / 34 drwxr-xr-x . drwxr-xr-x ./strings drwxr-xr-x ./configs drwxr-xr-x ./functions -rw-r--r-- ./UDC -rw-r--r-- ./bcdUSB -rw-r--r-- ./bcdDevice $ mkdir cfg/usb_gadget/g1 -rw-r--r-- ./idProduct $ cd cfg/usb_gadget/g1 -rw-r--r-- ./idVendor -rw-r--r-- ./bMaxPacketSize0 $ echo "0x05e8" > idVendor -rw-r--r-- ./bDeviceProtocol $ echo "0xa4a1" > idProduct -rw-r--r-- ./bDeviceSubClass $ mkdir strings/0x409 -rw-r--r-- ./bDeviceClass $ echo "serialnumber" > strings/0x409/serialnumber $ echo "manufacturer" > strings/0x409/manufacturer $ echo "RNDIS Gadget" > strings/0x409/product USB gadget The idea, example Congfs On implementation Userspace Status Example Example's prologue $ modprobe libcomposite $ mount none cfg -t configfs cfg/usb_gadget LinuxCon North America 2014 Make your own USB gadget 12 / 34 $ echo "0x05e8" > idVendor $ echo "0xa4a1" > idProduct $ mkdir strings/0x409 $ echo "serialnumber" > strings/0x409/serialnumber $ echo "manufacturer" > strings/0x409/manufacturer $ echo "RNDIS Gadget" > strings/0x409/product USB gadget The idea, example Congfs On implementation Userspace Status Example drwxr-xr-x . drwxr-xr-x ./strings Example's prologue drwxr-xr-x ./configs drwxr-xr-x ./functions $ modprobe libcomposite -rw-r--r-- ./UDC -rw-r--r-- ./bcdUSB $ mount none cfg -t configfs cfg/usb_gadget -rw-r--r-- ./bcdDevice $ mkdir cfg/usb_gadget/g1 -rw-r--r-- ./idProduct $ cd cfg/usb_gadget/g1 -rw-r--r-- ./idVendor -rw-r--r-- ./bMaxPacketSize0 -rw-r--r-- ./bDeviceProtocol -rw-r--r-- ./bDeviceSubClass -rw-r--r-- ./bDeviceClass LinuxCon North America 2014 Make your own USB gadget 12 / 34 $ mkdir strings/0x409 $ echo "serialnumber" > strings/0x409/serialnumber $ echo "manufacturer" > strings/0x409/manufacturer $ echo "RNDIS Gadget" > strings/0x409/product USB gadget The idea, example Congfs On implementation Userspace Status Example drwxr-xr-x . drwxr-xr-x ./strings Example's prologue drwxr-xr-x ./configs drwxr-xr-x ./functions $ modprobe libcomposite -rw-r--r-- ./UDC -rw-r--r-- ./bcdUSB $ mount none cfg -t configfs cfg/usb_gadget -rw-r--r-- ./bcdDevice $ mkdir cfg/usb_gadget/g1 -rw-r--r-- ./idProduct $ cd cfg/usb_gadget/g1 -rw-r--r-- ./idVendor -rw-r--r-- ./bMaxPacketSize0 $ echo "0x05e8" > idVendor -rw-r--r-- ./bDeviceProtocol $ echo "0xa4a1" > idProduct -rw-r--r-- ./bDeviceSubClass -rw-r--r-- ./bDeviceClass LinuxCon North America 2014 Make your own USB gadget 12 / 34 USB gadget The idea, example Congfs On implementation Userspace Status Example drwxr-xr-x . drwxr-xr-x ./strings Example's prologue drwxr-xr-x ./configs drwxr-xr-x ./functions $ modprobe libcomposite -rw-r--r-- ./UDC -rw-r--r-- ./bcdUSB $ mount none cfg -t configfs cfg/usb_gadget -rw-r--r-- ./bcdDevice $ mkdir cfg/usb_gadget/g1 -rw-r--r-- ./idProduct $ cd cfg/usb_gadget/g1 -rw-r--r-- ./idVendor -rw-r--r-- ./bMaxPacketSize0 $ echo "0x05e8" > idVendor -rw-r--r-- ./bDeviceProtocol $ echo "0xa4a1" > idProduct -rw-r--r-- ./bDeviceSubClass $ mkdir strings/0x409 -rw-r--r-- ./bDeviceClass $ echo "serialnumber" > strings/0x409/serialnumber $ echo "manufacturer" > strings/0x409/manufacturer $ echo "RNDIS Gadget" > strings/0x409/product LinuxCon North America 2014 Make your own USB gadget 12 / 34 $ mkdir configs/c.1 $ mkdir configs/c.1/strings/0x409 $ echo Conf 1 > configs/c.1/strings/0x409/configuration $ echo 120 > configs/c.1/MaxPower $ ln -s functions/rndis.usb0 configs/c.1 $ echo 12480000.hsotg > UDC $ ls /sys/class/udc 12480000.hsotg bind! # formerly s3c-hsotg USB gadget The idea, example Congfs On implementation Userspace Status One cong, one function Example $ mkdir functions/rndis.usb0 LinuxCon North America 2014 Make your own USB gadget 13 / 34 $ ln -s functions/rndis.usb0 configs/c.1 $ echo 12480000.hsotg > UDC $ ls /sys/class/udc 12480000.hsotg bind! # formerly s3c-hsotg USB gadget The idea, example Congfs On implementation Userspace Status One cong, one function Example $ mkdir functions/rndis.usb0 $ mkdir configs/c.1 $ mkdir configs/c.1/strings/0x409 $ echo Conf 1 > configs/c.1/strings/0x409/configuration $ echo 120 > configs/c.1/MaxPower LinuxCon North America 2014 Make your own USB gadget 13 / 34 $ echo 12480000.hsotg > UDC $ ls /sys/class/udc 12480000.hsotg bind! # formerly s3c-hsotg USB gadget The idea, example Congfs On implementation Userspace Status One cong, one function Example $ mkdir functions/rndis.usb0 $ mkdir configs/c.1 $ mkdir configs/c.1/strings/0x409 $ echo Conf 1 > configs/c.1/strings/0x409/configuration $ echo 120 > configs/c.1/MaxPower $ ln -s functions/rndis.usb0 configs/c.1 LinuxCon North America 2014 Make your own USB gadget 13 / 34 USB gadget The idea, example Congfs On implementation Userspace Status One cong, one function Example $ mkdir functions/rndis.usb0 $ mkdir configs/c.1 $ mkdir configs/c.1/strings/0x409 $ echo Conf 1 > configs/c.1/strings/0x409/configuration $ echo 120 > configs/c.1/MaxPower $ ln -s functions/rndis.usb0 configs/c.1 $ echo 12480000.hsotg > UDC $ ls /sys/class/udc 12480000.hsotg bind! # formerly s3c-hsotg LinuxCon North America 2014 Make your own USB gadget 13 / 34 $ cd functions # $CONFIGFS_ROOT/usb_gadget/g1/functions $ echo RNDIS > \ rndis.usb0/os_desc/interface.rndis/compatible_id USB gadget The
Recommended publications
  • Administració De Sistemes GNU Linux Mòdul4 Administració
    Administració local Josep Jorba Esteve PID_00238577 GNUFDL • PID_00238577 Administració local Es garanteix el permís per a copiar, distribuir i modificar aquest document segons els termes de la GNU Free Documentation License, Version 1.3 o qualsevol altra de posterior publicada per la Free Software Foundation, sense seccions invariants ni textos de la oberta anterior o posterior. Podeu consultar els termes de la llicència a http://www.gnu.org/licenses/fdl-1.3.html. GNUFDL • PID_00238577 Administració local Índex Introducció.................................................................................................. 5 1. Eines bàsiques per a l'administrador........................................... 7 1.1. Eines gràfiques i línies de comandes .......................................... 8 1.2. Documents d'estàndards ............................................................. 10 1.3. Documentació del sistema en línia ............................................ 13 1.4. Eines de gestió de paquets .......................................................... 15 1.4.1. Paquets TGZ ................................................................... 16 1.4.2. Fedora/Red Hat: paquets RPM ....................................... 19 1.4.3. Debian: paquets DEB ..................................................... 24 1.4.4. Nous formats d'empaquetat: Snap i Flatpak .................. 28 1.5. Eines genèriques d'administració ................................................ 36 1.6. Altres eines .................................................................................
    [Show full text]
  • Storage Administration Guide Storage Administration Guide SUSE Linux Enterprise Server 12 SP4
    SUSE Linux Enterprise Server 12 SP4 Storage Administration Guide Storage Administration Guide SUSE Linux Enterprise Server 12 SP4 Provides information about how to manage storage devices on a SUSE Linux Enterprise Server. Publication Date: September 24, 2021 SUSE LLC 1800 South Novell Place Provo, UT 84606 USA https://documentation.suse.com Copyright © 2006– 2021 SUSE LLC and contributors. All rights reserved. Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or (at your option) version 1.3; with the Invariant Section being this copyright notice and license. A copy of the license version 1.2 is included in the section entitled “GNU Free Documentation License”. For SUSE trademarks, see https://www.suse.com/company/legal/ . All other third-party trademarks are the property of their respective owners. Trademark symbols (®, ™ etc.) denote trademarks of SUSE and its aliates. Asterisks (*) denote third-party trademarks. All information found in this book has been compiled with utmost attention to detail. However, this does not guarantee complete accuracy. Neither SUSE LLC, its aliates, the authors nor the translators shall be held liable for possible errors or the consequences thereof. Contents About This Guide xii 1 Available Documentation xii 2 Giving Feedback xiv 3 Documentation Conventions xiv 4 Product Life Cycle and Support xvi Support Statement for SUSE Linux Enterprise Server xvii • Technology Previews xviii I FILE SYSTEMS AND MOUNTING 1 1 Overview
    [Show full text]
  • USB Composite Gadget Using CONFIG-FS on Dra7xx Devices
    Application Report SPRACB5–September 2017 USB Composite Gadget Using CONFIG-FS on DRA7xx Devices RaviB ABSTRACT This application note explains how to create a USB composite gadget, network control model (NCM) and abstract control model (ACM) from the user space using Linux® CONFIG-FS on the DRA7xx platform. Contents 1 Introduction ................................................................................................................... 2 2 USB Composite Gadget Using CONFIG-FS ............................................................................. 3 3 Creating Composite Gadget From User Space.......................................................................... 4 4 References ................................................................................................................... 8 List of Figures 1 Block Diagram of USB Composite Gadget............................................................................... 3 2 Selection of CONFIGFS Through menuconfig........................................................................... 4 3 Select USB Configuration Through menuconfig......................................................................... 4 4 Composite Gadget Configuration Items as Files and Directories ..................................................... 5 5 VID, PID, and Manufacturer String Configuration ....................................................................... 6 6 Kernel Logs Show Enumeration of USB Composite Gadget by Host ................................................ 6 7 Ping
    [Show full text]
  • 15-122: Principles of Imperative Computation, Fall 2014 Lab 11: Strings in C
    15-122: Principles of Imperative Computation, Fall 2014 Lab 11: Strings in C Tom Cortina(tcortina@cs) and Rob Simmons(rjsimmon@cs) Monday, November 10, 2014 For this lab, you will show your TA your answers once you complete your activities. Autolab is not used for this lab. SETUP: Make a directory lab11 in your private 15122 directory and copy the required lab files to your lab11 directory: cd private/15122 mkdir lab11 cp /afs/andrew.cmu.edu/usr9/tcortina/public/15122-f14/*.c lab11 1 Storing and using strings using C Load the file lab11ex1.c into a text editor. Read through the file and write down what you think the output will be before you run the program. (The ASCII value of 'a' is 97.) Then compile and run the program. Be sure to use all of the required flags for the C compiler. Answer the following questions on paper: Exercise 1. When word is initially printed out character by character, why does only one character get printed? Exercise 2. Change the program so word[3] = 'd'. Recompile and rerun. Explain the change in the output. Run valgrind on your program. How do the messages from valgrind correspond to the change we made? Exercise 3. Change word[3] back. Uncomment the code that treats the four character array word as a 32-bit integer. Compile and run again. Based on the answer, how are bytes of an integer stored on the computer where you are running your code? 2 Arrays of strings Load the file lab11ex2.c into a text editor.
    [Show full text]
  • Oracle® Linux 7 Managing File Systems
    Oracle® Linux 7 Managing File Systems F32760-07 August 2021 Oracle Legal Notices Copyright © 2020, 2021, Oracle and/or its affiliates. This software and related documentation are provided under a license agreement containing restrictions on use and disclosure and are protected by intellectual property laws. Except as expressly permitted in your license agreement or allowed by law, you may not use, copy, reproduce, translate, broadcast, modify, license, transmit, distribute, exhibit, perform, publish, or display any part, in any form, or by any means. Reverse engineering, disassembly, or decompilation of this software, unless required by law for interoperability, is prohibited. The information contained herein is subject to change without notice and is not warranted to be error-free. If you find any errors, please report them to us in writing. If this is software or related documentation that is delivered to the U.S. Government or anyone licensing it on behalf of the U.S. Government, then the following notice is applicable: U.S. GOVERNMENT END USERS: Oracle programs (including any operating system, integrated software, any programs embedded, installed or activated on delivered hardware, and modifications of such programs) and Oracle computer documentation or other Oracle data delivered to or accessed by U.S. Government end users are "commercial computer software" or "commercial computer software documentation" pursuant to the applicable Federal Acquisition Regulation and agency-specific supplemental regulations. As such, the use, reproduction, duplication, release, display, disclosure, modification, preparation of derivative works, and/or adaptation of i) Oracle programs (including any operating system, integrated software, any programs embedded, installed or activated on delivered hardware, and modifications of such programs), ii) Oracle computer documentation and/or iii) other Oracle data, is subject to the rights and limitations specified in the license contained in the applicable contract.
    [Show full text]
  • Unionfs: User- and Community-Oriented Development of a Unification File System
    Unionfs: User- and Community-Oriented Development of a Unification File System David Quigley, Josef Sipek, Charles P. Wright, and Erez Zadok Stony Brook University {dquigley,jsipek,cwright,ezk}@cs.sunysb.edu Abstract If a file exists in multiple branches, the user sees only the copy in the higher-priority branch. Unionfs allows some branches to be read-only, Unionfs is a stackable file system that virtually but as long as the highest-priority branch is merges a set of directories (called branches) read-write, Unionfs uses copy-on-write seman- into a single logical view. Each branch is as- tics to provide an illusion that all branches are signed a priority and may be either read-only writable. This feature allows Live-CD develop- or read-write. When the highest priority branch ers to give their users a writable system based is writable, Unionfs provides copy-on-write se- on read-only media. mantics for read-only branches. These copy- on-write semantics have lead to widespread There are many uses for namespace unifica- use of Unionfs by LiveCD projects including tion. The two most common uses are Live- Knoppix and SLAX. In this paper we describe CDs and diskless/NFS-root clients. On Live- our experiences distributing and maintaining CDs, by definition, the data is stored on a read- an out-of-kernel module since November 2004. only medium. However, it is very convenient As of March 2006 Unionfs has been down- for users to be able to modify the data. Uni- loaded by over 6,700 unique users and is used fying the read-only CD with a writable RAM by over two dozen other projects.
    [Show full text]
  • Unibasic 9.3 Reference Guide
    Unibasic - Dynamic Concepts Wiki 6/19/17, 1244 PM Unibasic From Dynamic Concepts Wiki Contents 1 UniBasic 2 About this Guide 2.1 Conventions 3 Installation & Configuration 3.1 Configuring Unix for UniBasic 3.1.1 Number of Processes 3.1.2 Number of Open Files 3.1.3 Number of Open i-nodes 3.1.4 Number of Locks 3.1.5 Message Queues 3.2 Unix Accounting & Protection System 3.3 Creating a Unix Account for UniBasic 3.4 UniBasic Security & Licensing 3.4.1 Software Licensing 3.4.2 Hardware Licensing 3.5 Loading the Installation File 3.5.1 Loading the UniBasic Installation File 3.5.2 Loading the UniBasic Development File 3.6 ubinstall - Installing UniBasic Packages 3.6.1 Errors During Installation 3.7 Configuring a UniBasic Environment 3.7.1 Directories and Paths 3.7.2 Filenames and Pathnames 3.7.3 Organizing Logical Units and Packnames 3.7.4 Environment Variables 3.7.5 Setting up .profile for Multiple Users 3.8 Command Line Interpreter 3.9 Launching UniBasic From Unix 3.10 Terminating a UniBasic Process 3.11 Licensing a New Installation 3.12 Changing the SSN Activation Key 3.13 Launching UniBasic Ports at Startup 3.14 Configuring Printer Drivers 3.15 Configuring Serial Printers 3.16 Configuring Terminal Drivers 3.17 Creating a Customized Installation Media 4 Introduction To UniBasic 4.1 Data 4.1.1 Numeric Data 4.1.1.1 Numeric Precision 4.1.1.2 Special Notes on %3 and %6 Numerics https://engineering.dynamic.com/mediawiki/index.php?title=Unibasic&printable=yes Page 1 of 397 Unibasic - Dynamic Concepts Wiki 6/19/17, 1244 PM 4.1.1.3 Integers Stored in Floating-Point
    [Show full text]
  • IBM Education Assistance for Z/OS V2R1
    IBM Education Assistance for z/OS V2R1 Item: ASCII Unicode Option Element/Component: UNIX Shells and Utilities (S&U) Material is current as of June 2013 © 2013 IBM Corporation Filename: zOS V2R1 USS S&U ASCII Unicode Option Agenda ■ Trademarks ■ Presentation Objectives ■ Overview ■ Usage & Invocation ■ Migration & Coexistence Considerations ■ Presentation Summary ■ Appendix Page 2 of 19 © 2013 IBM Corporation Filename: zOS V2R1 USS S&U ASCII Unicode Option IBM Presentation Template Full Version Trademarks ■ See url http://www.ibm.com/legal/copytrade.shtml for a list of trademarks. Page 3 of 19 © 2013 IBM Corporation Filename: zOS V2R1 USS S&U ASCII Unicode Option IBM Presentation Template Full Presentation Objectives ■ Introduce the features and benefits of the new z/OS UNIX Shells and Utilities (S&U) support for working with ASCII/Unicode files. Page 4 of 19 © 2013 IBM Corporation Filename: zOS V2R1 USS S&U ASCII Unicode Option IBM Presentation Template Full Version Overview ■ Problem Statement –As a z/OS UNIX Shells & Utilities user, I want the ability to control the text conversion of input files used by the S&U commands. –As a z/OS UNIX Shells & Utilities user, I want the ability to run tagged shell scripts (tcsh scripts and SBCS sh scripts) under different SBCS locales. ■ Solution –Add –W filecodeset=codeset,pgmcodeset=codeset option on several S&U commands to enable text conversion – consistent with support added to vi and ex in V1R13. –Add –B option on several S&U commands to disable automatic text conversion – consistent with other commands that already have this override support. –Add new _TEXT_CONV environment variable to enable or disable text conversion.
    [Show full text]
  • ODROID-HC2: 3.5” High Powered Storage  February 1, 2018
    ODROID WiFi Access Point: Share Files Via Samba February 1, 2018 How to setup an ODROID with a WiFi access point so that an ODROID’s hard drive can be accessed and modied from another computer. This is primarily aimed at allowing access to images, videos, and log les on the ODROID. ODROID-HC2: 3.5” High powered storage February 1, 2018 The ODROID-HC2 is an aordable mini PC and perfect solution for a network attached storage (NAS) server. This device home cloud-server capabilities centralizes data and enables users to share and stream multimedia les to phones, tablets, and other devices across a network. It is an ideal tool for many use Using SquashFS As A Read-Only Root File System February 1, 2018 This guide describes the usage of SquashFS PiFace: Control and Display 2 February 1, 2018 For those who have the PiFace Control and Display 2, and want to make it compatible with the ODROID-C2 Android Gaming: Data Wing, Space Frontier, and Retro Shooting – Pixel Space Shooter February 1, 2018 Variations on a theme! Race, blast into space, and blast things into pieces that are racing towards us. The fun doesn’t need to stop when you take a break from your projects. Our monthly pick on Android games. Linux Gaming: Saturn Games – Part 1 February 1, 2018 I think it’s time we go into a bit more detail about Sega Saturn for the ODROID-XU3/XU4 Gaming Console: Running Your Favorite Games On An ODROID-C2 Using Android February 1, 2018 I built a gaming console using an ODROID-C2 running Android 6 Controller Area Network (CAN) Bus: Implementation
    [Show full text]
  • Bidirectional Programming Languages
    University of Pennsylvania ScholarlyCommons Publicly Accessible Penn Dissertations Winter 2009 Bidirectional Programming Languages John Nathan Foster University of Pennsylvania, [email protected] Follow this and additional works at: https://repository.upenn.edu/edissertations Part of the Databases and Information Systems Commons, and the Programming Languages and Compilers Commons Recommended Citation Foster, John Nathan, "Bidirectional Programming Languages" (2009). Publicly Accessible Penn Dissertations. 56. https://repository.upenn.edu/edissertations/56 This paper is posted at ScholarlyCommons. https://repository.upenn.edu/edissertations/56 For more information, please contact [email protected]. Bidirectional Programming Languages Abstract The need to edit source data through a view arises in a host of applications across many different areas of computing. Unfortunately, few existing systems provide support for updatable views. In practice, when they are needed, updatable views are usually implemented using two separate programs: one that computes the view from the source and another that handles updates. This rudimentary design is tedious for programmers, difficult to reason about, and a nightmare to maintain. This dissertation presents bidirectional programming languages, which provide an elegant and effective mechanism for describing updatable views. Unlike programs written in an ordinary language, which only work in one direction, programs in a bidirectional language can be run both forwards and backwards: from left to right, they describe functions that map sources to views, and from right to left, they describe functions that map updated views back to updated sources. Besides eliminating redundancy, these languages can be designed to ensure correctness, guaranteeing by construction that the two functions work well together. Starting from the foundations, we define a general semantic space of well-behaved bidirectional transformations called lenses.
    [Show full text]
  • Reference Manual for the Icon Programming Language Version 5 (( Implementation for Limx)*
    Reference Manual for the Icon Programming Language Version 5 (( Implementation for liMX)* Can A. Contain. Ralph £ Grixwoltl, and Stephen B. Watnplcr "RSI-4a December 1981, Corrected July 1982 Department of Computer Science The University of Arizona Tucson, Arizona 85721 This work was supported by the National Science Foundation under Grant MCS79-03890. Copyright © 1981 by Ralph E. Griswold All rights reserved. No part of this work may be reproduced, transmitted, or stored in any form or by any means without the prior written consent of the copyright owner. CONTENTS Chapter i Introduction 1.1 Background I 1.2 Scope ol the Manual 2 1.3 An Overview of Icon 2 1.4 Syntax Notation 2 1.5 Organization ol the Manual 3 Chapter 2 Basic Concepts and Operations 2.1 Types 4 2.2 Expressions 4 2.2.1 Variables and Assignment 4 2.2.2 Keywords 5 2.2.3 Functions 5 2.2.4 Operators 6 2.3 Evaluation of Expressions 6 2.3.1 Results 6 2.3.2 Success and Failure 7 2.4 Basic Control Structures 7 2.5 Compound Expressions 9 2.6 Loop Control 9 2.7 Procedures 9 Chapter 3 Generators and Expression Evaluation 3.1 Generators 11 3.2 Goal-Directed Evaluation 12 }.?> Evaluation of Expres.sions 13 3.4 I he Extent ol Backtracking 14 3.5 I he Reversal ol Effects 14 Chapter 4 Numbers and Arithmetic Operations 4.1 Integers 15 4.1.1 literal Integers 15 4.1.2 Integer Arithmetic 15 4.1.3 Integer Comparison 16 4.2 Real Numbers 17 4.2.1 literal Real Numbers 17 4.2.2 Real Arithmetic 17 4.2.3 Comparison of Real Numbers IS 4.3 Mixed-Mode Arithmetic IX 4.4 Arithmetic Type Conversion 19
    [Show full text]
  • Software II: Principles of Programming Languages
    Software II: Principles of Programming Languages Lecture 6 – Data Types Some Basic Definitions • A data type defines a collection of data objects and a set of predefined operations on those objects • A descriptor is the collection of the attributes of a variable • An object represents an instance of a user- defined (abstract data) type • One design issue for all data types: What operations are defined and how are they specified? Primitive Data Types • Almost all programming languages provide a set of primitive data types • Primitive data types: Those not defined in terms of other data types • Some primitive data types are merely reflections of the hardware • Others require only a little non-hardware support for their implementation The Integer Data Type • Almost always an exact reflection of the hardware so the mapping is trivial • There may be as many as eight different integer types in a language • Java’s signed integer sizes: byte , short , int , long The Floating Point Data Type • Model real numbers, but only as approximations • Languages for scientific use support at least two floating-point types (e.g., float and double ; sometimes more • Usually exactly like the hardware, but not always • IEEE Floating-Point Standard 754 Complex Data Type • Some languages support a complex type, e.g., C99, Fortran, and Python • Each value consists of two floats, the real part and the imaginary part • Literal form real component – (in Fortran: (7, 3) imaginary – (in Python): (7 + 3j) component The Decimal Data Type • For business applications (money)
    [Show full text]