SlideShare a Scribd company logo

Eco-Friendly Hardware Hacking with Android

Carlo Pescio
Carlo Pescio
Carlo PescioSoftware Architect, Consultant and Mentor at Eptacom - Dott. Carlo Pescio

my presentation ad Droidcon IT 2017

Eco-Friendly Hardware Hacking with Android

1 of 53
Download to read offline
Carlo Pescio @CarloPescio http://eptacom.net
Carlo Pescio
Eco-friendly hardware
hacking with Android
Carlo Pescio @CarloPescio http://eptacom.net
Code in Movies
Carlo Pescio @CarloPescio http://eptacom.net
Super Heroes
- Build this in a cave
- With a bunch of scraps
Carlo Pescio @CarloPescio http://eptacom.net
Reality
Carlo Pescio @CarloPescio http://eptacom.net
It gets worse
Carlo Pescio @CarloPescio http://eptacom.net
Your ____mission
Should you choose to accept it…
- Your phone
(no rooting)
- Bunch of scraps
- No Firmware
12V

Recommended

Scottish Ruby Conference 2010 Arduino, Ruby RAD
Scottish Ruby Conference 2010 Arduino, Ruby RADScottish Ruby Conference 2010 Arduino, Ruby RAD
Scottish Ruby Conference 2010 Arduino, Ruby RADlostcaggy
 
44CON London 2015 - Hunting Asynchronous Vulnerabilities
44CON London 2015 - Hunting Asynchronous Vulnerabilities44CON London 2015 - Hunting Asynchronous Vulnerabilities
44CON London 2015 - Hunting Asynchronous Vulnerabilities44CON
 
Java bytecode Malware Analysis
Java bytecode Malware AnalysisJava bytecode Malware Analysis
Java bytecode Malware AnalysisBrian Baskin
 
Persistent Bios Infection
Persistent Bios InfectionPersistent Bios Infection
Persistent Bios Infectionguest042636
 
Persistent BIOS Infection
Persistent BIOS InfectionPersistent BIOS Infection
Persistent BIOS Infectionguest042636
 
Webshield internet of things
Webshield internet of thingsWebshield internet of things
Webshield internet of thingsRaghav Shetty
 

More Related Content

Similar to Eco-Friendly Hardware Hacking with Android

DEF CON 27 - XILING GONG PETER PI - exploiting qualcom wlan and modem over th...
DEF CON 27 - XILING GONG PETER PI - exploiting qualcom wlan and modem over th...DEF CON 27 - XILING GONG PETER PI - exploiting qualcom wlan and modem over th...
DEF CON 27 - XILING GONG PETER PI - exploiting qualcom wlan and modem over th...Felipe Prado
 
[HES2013] Hacking apple accessories to pown iDevices – Wake up Neo! Your phon...
[HES2013] Hacking apple accessories to pown iDevices – Wake up Neo! Your phon...[HES2013] Hacking apple accessories to pown iDevices – Wake up Neo! Your phon...
[HES2013] Hacking apple accessories to pown iDevices – Wake up Neo! Your phon...Hackito Ergo Sum
 
Itsp documentation quadcopter flight controller based on kalman filters
Itsp documentation   quadcopter flight controller based on kalman filtersItsp documentation   quadcopter flight controller based on kalman filters
Itsp documentation quadcopter flight controller based on kalman filtersJyotirmaya Mahanta
 
6.4.1 Packet Tracer - Implement Etherchannel.docx
6.4.1 Packet Tracer - Implement Etherchannel.docx6.4.1 Packet Tracer - Implement Etherchannel.docx
6.4.1 Packet Tracer - Implement Etherchannel.docxShaqifHasanSajib1
 
Testing CAN network with help of CANToolz
Testing CAN network with help of CANToolzTesting CAN network with help of CANToolz
Testing CAN network with help of CANToolzAlexey Sintsov
 
BURO Arduino Workshop
BURO Arduino WorkshopBURO Arduino Workshop
BURO Arduino WorkshopOmer Kilic
 
Ak12 upgrade
Ak12 upgradeAk12 upgrade
Ak12 upgradeAccenture
 
JCrete Embedded Java Workshop
JCrete Embedded Java WorkshopJCrete Embedded Java Workshop
JCrete Embedded Java WorkshopStephen Chin
 
