Skip to content
This repository was archived by the owner on Feb 21, 2020. It is now read-only.

Commit c13dd91

Browse files
windows drivers menu item
1 parent 326e15c commit c13dd91

File tree

6 files changed

+141
-5
lines changed

6 files changed

+141
-5
lines changed

arduino-object-naming.int

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,8 @@
3737
"org-arduino-ide-domain-discovery" : discovery domain name
3838
"org-arduino-ide-domain-filesystem" : filesystem domain name
3939
"org-arduino-ide-domain-compiler" : compiler domain name
40-
"org-arduino-ide-domain-osr" : os domain name
40+
"org-arduino-ide-domain-os" : os domain name
41+
"org-arduino-ide-domain-driver" : driver domain name
4142

4243
##########
4344

main.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,8 @@ define(function (require, exports, module) {
5252
filesystemDomainName = "org-arduino-ide-domain-filesystem",
5353
copypasteDomainName = "org-arduino-ide-domain-copypaste",
5454
compilerDomainName = "org-arduino-ide-domain-compiler",
55-
osDomainName = "org-arduino-ide-domain-os";
55+
osDomainName = "org-arduino-ide-domain-os",
56+
driverDomainName = "org-arduino-ide-domain-driver";
5657

5758

5859

@@ -93,13 +94,15 @@ define(function (require, exports, module) {
9394
brackets.arduino.domains[copypasteDomainName] = new NodeDomain( copypasteDomainName, ExtensionUtils.getModulePath(module, "node/copypaste"));
9495
brackets.arduino.domains[compilerDomainName] = new NodeDomain( compilerDomainName, ExtensionUtils.getModulePath(module, "node/compiler"));
9596
brackets.arduino.domains[osDomainName] = new NodeDomain( osDomainName, ExtensionUtils.getModulePath(module, "node/os"));
97+
brackets.arduino.domains[driverDomainName] = new NodeDomain( driverDomainName, ExtensionUtils.getModulePath(module, "node/driver"));
9698

9799
//TODO complete with others platform path: core, user lib, sketchbook...
98100
brackets.arduino.options.rootdir = FileSystem.getDirectoryForPath( FileUtils.getNativeModuleDirectoryPath(module));
99101
brackets.arduino.options.librariesdir = FileSystem.getDirectoryForPath( FileUtils.getNativeModuleDirectoryPath(module) + "/libraries");
100102
brackets.arduino.options.modulesdir = FileSystem.getDirectoryForPath( FileUtils.getNativeModuleDirectoryPath(module) + "/modules");
101103
brackets.arduino.options.hardwaredir = FileSystem.getDirectoryForPath( FileUtils.getNativeModuleDirectoryPath(module) + "/hardware");
102104
brackets.arduino.options.examples = FileSystem.getDirectoryForPath( FileUtils.getNativeModuleDirectoryPath(module) + "/examples");
105+
brackets.arduino.options.shared = FileSystem.getDirectoryForPath( FileUtils.getNativeModuleDirectoryPath(module) + "/shared");
103106
//brackets.arduino.options.sketcbook = FileSystem.getDirectoryForPath( brackets.arduino.preferences.get("arduino.ide.preferences.sketchbook") || getDefaultSketchBook() );//brackets.arduino.preferences.get("arduino.ide.preferences.sketchbook") == "" ? getDefaultSketchBook() : brackets.arduino.preferences.get("arduino.ide.preferences.sketchbook");
104107
//brackets.arduino.options.userlibrariesdir = FileSystem.getDirectoryForPath( brackets.arduino.options.sketcbook.fullPath + "/libraries");
105108

modules/Localization/nls/it/strings.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ define({
4040
},
4141
"HELP": {
4242
"TITLE" : "Aiuto",
43+
"ITEM_DRIVER" : "Installa driver Arduino",
4344
"ITEM_ABOUT" : "Arduino"
4445
}
4546
},

modules/Localization/nls/root/strings.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ define({
4040
},
4141
"HELP": {
4242
"TITLE" : "Help",
43+
"ITEM_DRIVER" : "Install Arduino driver",
4344
"ITEM_ABOUT" : "About Arduino"
4445
}
4546
},

modules/Menu/main.js

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,9 @@ define(function (require, exports, module) {
4949
var filesystemDomainName = "org-arduino-ide-domain-filesystem",
5050
filesystemDomain = null,
5151
copypasteDomainName = "org-arduino-ide-domain-copypaste",
52-
copypasteDomain = null;
52+
copypasteDomain = null,
53+
driverDomainName = "org-arduino-ide-domain-driver",
54+
driverDomain = null;
5355

5456
var menuPrefix = "[arduino ide - menu] ";
5557

@@ -96,7 +98,9 @@ define(function (require, exports, module) {
9698

9799

98100
//Edit Menu IDs
99-
var ARDUINO_MENU_HELP_ABOUT = "arduino.ide.menu.help.about";
101+
var ARDUINO_MENU_HELP_ABOUT = "arduino.ide.menu.help.about",
102+
ARDUINO_MENU_HELP_DRIVER = "arduino.ide.menu.help.driver";
103+
100104

101105
var Strings;
102106
/**
@@ -106,6 +110,9 @@ define(function (require, exports, module) {
106110
//get domains
107111
filesystemDomain = brackets.arduino.domains[filesystemDomainName];
108112
copypasteDomain = brackets.arduino.domains[copypasteDomainName];
113+
114+
driverDomain = brackets.arduino.domains[driverDomainName];
115+
109116
Strings = brackets.arduino.strings;
110117
sketch_importLibraryDirectory = brackets.arduino.options.librariesdir;
111118
sketch_importLibraryUserDirectory = brackets.arduino.options.userlibrariesdir;
@@ -238,7 +245,13 @@ define(function (require, exports, module) {
238245

239246
CommandManager.register(Strings.ARDUINO.MENU.HELP.ITEM_ABOUT, ARDUINO_MENU_HELP_ABOUT, helpMenu_showAboutDialog);
240247

241-
HelpMenu.addMenuDivider("arduino.menu.help.divider1");
248+
if(brackets.platform === 'win')
249+
CommandManager.register(Strings.ARDUINO.MENU.HELP.ITEM_WIN_DRIVER, ARDUINO_MENU_HELP_DRIVER, helpMenu_driver);
250+
251+
HelpMenu.addMenuDivider();
252+
if(brackets.platform === 'win')
253+
HelpMenu.addMenuItem(ARDUINO_MENU_HELP_DRIVER);
254+
242255
HelpMenu.addMenuItem(ARDUINO_MENU_HELP_ABOUT);
243256

244257
}
@@ -477,6 +490,14 @@ define(function (require, exports, module) {
477490
ExtensionUtils.loadStyleSheet(module, "css/aboutDialog.css");
478491
}
479492

493+
494+
function helpMenu_driver(){
495+
var driversPath = FileSystem.getFileForPath(brackets.arduino.options.shared.fullPath + "drivers");
496+
driverDomain.exec("install", driversPath.fullPath);
497+
}
498+
499+
500+
480501
/* //ARDUINO EXAMPLES ???
481502
function setMenuActions($event,data){
482503
var d1 = Dialogs.showModalDialog(DefaultDialogs.DIALOG_ID_INFO, "", createObjects(data));

node/driver.js

Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
/*
2+
* This file is part of Arduino
3+
*
4+
* Permission is hereby granted, free of charge, to any person obtaining a copy
5+
* of this software and associated documentation files (the "Software"), to deal
6+
* in the Software without restriction, including without limitation the rights
7+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8+
* copies of the Software, and to permit persons to whom the Software is
9+
* furnished to do so, subject to the following conditions:
10+
*
11+
* The above copyright notice and this permission notice shall be included in all
12+
* copies or substantial portions of the Software.
13+
*
14+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20+
* SOFTWARE.
21+
*
22+
* Copyright 2015 Arduino Srl (http://www.arduino.org/)
23+
*
24+
* authors: arduino.org team - [email protected]
25+
*
26+
*/
27+
28+
(function () {
29+
"use strict";
30+
31+
var async = require('async'),
32+
exec = require('child_process').exec,
33+
path = require('path');
34+
35+
var domainName = "org-arduino-ide-domain-driver",
36+
dManager;
37+
38+
function isWin64() {
39+
return process.arch === 'x64' || process.env.hasOwnProperty('PROCESSOR_ARCHITEW6432');
40+
}
41+
42+
43+
function install(driverPath){console.log("A "+driverPath);
44+
async.series([
45+
function(callback){console.log("B1");
46+
// arduino and linino windows drivers
47+
var fileexe = isWin64() ? path.join(driverPath , 'dpinst-amd64.exe') : path.join(driverPath + 'dpinst-x86.exe'); console.log("B2 " + fileexe);
48+
var driverInstallation = exec("\""+fileexe+"\"",
49+
function (error, stdout, stderr) {
50+
console.log("B2.1");
51+
if (error !== null){
52+
console.error('B3: ' + error);
53+
callback(error);
54+
}
55+
else{
56+
console.log("B3 " + stdout);
57+
callback(null, 'arduino');
58+
}
59+
});
60+
},
61+
function(callback){console.log("C1 ");
62+
// atmel windows drivers
63+
var fileexe = path.join(driverPath + 'driver-atmel-bundle-7.0.712.exe'); console.log("CC " + fileexe);
64+
var atmelInstallation = exec( "\""+ fileexe + "\"" ,
65+
function (error, stdout, stderr) {
66+
if (error !== null)
67+
//console.log('exec error: ' + error);
68+
callback(error);
69+
else
70+
callback(null, 'arduino');
71+
});
72+
}
73+
],
74+
// optional callback
75+
function(err, results){
76+
if(!err){console.log("ERR "+err);
77+
console.error(err);
78+
}
79+
else{
80+
console.log("Driver installation results");
81+
return(results);
82+
}
83+
});
84+
85+
}
86+
87+
function init(domainManager) {
88+
if (!domainManager.hasDomain(domainName)) {
89+
domainManager.registerDomain(domainName, {major: 0, minor: 1});
90+
}
91+
dManager = domainManager;
92+
93+
domainManager.registerCommand(
94+
domainName,
95+
"install",
96+
install,
97+
false,
98+
"Install Windows Drivers",
99+
[{
100+
name: "dir",
101+
type: "string",
102+
description: "Windows Drivers Directory Path"
103+
}]
104+
);
105+
}
106+
107+
exports.init = init;
108+
109+
}());

0 commit comments

Comments
 (0)