SSTIC 2019 - V2G injector: Whispering to cars and charging units through the ...
SSTIC 2019 - V2G injector: Whispering to cars and charging units through the ...SSTIC 2019 - V2G injector: Whispering to cars and charging units through the ...
SSTIC 2019 - V2G injector: Whispering to cars and charging units through the ...📡 Sebastien Dudek
 
EC/Bios Interaction Laptop Repair Course
EC/Bios Interaction Laptop Repair CourseEC/Bios Interaction Laptop Repair Course
EC/Bios Interaction Laptop Repair CourseVikas Deoarshi
 
Ccna lab manual 640 802
Ccna lab manual 640 802Ccna lab manual 640 802
Ccna lab manual 640 802manikkan
 
Full details of implementation of flying internet balloon
Full details of implementation of flying internet balloonFull details of implementation of flying internet balloon
Full details of implementation of flying internet balloonANTONY SEBATIAN
 
Annotated Bibliography On Import Java
Annotated Bibliography On Import JavaAnnotated Bibliography On Import Java
Annotated Bibliography On Import JavaTina Marie
 
Vista 1600 c epon olt quick start manual(r1.2)
Vista 1600 c epon olt quick start manual(r1.2)Vista 1600 c epon olt quick start manual(r1.2)
Vista 1600 c epon olt quick start manual(r1.2)Shanxi Cai
 
Such a weird Processor: messing with opcodes (...and a little bit of PE) (Has...
Such a weird Processor: messing with opcodes (...and a little bit of PE) (Has...Such a weird Processor: messing with opcodes (...and a little bit of PE) (Has...
Such a weird Processor: messing with opcodes (...and a little bit of PE) (Has...Ange Albertini
 
IoT: Internet of Things with Python
IoT: Internet of Things with PythonIoT: Internet of Things with Python
IoT: Internet of Things with PythonLelio Campanile
 
Troubleshooting Linux Kernel Modules And Device Drivers
Troubleshooting Linux Kernel Modules And Device DriversTroubleshooting Linux Kernel Modules And Device Drivers
Troubleshooting Linux Kernel Modules And Device DriversSatpal Parmar
 
Troubleshooting linux-kernel-modules-and-device-drivers-1233050713693744-1
Troubleshooting linux-kernel-modules-and-device-drivers-1233050713693744-1Troubleshooting linux-kernel-modules-and-device-drivers-1233050713693744-1
Troubleshooting linux-kernel-modules-and-device-drivers-1233050713693744-1Jagadisha Maiya
 
Esp8266 wi fi_module_quick_start_guide_v_1.0.4
Esp8266 wi fi_module_quick_start_guide_v_1.0.4Esp8266 wi fi_module_quick_start_guide_v_1.0.4
Esp8266 wi fi_module_quick_start_guide_v_1.0.4Melvin Gutiérrez Rivero
 

Similar to Eco-Friendly Hardware Hacking with Android (20)

DEF CON 27 - XILING GONG PETER PI - exploiting qualcom wlan and modem over th...
DEF CON 27 - XILING GONG PETER PI - exploiting qualcom wlan and modem over th...DEF CON 27 - XILING GONG PETER PI - exploiting qualcom wlan and modem over th...
DEF CON 27 - XILING GONG PETER PI - exploiting qualcom wlan and modem over th...
 
[HES2013] Hacking apple accessories to pown iDevices – Wake up Neo! Your phon...
[HES2013] Hacking apple accessories to pown iDevices – Wake up Neo! Your phon...[HES2013] Hacking apple accessories to pown iDevices – Wake up Neo! Your phon...
[HES2013] Hacking apple accessories to pown iDevices – Wake up Neo! Your phon...
 
Itsp documentation quadcopter flight controller based on kalman filters
Itsp documentation   quadcopter flight controller based on kalman filtersItsp documentation   quadcopter flight controller based on kalman filters
Itsp documentation quadcopter flight controller based on kalman filters
 
6.4.1 Packet Tracer - Implement Etherchannel.docx
6.4.1 Packet Tracer - Implement Etherchannel.docx6.4.1 Packet Tracer - Implement Etherchannel.docx
6.4.1 Packet Tracer - Implement Etherchannel.docx
 
Testing CAN network with help of CANToolz
Testing CAN network with help of CANToolzTesting CAN network with help of CANToolz
Testing CAN network with help of CANToolz
 
BURO Arduino Workshop
BURO Arduino WorkshopBURO Arduino Workshop
BURO Arduino Workshop
 
Ak12 upgrade
Ak12 upgradeAk12 upgrade
Ak12 upgrade
 
JCrete Embedded Java Workshop
JCrete Embedded Java WorkshopJCrete Embedded Java Workshop
JCrete Embedded Java Workshop
 
SSTIC 2019 - V2G injector: Whispering to cars and charging units through the ...
SSTIC 2019 - V2G injector: Whispering to cars and charging units through the ...SSTIC 2019 - V2G injector: Whispering to cars and charging units through the ...
SSTIC 2019 - V2G injector: Whispering to cars and charging units through the ...
 
EC/Bios Interaction Laptop Repair Course
EC/Bios Interaction Laptop Repair CourseEC/Bios Interaction Laptop Repair Course
EC/Bios Interaction Laptop Repair Course
 
Ccna lab manual 640 802
Ccna lab manual 640 802Ccna lab manual 640 802
Ccna lab manual 640 802
 
Full details of implementation of flying internet balloon
Full details of implementation of flying internet balloonFull details of implementation of flying internet balloon
Full details of implementation of flying internet balloon
 
Annotated Bibliography On Import Java
Annotated Bibliography On Import JavaAnnotated Bibliography On Import Java
Annotated Bibliography On Import Java
 
Vista 1600 c epon olt quick start manual(r1.2)
Vista 1600 c epon olt quick start manual(r1.2)Vista 1600 c epon olt quick start manual(r1.2)
Vista 1600 c epon olt quick start manual(r1.2)
 
Such a weird Processor: messing with opcodes (...and a little bit of PE) (Has...
Such a weird Processor: messing with opcodes (...and a little bit of PE) (Has...Such a weird Processor: messing with opcodes (...and a little bit of PE) (Has...
Such a weird Processor: messing with opcodes (...and a little bit of PE) (Has...
 
IoT: Internet of Things with Python
IoT: Internet of Things with PythonIoT: Internet of Things with Python
IoT: Internet of Things with Python
 
Station 1 POD1
Station 1 POD1Station 1 POD1
Station 1 POD1
 
Troubleshooting Linux Kernel Modules And Device Drivers
Troubleshooting Linux Kernel Modules And Device DriversTroubleshooting Linux Kernel Modules And Device Drivers
Troubleshooting Linux Kernel Modules And Device Drivers
 
Troubleshooting linux-kernel-modules-and-device-drivers-1233050713693744-1
Troubleshooting linux-kernel-modules-and-device-drivers-1233050713693744-1Troubleshooting linux-kernel-modules-and-device-drivers-1233050713693744-1
Troubleshooting linux-kernel-modules-and-device-drivers-1233050713693744-1
 
Esp8266 wi fi_module_quick_start_guide_v_1.0.4
Esp8266 wi fi_module_quick_start_guide_v_1.0.4Esp8266 wi fi_module_quick_start_guide_v_1.0.4
Esp8266 wi fi_module_quick_start_guide_v_1.0.4
 

Recently uploaded

Getting Started with Trello for Beginners.pptx
Getting Started with Trello for Beginners.pptxGetting Started with Trello for Beginners.pptx
Getting Started with Trello for Beginners.pptxmavinoikein
 
Self scaling Multi cloud nomad workloads
Self scaling Multi cloud nomad workloadsSelf scaling Multi cloud nomad workloads
Self scaling Multi cloud nomad workloadsBram Vogelaar
 
Essence of Requirements Engineering: Pragmatic Insights for 2024
Essence of Requirements Engineering: Pragmatic Insights for 2024Essence of Requirements Engineering: Pragmatic Insights for 2024
Essence of Requirements Engineering: Pragmatic Insights for 2024Asher Sterkin
 
unit I lecture 5 - Software Development Life Cycle.pdf
unit I lecture 5 - Software Development Life Cycle.pdfunit I lecture 5 - Software Development Life Cycle.pdf
unit I lecture 5 - Software Development Life Cycle.pdfStephenTec
 
App Builder - Hierarchical Data Apps.pptx
App Builder - Hierarchical Data Apps.pptxApp Builder - Hierarchical Data Apps.pptx
App Builder - Hierarchical Data Apps.pptxPoojitha B
 
Sql server types of joins with example.pptx
Sql server types of joins with example.pptxSql server types of joins with example.pptx
Sql server types of joins with example.pptxsameer gaikwad
 
India's_Generative_AI_Startup_Landscape_Report_2023_Inc42 (1).pdf
India's_Generative_AI_Startup_Landscape_Report_2023_Inc42 (1).pdfIndia's_Generative_AI_Startup_Landscape_Report_2023_Inc42 (1).pdf
India's_Generative_AI_Startup_Landscape_Report_2023_Inc42 (1).pdfgranitesrijan
 
AUTOKEYUNLOCKER-BRANDS-SUPPORT-STANDARD-VERSION.pdf
AUTOKEYUNLOCKER-BRANDS-SUPPORT-STANDARD-VERSION.pdfAUTOKEYUNLOCKER-BRANDS-SUPPORT-STANDARD-VERSION.pdf
AUTOKEYUNLOCKER-BRANDS-SUPPORT-STANDARD-VERSION.pdfAutokey
 
Embracing Change - The Impact of Generative AI on Strategic Portfolio Management
Embracing Change - The Impact of Generative AI on Strategic Portfolio ManagementEmbracing Change - The Impact of Generative AI on Strategic Portfolio Management
Embracing Change - The Impact of Generative AI on Strategic Portfolio ManagementOnePlan Solutions
 
unit I lecture 4 - AGILE DEVELOPMENT AND PLAN-DRIVEN.pdf
unit I lecture 4 - AGILE DEVELOPMENT AND PLAN-DRIVEN.pdfunit I lecture 4 - AGILE DEVELOPMENT AND PLAN-DRIVEN.pdf
unit I lecture 4 - AGILE DEVELOPMENT AND PLAN-DRIVEN.pdfStephenTec
 
Manual de la Mezcladora SoundCraft Notepad -12Fx
Manual de la Mezcladora SoundCraft Notepad -12FxManual de la Mezcladora SoundCraft Notepad -12Fx
Manual de la Mezcladora SoundCraft Notepad -12Fxjavierdavidvelasco17
 
100 TOOLS TO MEASURE AND ANALYSE YOUR DIGITAL MARKETING EFFORTS
100 TOOLS TO MEASURE AND ANALYSE YOUR DIGITAL MARKETING EFFORTS100 TOOLS TO MEASURE AND ANALYSE YOUR DIGITAL MARKETING EFFORTS
100 TOOLS TO MEASURE AND ANALYSE YOUR DIGITAL MARKETING EFFORTSi-engage
 
unit I lecture 2 - Software Engineering Ethics - Software Process.pdf
unit I lecture 2 - Software Engineering Ethics - Software Process.pdfunit I lecture 2 - Software Engineering Ethics - Software Process.pdf
unit I lecture 2 - Software Engineering Ethics - Software Process.pdfStephenTec
 
Industry 4.0: Building the Unified Namespace with Confluent, HiveMQ and Spark...
Industry 4.0: Building the Unified Namespace with Confluent, HiveMQ and Spark...Industry 4.0: Building the Unified Namespace with Confluent, HiveMQ and Spark...
Industry 4.0: Building the Unified Namespace with Confluent, HiveMQ and Spark...confluent
 
Steps to Build a PWA with Odoo.pdf
Steps to Build a PWA with Odoo.pdfSteps to Build a PWA with Odoo.pdf
Steps to Build a PWA with Odoo.pdfayushinwizards
 
Les02 Restricting and Sorting Data using SQL.ppt
Les02 Restricting and Sorting Data using SQL.pptLes02 Restricting and Sorting Data using SQL.ppt
Les02 Restricting and Sorting Data using SQL.pptDrZeeshanBhatti
 
Enabling Enterprise-wide OT Data access with Matrikon Data Broker.pdf
Enabling Enterprise-wide OT Data access  with Matrikon Data Broker.pdfEnabling Enterprise-wide OT Data access  with Matrikon Data Broker.pdf
Enabling Enterprise-wide OT Data access with Matrikon Data Broker.pdfJohn Archer
 
unit 1 lecture 1 - Introduction - Software Engineering Myths.pdf
unit 1 lecture 1 - Introduction - Software Engineering Myths.pdfunit 1 lecture 1 - Introduction - Software Engineering Myths.pdf
unit 1 lecture 1 - Introduction - Software Engineering Myths.pdfStephenTec
 
Open Sprintera (Where Open Source Sparks a Sprint of Possibilities)
Open Sprintera (Where Open Source Sparks a Sprint of Possibilities)Open Sprintera (Where Open Source Sparks a Sprint of Possibilities)
Open Sprintera (Where Open Source Sparks a Sprint of Possibilities)GDSCNiT
 

Recently uploaded (20)

Getting Started with Trello for Beginners.pptx
Getting Started with Trello for Beginners.pptxGetting Started with Trello for Beginners.pptx
Getting Started with Trello for Beginners.pptx
 
Self scaling Multi cloud nomad workloads
Self scaling Multi cloud nomad workloadsSelf scaling Multi cloud nomad workloads
Self scaling Multi cloud nomad workloads
 
Essence of Requirements Engineering: Pragmatic Insights for 2024
Essence of Requirements Engineering: Pragmatic Insights for 2024Essence of Requirements Engineering: Pragmatic Insights for 2024
Essence of Requirements Engineering: Pragmatic Insights for 2024
 
unit I lecture 5 - Software Development Life Cycle.pdf
unit I lecture 5 - Software Development Life Cycle.pdfunit I lecture 5 - Software Development Life Cycle.pdf
unit I lecture 5 - Software Development Life Cycle.pdf
 
App Builder - Hierarchical Data Apps.pptx
App Builder - Hierarchical Data Apps.pptxApp Builder - Hierarchical Data Apps.pptx
App Builder - Hierarchical Data Apps.pptx
 
Sql server types of joins with example.pptx
Sql server types of joins with example.pptxSql server types of joins with example.pptx
Sql server types of joins with example.pptx
 
India's_Generative_AI_Startup_Landscape_Report_2023_Inc42 (1).pdf
India's_Generative_AI_Startup_Landscape_Report_2023_Inc42 (1).pdfIndia's_Generative_AI_Startup_Landscape_Report_2023_Inc42 (1).pdf
India's_Generative_AI_Startup_Landscape_Report_2023_Inc42 (1).pdf
 
AUTOKEYUNLOCKER-BRANDS-SUPPORT-STANDARD-VERSION.pdf
AUTOKEYUNLOCKER-BRANDS-SUPPORT-STANDARD-VERSION.pdfAUTOKEYUNLOCKER-BRANDS-SUPPORT-STANDARD-VERSION.pdf
AUTOKEYUNLOCKER-BRANDS-SUPPORT-STANDARD-VERSION.pdf
 
Embracing Change - The Impact of Generative AI on Strategic Portfolio Management
Embracing Change - The Impact of Generative AI on Strategic Portfolio ManagementEmbracing Change - The Impact of Generative AI on Strategic Portfolio Management
Embracing Change - The Impact of Generative AI on Strategic Portfolio Management
 
unit I lecture 4 - AGILE DEVELOPMENT AND PLAN-DRIVEN.pdf
unit I lecture 4 - AGILE DEVELOPMENT AND PLAN-DRIVEN.pdfunit I lecture 4 - AGILE DEVELOPMENT AND PLAN-DRIVEN.pdf
unit I lecture 4 - AGILE DEVELOPMENT AND PLAN-DRIVEN.pdf
 
Features of IETM Software -Code and Pixels
Features of IETM Software -Code and PixelsFeatures of IETM Software -Code and Pixels
Features of IETM Software -Code and Pixels
 
Manual de la Mezcladora SoundCraft Notepad -12Fx
Manual de la Mezcladora SoundCraft Notepad -12FxManual de la Mezcladora SoundCraft Notepad -12Fx
Manual de la Mezcladora SoundCraft Notepad -12Fx
 
100 TOOLS TO MEASURE AND ANALYSE YOUR DIGITAL MARKETING EFFORTS
100 TOOLS TO MEASURE AND ANALYSE YOUR DIGITAL MARKETING EFFORTS100 TOOLS TO MEASURE AND ANALYSE YOUR DIGITAL MARKETING EFFORTS
100 TOOLS TO MEASURE AND ANALYSE YOUR DIGITAL MARKETING EFFORTS
 
unit I lecture 2 - Software Engineering Ethics - Software Process.pdf
unit I lecture 2 - Software Engineering Ethics - Software Process.pdfunit I lecture 2 - Software Engineering Ethics - Software Process.pdf
unit I lecture 2 - Software Engineering Ethics - Software Process.pdf
 
Industry 4.0: Building the Unified Namespace with Confluent, HiveMQ and Spark...
Industry 4.0: Building the Unified Namespace with Confluent, HiveMQ and Spark...Industry 4.0: Building the Unified Namespace with Confluent, HiveMQ and Spark...
Industry 4.0: Building the Unified Namespace with Confluent, HiveMQ and Spark...
 
Steps to Build a PWA with Odoo.pdf
Steps to Build a PWA with Odoo.pdfSteps to Build a PWA with Odoo.pdf
Steps to Build a PWA with Odoo.pdf
 
Les02 Restricting and Sorting Data using SQL.ppt
Les02 Restricting and Sorting Data using SQL.pptLes02 Restricting and Sorting Data using SQL.ppt
Les02 Restricting and Sorting Data using SQL.ppt
 
Enabling Enterprise-wide OT Data access with Matrikon Data Broker.pdf
Enabling Enterprise-wide OT Data access  with Matrikon Data Broker.pdfEnabling Enterprise-wide OT Data access  with Matrikon Data Broker.pdf
Enabling Enterprise-wide OT Data access with Matrikon Data Broker.pdf
 
unit 1 lecture 1 - Introduction - Software Engineering Myths.pdf
unit 1 lecture 1 - Introduction - Software Engineering Myths.pdfunit 1 lecture 1 - Introduction - Software Engineering Myths.pdf
unit 1 lecture 1 - Introduction - Software Engineering Myths.pdf
 
Open Sprintera (Where Open Source Sparks a Sprint of Possibilities)
Open Sprintera (Where Open Source Sparks a Sprint of Possibilities)Open Sprintera (Where Open Source Sparks a Sprint of Possibilities)
Open Sprintera (Where Open Source Sparks a Sprint of Possibilities)
 

Eco-Friendly Hardware Hacking with Android

  • 1. Carlo Pescio @CarloPescio http://eptacom.net Carlo Pescio Eco-friendly hardware hacking with Android
  • 2. Carlo Pescio @CarloPescio http://eptacom.net Code in Movies
  • 3. Carlo Pescio @CarloPescio http://eptacom.net Super Heroes - Build this in a cave - With a bunch of scraps
  • 4. Carlo Pescio @CarloPescio http://eptacom.net Reality
  • 5. Carlo Pescio @CarloPescio http://eptacom.net It gets worse
  • 6. Carlo Pescio @CarloPescio http://eptacom.net Your ____mission Should you choose to accept it… - Your phone (no rooting) - Bunch of scraps - No Firmware 12V
  • 7. Carlo Pescio @CarloPescio http://eptacom.net Smart > Hero Don’t do industrial controls using scraps It’s OK at home Great learning opportunity
  • 8. Carlo Pescio @CarloPescio http://eptacom.net Just be careful, ok?
  • 9. Carlo Pescio @CarloPescio http://eptacom.net Step 1: blinking an LED Phone + Scraps
  • 10. Carlo Pescio @CarloPescio http://eptacom.net Choices, choices… Built-in led[s] Audio USB
  • 11. Carlo Pescio @CarloPescio http://eptacom.net LEDs in common USB scraps Flash drive Mouse Keyboard Printer
  • 12. Carlo Pescio @CarloPescio http://eptacom.net And the winner is… LEDs are host-controlled Standard protocol LEDs outlive the keys Easy to find
  • 13. Carlo Pescio @CarloPescio http://eptacom.net Phone – Keyboard connection Your phone is normally a device (gadget) for a computer (host). A keyboard is a gadget => your phone must turn into a host => you need an OTG adapter
  • 14. Carlo Pescio @CarloPescio http://eptacom.net OTG Adapter (make or buy) + = + wire 4-5
  • 15. Carlo Pescio @CarloPescio http://eptacom.net Device / Interface / Endpoint Device Descriptor Endpoint Descriptor 1 Endpoint Descriptor 2 … Configuration Descriptor 1 Configuration Descriptor 2 Interface 0 Descriptor Interface 1 Descriptor Interface 0 Descriptor Interface 1 Descriptor … … Kbd + trackball Solar powered Keyboard Interrupt IN USB powered Trackball
  • 16. Carlo Pescio @CarloPescio http://eptacom.net The software side Don’t write any code yet Interface #0 Class: Human Interaction Device (0x3) Endpoint: #0 Address : 129 (10000001) Number : 1 Direction : Inbound (0x80) Type : Intrrupt (0x3) Poll Interval : 10 Max Packet Size: 8 Attributes : 000000011 Interface #1 Class: Human Interaction Device (0x3) Endpoint: #0 Address : 130 (10000010) Number : 2 Direction : Inbound (0x80) Type : Intrrupt (0x3) Poll Interval : 10 Max Packet Size: 3 Attributes : 000000011
  • 17. Carlo Pescio @CarloPescio http://eptacom.net The missing endpoint Source: USB Device Class Definition for Human Interface Devices Firmware Specification, Section 4.4 If no Interrupt Out endpoint is declared then Output reports are transmitted to a device through the Control endpoint. Endpoint 0 is a Control pipe always present in USB devices. Therefore, only the Interrupt In pipe is described for the Interface descriptor using an Endpoint descriptor.
  • 18. Carlo Pescio @CarloPescio http://eptacom.net Know thy APIs You just can’t get hold of endpoint 0. But: UsbDeviceConnection. controlTransfer( gazillion parameters ) Performs a control transaction on endpoint zero for this device. The direction of the transfer is determined by the request type. If requestType & USB_ENDPOINT_DIR_MASK is USB_DIR_OUT, then the transfer is a write […]
  • 19. Carlo Pescio @CarloPescio http://eptacom.net 7.2.2 SET_REPORT Part Description bmRequestType 00100001 (0x21) bRequest SET_REPORT wValue Report Type and Report ID wIndex Interface wLength Report Length Data Report SET_REPORT = 0x09 (Paragraph 7.2)
  • 20. Carlo Pescio @CarloPescio http://eptacom.net For LEDs / Keyboards Report Type: 02 = Output (Paragraph 7.2.1) Report ID: 0 = Not Used (Paragraph 7.2.1) Interface = 0 (irrelevant here) Report Length = 1 (1 byte, Appendix B.1) Data: bitmask where bit 0 = NUM LOCK bit 1 = CAPS LOCK bit 2 = SCROLL LOCK
  • 21. Carlo Pescio @CarloPescio http://eptacom.net Sending the report int controlTransfer( int requestType, int request, int value, int index, byte[] buffer, int length, int timeout) byte[] buf = new byte[] { b }; connection.controlTransfer( 0x21, 0x09, 0x0200, 0x0000, buf, 1, 1000); // data [as array] -> bitmask // wValue -> 0x0200 // wIndex -> 0x0000 // wLength -> 1 // 1 sec ok -> 1000 // bmRequestType -> 0x21 // bRequest -> 0x09
  • 22. Sketch of the code usbManager = (UsbManager) getSystemService(Context.USB_SERVICE); // just get the first usb device – // should get the keyboard instead UsbDevice device = (UsbDevice) usbManager.getDeviceList().values(). toArray()[0]; usbManager.requestPermission( device, permissionIntent);
  • 23. Carlo Pescio @CarloPescio http://eptacom.net … build the Keyboard // … receive intent UsbDevice device = (UsbDevice) intent.getParcelableExtra( UsbManager.EXTRA_DEVICE); keyboard = new UsbKeyboard(usbManager, device);
  • 24. Keyboard public UsbKeyboard(UsbManager usbManager, UsbDevice device) { requestQueue = new LinkedBlockingQueue<Byte>(); connection = usbManager.openDevice(device); // WHY AM I DOING THIS? GUESS  ifc0 = device.getInterface(0); connection.claimInterface(ifc0, true); ioThread = new Thread(usbWriteLoop); ioThread.start(); }
  • 25. private Runnable usbWriteLoop = new Runnable() { // … while( !stop ) { Byte b = requestQueue.take(); if( b < 0 ) { stop = true; } else { byte[] buf = new byte[] { b }; connection.controlTransfer( 0x21, 0x09, 0x0200,0x0000, buf, 1, 1000); } } // … };
  • 26. UI public void onCheckedChanged( CompoundButton buttonView, boolean isChecked) { byte ledMask = 0; if( led1.isChecked() ) ledMask += 1; if( led2.isChecked() ) ledMask += 2; if( led3.isChecked() ) ledMask += 4; // just adds ledMask to the requestQueue keyboard.powerLedsFromMask(ledMask); }
  • 27. Carlo Pescio @CarloPescio http://eptacom.net We did it!
  • 28. Carlo Pescio @CarloPescio http://eptacom.net Detour: how fast can we go? Just use an infinite loop / no sleeping or waiting: byte[] buf0 = new byte[] { 0 }; byte[] buf1 = new byte[] { 4 }; while( true ) { connection.controlTransfer( 0x21, 0x09, 0x0200, 0x0000, buf0, 1, 1000); connection.controlTransfer( 0x21, 0x09, 0x0200, 0x0000, buf1, 1, 1000); }
  • 29. Carlo Pescio @CarloPescio http://eptacom.net Hollywood loves CRTs Fantastic Four Iron Man Star Trek Enterprise The Big Bang Theory
  • 30. Carlo Pescio @CarloPescio http://eptacom.net Me too!
  • 31. Carlo Pescio @CarloPescio http://eptacom.net Expected Well, almost No RT OS -> some (major) jitter expected Square wave
  • 32. Carlo Pescio @CarloPescio http://eptacom.net Surprise!! Captain America – the Winter Soldier
  • 33. Carlo Pescio @CarloPescio http://eptacom.net Kill the noise Not exactly square but clean  Guess the frequency!
  • 34. Carlo Pescio @CarloPescio http://eptacom.net About 1 KHz (on my device)
  • 35. Carlo Pescio @CarloPescio http://eptacom.net Conclusions from detour Useful: we killed the noise Things you cannot do: - “high” frequency / low latency / low jitter stuff - PWM - Infrared remotes - … etc. … Things you can do: - Turning on and off some stuff at low freq
  • 36. Carlo Pescio @CarloPescio http://eptacom.net No joy yet - Different voltage (LED powered from your phone USB) - High current (same as above) - Generally speaking, no galvanic isolation (whatever happens there, happens to your phone) You can’t just put a motor where the LED is 
  • 37. Carlo Pescio @CarloPescio http://eptacom.net Step 2: Galvanic Isolation
  • 38. Carlo Pescio @CarloPescio http://eptacom.net The ubiquitous optoisolator
  • 39. Carlo Pescio @CarloPescio http://eptacom.net A small step forward… But can’t power a motor with that
  • 40. Carlo Pescio @CarloPescio http://eptacom.net A level of indirection… … brings new problems 1) Who is providing the current going through the phototransistor? 2) The phototransistor can’t handle much current anyway Phone [usb] ???
  • 41. Carlo Pescio @CarloPescio http://eptacom.net Step 3: ATX is your best friend Will solve all your problems at once 
  • 42. Carlo Pescio @CarloPescio http://eptacom.net ATX starts in stand-by
  • 43. Carlo Pescio @CarloPescio http://eptacom.net So that’s it 12 v 12K SUPPLY POWER ATX PS_ONCOM 1K1K keyboard 1.2mA USB line power
  • 44. Carlo Pescio @CarloPescio http://eptacom.net Some assembly required
  • 45. Carlo Pescio @CarloPescio http://eptacom.net … and it works
  • 46. Carlo Pescio @CarloPescio http://eptacom.net What about inputs?? Well, it’s a keyboard! you get digital inputs for free (almost) ???
  • 47. Carlo Pescio @CarloPescio http://eptacom.net Relevant code connection = usbManager.openDevice(device); ifc0 = device.getInterface(0); connection.claimInterface(ifc0, true); endPointRead = ifc0.getEndpoint(0); while( true ) { final byte[] buffer = new byte[8]; int transfer = connection.bulkTransfer(endPointRead, buffer, 8, 1000); if( transfer > 0 ) { // [modifier,reserved,Key1,Key2,Key3,Key4,Key5,Key6] byte key = buffer[2]; // dumps Key1 only... if( key != 0 ) Log.e(“KEY", " " + key); } }
  • 48. Carlo Pescio @CarloPescio http://eptacom.net … and we’re live
  • 49. Carlo Pescio @CarloPescio http://eptacom.net Missing: galvanic isolation! 1K1KDI ROW / COLUMN combo
  • 50. Carlo Pescio @CarloPescio http://eptacom.net Charging while in host mode Usually the host (phone) provides power. OTG specification: 36.5 kΩ between pin 4 and 5 […] The OTG device is allowed to charge and enter host mode
  • 51. Carlo Pescio @CarloPescio http://eptacom.net May or may not work for you If it works, ATX might be even more of a friend! 5V here also in standby
  • 52. Carlo Pescio @CarloPescio http://eptacom.net If it doesn’t work… - Fiddle with resistor values - Remove battery and provide power from there - Also useful when battery is dead - That’s a story for another time 
  • 53. Carlo Pescio @CarloPescio http://eptacom.net Get in touch carlo.pescio@gmail.com @CarloPescio http://eptacom.net