Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

1-wire-js

Package Overview
Dependencies
Maintainers
1
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

1-wire-js - npm Package Compare versions

Comparing version 1.1.2 to 1.1.3

7

ow.js

@@ -6,3 +6,3 @@ module.exports = function () {

var ow = {};
var crc8 = function (value) {

@@ -125,3 +125,3 @@ return crc.crc81wire(value);

},
addedListener : function (fn) {
removeListener : function (fn) {
this.handlers = this.handlers.filter(function (item) {

@@ -916,2 +916,3 @@ if (item !== fn) {

return ow;
}();
}
();

@@ -1,1 +0,1 @@

module.exports=function(){"use strict";var e=require("q"),r=require("crc"),t={},n=function(e){return r.crc81wire(e)};const i=10;var u=!1;const o=1274,c=9360,a={vendorId:o,productId:c},s={permissions:[{usbDevices:[a]}]};t.checkPermission=function(){var r=e.defer();return chrome.permissions.contains(s,function(e){e?r.resolve():r.reject()}),r.promise},t.requestPermission=function(){var r=e.defer();return chrome.permissions.request(s,function(e){e?r.resolve():r.reject()}),r.promise};var d,f,l;t.deviceOpen=function(){var r=e.defer();return chrome.usb.getDevices(a,function(e){chrome.usb.findDevices(a,function(t){t&&t.length>0?(f=t[0],d=e[0],chrome.usb.listInterfaces(f,function(e){l=e[0],m(),h().then(r.resolve)})):r.reject()})}),r.promise};var h=function(){var r=e.defer();return chrome.usb.claimInterface(f,l.interfaceNumber,r.resolve),r.promise},v={interrupt:{},bulkIn:{},bulkOut:{}},m=function(){l.endpoints.forEach(function(e){"in"===e.direction&&"interrupt"===e.type?v.interrupt=e:"in"===e.direction&&"bulk"===e.type?v.bulkIn=e:"out"===e.direction&&"bulk"===e.type&&(v.bulkOut=e)})},y=function(){this.handlers=[]};y.prototype={addListener:function(e){this.handlers.push(e)},addedListener:function(e){this.handlers=this.handlers.filter(function(r){return r!==e?r:void 0})},dispatch:function(e,r){var t=r;this.handlers.forEach(function(r){r.call(t,e)})}},t.onDeviceAdded=new y,chrome.usb.onDeviceAdded.addListener(function(){t.onDeviceAdded.dispatch()});var p=function(){this.handlers=[]};p.prototype={addListener:function(e){this.handlers.push(e)},removeListener:function(e){this.handlers=this.handlers.filter(function(r){return r!==e?r:void 0})},dispatch:function(e,r){var t=r;this.handlers.forEach(function(r){r.call(t,e)})}},t.onDeviceRemoved=new p,chrome.usb.onDeviceRemoved.addListener(function(e){e&&e.device===d.device&&t.onDeviceRemoved.dispatch()}),t.deviceInterruptTransfer=function(){var r=e.defer(),t={direction:v.interrupt.direction,endpoint:v.interrupt.address,length:32,timeout:i};return chrome.usb.interruptTransfer(f,t,function(e){e.resultCode?r.reject(chrome.runtime.lastError):r.resolve(w(e.data))}),r.promise},t.deviceControlTransfer=function(r){var t=e.defer();return r.timeout=i,chrome.usb.controlTransfer(f,r,function(e){e.resultCode?t.reject(chrome.runtime.lastError):t.resolve(e)}),t.promise},t.deviceBulkTransfer=function(r){var t=e.defer();return r.timeout=i,chrome.usb.bulkTransfer(f,r,function(e){e.resultCode?t.reject(chrome.runtime.lastError):t.resolve(e)}),t.promise},t.deviceReset=function(){var e={direction:"out",recipient:"device",requestType:"vendor",request:0,value:0,index:0,data:new Uint8Array(0).buffer};return t.deviceControlTransfer(e).then(t.wireDetectShort).then(function(e){if(e)throw new Error("Reset Failed: Short Detected")})};var w=function(e){var r=new Uint8Array(e),t={};return t.SPUE=1&r[0],t.SPCE=r[0]>>3&1,t.Speed=r[1],t.PullupDuration=r[2],t.PulldownSlewRate=r[4],t.WriteLowTime=r[5],t.DataSampleOffset=r[6],t.SPUA=1&r[8],t.PMOD=r[8]>>3&1,t.HALT=r[8]>>4&1,t.IDLE=r[8]>>5&1,t.EP0F=r[8]>>7&1,t.CommCommand1=r[9],t.CommCommand2=r[10],t.CommCommandBufferStatus=r[11],t.DataOutBufferStatus=r[12],t.DataInBufferStatus=r[13],r[16]&&(t.ResultRegisters={},t.ResultRegisters.DetectKey=165===r[16],r[17]&&165!==r[17]&&(t.ResultRegisters.EOS=r[17]>>7&1,t.ResultRegisters.RDP=r[17]>>6&1,t.ResultRegisters.CRC=r[17]>>5&1,t.ResultRegisters.CMP=r[17]>>4&1,t.ResultRegisters.APP=r[17]>>2&1,t.ResultRegisters.SH=r[17]>>1&1,t.ResultRegisters.NRS=1&r[17]),t.ResultRegisters.Data=r.slice(16,r.length)),t};t.deviceGetStatus=function(){var e={direction:v.interrupt.direction,endpoint:v.interrupt.address,length:32};return t.deviceBulkTransfer(e).then(function(e){return w(e.data)})},t.wireDetectShort=function(){return t.deviceGetStatus().then(function(e){return 0!==e.CommCommandBufferStatus?!0:e.ResultRegisters&&!e.ResultRegisters.DetectKey&&e.ResultRegisters.Data[0]&!0?!0:!1})},t.wireSetSpeed=function(e){var r=e?2:1,n={direction:"out",recipient:"device",requestType:"vendor",request:2,value:2,index:r,data:new Uint8Array(0).buffer};return t.deviceControlTransfer(n)},t.wireReset=function(){var r={direction:"out",recipient:"device",requestType:"vendor",request:1,value:3147,index:1,data:new Uint8Array(0).buffer};return t.deviceControlTransfer(r).then(function(){var r=e.defer();return setTimeout(function(){t.wireDetectShort().then(function(e){e?r.reject():r.resolve()})},5),r.promise}).fail(function(){return t.deviceReset()}).fail(function(){throw new Error("Reset Failed: Unrecoverable short detected")})},t.wireWrite=function(e){var r={direction:v.bulkOut.direction,endpoint:v.bulkOut.address,data:new Uint8Array(e).buffer},n={direction:"out",recipient:"device",requestType:"vendor",request:1,value:4213,index:e.length,data:new Uint8Array(0).buffer,timeout:i};return t.deviceBulkTransfer(r).then(function(){return t.deviceControlTransfer(n)})},t.wireWriteBit=function(e){var r={direction:"out",recipient:"device",requestType:"vendor",request:1,value:545|e<<3,index:0,data:new Uint8Array(0).buffer};return t.deviceControlTransfer(r)},t.wireRead=function(e){var r={direction:v.bulkIn.direction,endpoint:v.bulkIn.address,length:e};return t.deviceBulkTransfer(r).then(function(e){return new Uint8Array(e.data)})},t.wireReadBit=function(){var e={direction:"out",recipient:"device",requestType:"vendor",request:1,value:41,index:0,data:new Uint8Array(0).buffer};return t.deviceControlTransfer(e).then(function(e){return t.wireRead(1)}).then(function(e){return e[0]})},t.wireClearByte=function(){return t.wireRead(1)},t.keyRomCommand=function(e,r,n){var i,n=n||!1,o={direction:v.bulkOut.direction,endpoint:v.bulkOut.address,data:new Uint8Array(8).buffer};e?(o.data=new Uint8Array(r).buffer,i=n?105:85):i=n?60:204;var c={direction:"out",recipient:"device",requestType:"vendor",request:1,value:101,index:i,data:new Uint8Array(0).buffer};return t.deviceControlTransfer(c).then(function(){return u=n,t.wireSetSpeed(n)}).then(function(){return t.deviceBulkTransfer(o)})},t.keyRomMatch=function(e){return t.keyRomCommand(!0,e,!1)},t.keyRomMatchOverdrive=function(e){return t.keyRomCommand(!0,e,!0)},t.keyRomSkip=function(){return t.keyRomCommand(!1,null,!1)},t.keyRomSkipOverdrive=function(){return t.keyRomCommand(!1,null,!0)};var R={lastDiscrepancy:0,lastDevice:!1,keys:[]},k=function(r){var t=e.defer();return B(r).then(function(e){if(R=e,e.keys&&e.keys[0]){var r=e.keys[0];r.toHexString=function(){return U(this)},t.resolve(r)}else t.reject()}),t.promise};t.keySearchFirst=function(){var e={lastDiscrepancy:0,lastDevice:!1,keys:[]};return k(e)},t.keySearchNext=function(e){return k(R)};var B=function(e){var r={idBitNumber:1,lastZero:0,romByteNumber:0,romByteMask:1,searchResult:!1,idBit:0,cmpIdBit:0,searchDirection:0,romId:new Uint8Array(8),lastDevice:!1,lastDiscrepancy:e.lastDiscrepancy};return t.wireSetSpeed(!1).then(t.wireReset).then(function(){return t.wireWrite(new Uint8Array([240]))}).then(t.wireClearByte).then(function(){return D(r)}).then(function(r){return r.searchResult&&e.keys.push(r.romId),e.lastDiscrepancy=r.searchResultObject,e.lastDevice=r.lastDevice,e})},D=function(e){return t.wireReadBit().then(function(r){e.idBit=r}).then(function(){return t.wireReadBit()}).then(function(r){return e.cmpIdBit=r,1!==e.idBit||1!==e.cmpIdBit?(e.idBit!=e.cmpIdBit?e.searchDirection=e.idBit:(e.idBitNumber<e.lastDiscrepancy?e.searchDirection=(e.romId[e.romByteNumber]&e.romByteMask)>0?1:0:e.searchDirection=e.idBitNumber==e.lastDiscrepancy?1:0,0===e.searchDirection&&(e.lastZero=e.idBitNumber)),1===e.searchDirection?e.romId[e.romByteNumber]|=e.romByteMask:e.romId[e.romByteNumber]&=~e.romByteMask,t.wireWriteBit(e.searchDirection).then(function(){return e.idBitNumber++,e.romByteMask<<=1,e.romByteMask>=256&&(e.romByteNumber++,e.romByteMask=1),e.romByteNumber<8?D(e):(e.idBitNumber>=65&&0===n(e.romId)&&(e.lastDiscrepancy=e.lastZero,0===e.lastDiscrepancy&&(e.lastDevice=!0),e.searchResult=!0),(e.searchResult===!1||0===e.romId[0])&&(e.lastDiscrepancy=0,e.lastDevice=!1,e.searchResult=!1),e)})):e})};t.keyReadAll=function(e,r){return t.wireSetSpeed(!1).then(t.wireReset).then(function(){return r?t.keyRomMatchOverdrive(e):t.keyRomMatch(e)}).then(function(){var e=new Uint8Array([240,0,0]);return t.wireWrite(e)}).then(t.wireClearByte).then(t.wireClearByte).then(t.wireClearByte).then(function(){return b()})};var b=function(e,r){var r=r||0,e=e||new Array(256);e[r]=new Uint8Array(32);for(var n=new Uint8Array(32),i=0;i<n.length;i++)n[i]=255;return t.wireWrite(n).then(function(){return C(e[r])}).then(function(){return r<e.length-1?b(e,r+1):e})},C=function(e,r){var r=r||0;return t.wireRead(16).then(function(t){return t.forEach(function(t){e[r++]=t}),r<e.length?C(e,r):void 0})};t.keyWrite=function(e,r,n,i){var r=r||0,u=255&r,o=(65280&r)>>8,c=n.length-1,n=n||new Uint8Array(0);return t.wireSetSpeed(!1).then(function(){return g(e,r,n,i)}).then(t.wireReset).then(function(){return i?t.keyRomMatchOverdrive(e):t.keyRomMatch(e)}).then(function(){var e=new Uint8Array([85,u,o,c]);return t.wireWrite(e)}).then(t.wireClearByte).then(t.wireClearByte).then(t.wireClearByte).then(t.wireClearByte)};var g=function(e,r,n,i){var u,r=r||0,o=255&r,c=(65280&r)>>8,n=(n.length-1,n||new Uint8Array(0));return t.wireReset().then(function(){return i?t.keyRomMatchOverdrive(e):t.keyRomMatch(e)}).then(function(){var e=new Uint8Array([15,o,c]);return t.wireWrite(e)}).then(t.wireClearByte).then(t.wireClearByte).then(t.wireClearByte).then(function(){return A(n,0)}).then(t.wireReset).then(function(){return i?t.keyRomMatchOverdrive(e):t.keyRomMatch(e)}).then(function(){var e=new Uint8Array([170]);return t.wireWrite(e)}).then(function(){return t.wireRead(n.length)}).then(function(e){u=e}).then(t.wireClearByte).then(function(){return u.length==n.length&&u.every(function(e,r){return e===n[r]})?void 0:g(e,r,n,i)})},A=function(e,r){for(var n=e.length-r>16?16:e.length-r,i=new Uint8Array(n),u=0;n>u;u++)i[u]=e[r+u];return t.wireWrite(i).then(function(){return e.length-(r+n)>0?A(e,r+n):void 0})};t.keyWriteAll=function(e,r,t){return S(e,r,0,t)};var S=function(e,r,n,i){var u=32*n;return t.keyWrite(e,u,r[n],i).then(function(){return r.length>n+1?S(e,r,n+1,i):void 0})};t.keyWriteDiff=function(e,r,n,i){return(n||new Array(0)).length<r.length?t.keyReadAll(e,i).then(function(t){return T(e,r,t,0,i)}):T(e,r,n,0,i)};var T=function(e,r,n,i,u){var o=32*i;return r[i].length===n[i].length&&r[i].every(function(e,r){return e===n[i][r]})&&r.length>i+1?T(e,r,n,i+1,u):t.keyWrite(e,o,r[i],u).then(function(){return r.length>i+1?T(e,r,n,i+1,u):void 0})},U=function(e){const r=["0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F"];var t="",n=Array.prototype.slice.call(e);return n.reverse().map(function(e){t+=r[e>>4&15]+r[15&e]}),t};return t}();
module.exports=function(){"use strict";var e=require("q"),r=require("crc"),t={},n=function(e){return r.crc81wire(e)};const i=10;var u=!1;const o=1274,c=9360,a={vendorId:o,productId:c},s={permissions:[{usbDevices:[a]}]};t.checkPermission=function(){var r=e.defer();return chrome.permissions.contains(s,function(e){e?r.resolve():r.reject()}),r.promise},t.requestPermission=function(){var r=e.defer();return chrome.permissions.request(s,function(e){e?r.resolve():r.reject()}),r.promise};var d,f,l;t.deviceOpen=function(){var r=e.defer();return chrome.usb.getDevices(a,function(e){chrome.usb.findDevices(a,function(t){t&&t.length>0?(f=t[0],d=e[0],chrome.usb.listInterfaces(f,function(e){l=e[0],m(),h().then(r.resolve)})):r.reject()})}),r.promise};var h=function(){var r=e.defer();return chrome.usb.claimInterface(f,l.interfaceNumber,r.resolve),r.promise},v={interrupt:{},bulkIn:{},bulkOut:{}},m=function(){l.endpoints.forEach(function(e){"in"===e.direction&&"interrupt"===e.type?v.interrupt=e:"in"===e.direction&&"bulk"===e.type?v.bulkIn=e:"out"===e.direction&&"bulk"===e.type&&(v.bulkOut=e)})},y=function(){this.handlers=[]};y.prototype={addListener:function(e){this.handlers.push(e)},removeListener:function(e){this.handlers=this.handlers.filter(function(r){return r!==e?r:void 0})},dispatch:function(e,r){var t=r;this.handlers.forEach(function(r){r.call(t,e)})}},t.onDeviceAdded=new y,chrome.usb.onDeviceAdded.addListener(function(){t.onDeviceAdded.dispatch()});var p=function(){this.handlers=[]};p.prototype={addListener:function(e){this.handlers.push(e)},removeListener:function(e){this.handlers=this.handlers.filter(function(r){return r!==e?r:void 0})},dispatch:function(e,r){var t=r;this.handlers.forEach(function(r){r.call(t,e)})}},t.onDeviceRemoved=new p,chrome.usb.onDeviceRemoved.addListener(function(e){e&&e.device===d.device&&t.onDeviceRemoved.dispatch()}),t.deviceInterruptTransfer=function(){var r=e.defer(),t={direction:v.interrupt.direction,endpoint:v.interrupt.address,length:32,timeout:i};return chrome.usb.interruptTransfer(f,t,function(e){e.resultCode?r.reject(chrome.runtime.lastError):r.resolve(w(e.data))}),r.promise},t.deviceControlTransfer=function(r){var t=e.defer();return r.timeout=i,chrome.usb.controlTransfer(f,r,function(e){e.resultCode?t.reject(chrome.runtime.lastError):t.resolve(e)}),t.promise},t.deviceBulkTransfer=function(r){var t=e.defer();return r.timeout=i,chrome.usb.bulkTransfer(f,r,function(e){e.resultCode?t.reject(chrome.runtime.lastError):t.resolve(e)}),t.promise},t.deviceReset=function(){var e={direction:"out",recipient:"device",requestType:"vendor",request:0,value:0,index:0,data:new Uint8Array(0).buffer};return t.deviceControlTransfer(e).then(t.wireDetectShort).then(function(e){if(e)throw new Error("Reset Failed: Short Detected")})};var w=function(e){var r=new Uint8Array(e),t={};return t.SPUE=1&r[0],t.SPCE=r[0]>>3&1,t.Speed=r[1],t.PullupDuration=r[2],t.PulldownSlewRate=r[4],t.WriteLowTime=r[5],t.DataSampleOffset=r[6],t.SPUA=1&r[8],t.PMOD=r[8]>>3&1,t.HALT=r[8]>>4&1,t.IDLE=r[8]>>5&1,t.EP0F=r[8]>>7&1,t.CommCommand1=r[9],t.CommCommand2=r[10],t.CommCommandBufferStatus=r[11],t.DataOutBufferStatus=r[12],t.DataInBufferStatus=r[13],r[16]&&(t.ResultRegisters={},t.ResultRegisters.DetectKey=165===r[16],r[17]&&165!==r[17]&&(t.ResultRegisters.EOS=r[17]>>7&1,t.ResultRegisters.RDP=r[17]>>6&1,t.ResultRegisters.CRC=r[17]>>5&1,t.ResultRegisters.CMP=r[17]>>4&1,t.ResultRegisters.APP=r[17]>>2&1,t.ResultRegisters.SH=r[17]>>1&1,t.ResultRegisters.NRS=1&r[17]),t.ResultRegisters.Data=r.slice(16,r.length)),t};t.deviceGetStatus=function(){var e={direction:v.interrupt.direction,endpoint:v.interrupt.address,length:32};return t.deviceBulkTransfer(e).then(function(e){return w(e.data)})},t.wireDetectShort=function(){return t.deviceGetStatus().then(function(e){return 0!==e.CommCommandBufferStatus?!0:e.ResultRegisters&&!e.ResultRegisters.DetectKey&&e.ResultRegisters.Data[0]&!0?!0:!1})},t.wireSetSpeed=function(e){var r=e?2:1,n={direction:"out",recipient:"device",requestType:"vendor",request:2,value:2,index:r,data:new Uint8Array(0).buffer};return t.deviceControlTransfer(n)},t.wireReset=function(){var r={direction:"out",recipient:"device",requestType:"vendor",request:1,value:3147,index:1,data:new Uint8Array(0).buffer};return t.deviceControlTransfer(r).then(function(){var r=e.defer();return setTimeout(function(){t.wireDetectShort().then(function(e){e?r.reject():r.resolve()})},5),r.promise}).fail(function(){return t.deviceReset()}).fail(function(){throw new Error("Reset Failed: Unrecoverable short detected")})},t.wireWrite=function(e){var r={direction:v.bulkOut.direction,endpoint:v.bulkOut.address,data:new Uint8Array(e).buffer},n={direction:"out",recipient:"device",requestType:"vendor",request:1,value:4213,index:e.length,data:new Uint8Array(0).buffer,timeout:i};return t.deviceBulkTransfer(r).then(function(){return t.deviceControlTransfer(n)})},t.wireWriteBit=function(e){var r={direction:"out",recipient:"device",requestType:"vendor",request:1,value:545|e<<3,index:0,data:new Uint8Array(0).buffer};return t.deviceControlTransfer(r)},t.wireRead=function(e){var r={direction:v.bulkIn.direction,endpoint:v.bulkIn.address,length:e};return t.deviceBulkTransfer(r).then(function(e){return new Uint8Array(e.data)})},t.wireReadBit=function(){var e={direction:"out",recipient:"device",requestType:"vendor",request:1,value:41,index:0,data:new Uint8Array(0).buffer};return t.deviceControlTransfer(e).then(function(e){return t.wireRead(1)}).then(function(e){return e[0]})},t.wireClearByte=function(){return t.wireRead(1)},t.keyRomCommand=function(e,r,n){var i,n=n||!1,o={direction:v.bulkOut.direction,endpoint:v.bulkOut.address,data:new Uint8Array(8).buffer};e?(o.data=new Uint8Array(r).buffer,i=n?105:85):i=n?60:204;var c={direction:"out",recipient:"device",requestType:"vendor",request:1,value:101,index:i,data:new Uint8Array(0).buffer};return t.deviceControlTransfer(c).then(function(){return u=n,t.wireSetSpeed(n)}).then(function(){return t.deviceBulkTransfer(o)})},t.keyRomMatch=function(e){return t.keyRomCommand(!0,e,!1)},t.keyRomMatchOverdrive=function(e){return t.keyRomCommand(!0,e,!0)},t.keyRomSkip=function(){return t.keyRomCommand(!1,null,!1)},t.keyRomSkipOverdrive=function(){return t.keyRomCommand(!1,null,!0)};var R={lastDiscrepancy:0,lastDevice:!1,keys:[]},k=function(r){var t=e.defer();return B(r).then(function(e){if(R=e,e.keys&&e.keys[0]){var r=e.keys[0];r.toHexString=function(){return U(this)},t.resolve(r)}else t.reject()}),t.promise};t.keySearchFirst=function(){var e={lastDiscrepancy:0,lastDevice:!1,keys:[]};return k(e)},t.keySearchNext=function(e){return k(R)};var B=function(e){var r={idBitNumber:1,lastZero:0,romByteNumber:0,romByteMask:1,searchResult:!1,idBit:0,cmpIdBit:0,searchDirection:0,romId:new Uint8Array(8),lastDevice:!1,lastDiscrepancy:e.lastDiscrepancy};return t.wireSetSpeed(!1).then(t.wireReset).then(function(){return t.wireWrite(new Uint8Array([240]))}).then(t.wireClearByte).then(function(){return D(r)}).then(function(r){return r.searchResult&&e.keys.push(r.romId),e.lastDiscrepancy=r.searchResultObject,e.lastDevice=r.lastDevice,e})},D=function(e){return t.wireReadBit().then(function(r){e.idBit=r}).then(function(){return t.wireReadBit()}).then(function(r){return e.cmpIdBit=r,1!==e.idBit||1!==e.cmpIdBit?(e.idBit!=e.cmpIdBit?e.searchDirection=e.idBit:(e.idBitNumber<e.lastDiscrepancy?e.searchDirection=(e.romId[e.romByteNumber]&e.romByteMask)>0?1:0:e.searchDirection=e.idBitNumber==e.lastDiscrepancy?1:0,0===e.searchDirection&&(e.lastZero=e.idBitNumber)),1===e.searchDirection?e.romId[e.romByteNumber]|=e.romByteMask:e.romId[e.romByteNumber]&=~e.romByteMask,t.wireWriteBit(e.searchDirection).then(function(){return e.idBitNumber++,e.romByteMask<<=1,e.romByteMask>=256&&(e.romByteNumber++,e.romByteMask=1),e.romByteNumber<8?D(e):(e.idBitNumber>=65&&0===n(e.romId)&&(e.lastDiscrepancy=e.lastZero,0===e.lastDiscrepancy&&(e.lastDevice=!0),e.searchResult=!0),(e.searchResult===!1||0===e.romId[0])&&(e.lastDiscrepancy=0,e.lastDevice=!1,e.searchResult=!1),e)})):e})};t.keyReadAll=function(e,r){return t.wireSetSpeed(!1).then(t.wireReset).then(function(){return r?t.keyRomMatchOverdrive(e):t.keyRomMatch(e)}).then(function(){var e=new Uint8Array([240,0,0]);return t.wireWrite(e)}).then(t.wireClearByte).then(t.wireClearByte).then(t.wireClearByte).then(function(){return b()})};var b=function(e,r){var r=r||0,e=e||new Array(256);e[r]=new Uint8Array(32);for(var n=new Uint8Array(32),i=0;i<n.length;i++)n[i]=255;return t.wireWrite(n).then(function(){return C(e[r])}).then(function(){return r<e.length-1?b(e,r+1):e})},C=function(e,r){var r=r||0;return t.wireRead(16).then(function(t){return t.forEach(function(t){e[r++]=t}),r<e.length?C(e,r):void 0})};t.keyWrite=function(e,r,n,i){var r=r||0,u=255&r,o=(65280&r)>>8,c=n.length-1,n=n||new Uint8Array(0);return t.wireSetSpeed(!1).then(function(){return g(e,r,n,i)}).then(t.wireReset).then(function(){return i?t.keyRomMatchOverdrive(e):t.keyRomMatch(e)}).then(function(){var e=new Uint8Array([85,u,o,c]);return t.wireWrite(e)}).then(t.wireClearByte).then(t.wireClearByte).then(t.wireClearByte).then(t.wireClearByte)};var g=function(e,r,n,i){var u,r=r||0,o=255&r,c=(65280&r)>>8,n=(n.length-1,n||new Uint8Array(0));return t.wireReset().then(function(){return i?t.keyRomMatchOverdrive(e):t.keyRomMatch(e)}).then(function(){var e=new Uint8Array([15,o,c]);return t.wireWrite(e)}).then(t.wireClearByte).then(t.wireClearByte).then(t.wireClearByte).then(function(){return A(n,0)}).then(t.wireReset).then(function(){return i?t.keyRomMatchOverdrive(e):t.keyRomMatch(e)}).then(function(){var e=new Uint8Array([170]);return t.wireWrite(e)}).then(function(){return t.wireRead(n.length)}).then(function(e){u=e}).then(t.wireClearByte).then(function(){return u.length==n.length&&u.every(function(e,r){return e===n[r]})?void 0:g(e,r,n,i)})},A=function(e,r){for(var n=e.length-r>16?16:e.length-r,i=new Uint8Array(n),u=0;n>u;u++)i[u]=e[r+u];return t.wireWrite(i).then(function(){return e.length-(r+n)>0?A(e,r+n):void 0})};t.keyWriteAll=function(e,r,t){return S(e,r,0,t)};var S=function(e,r,n,i){var u=32*n;return t.keyWrite(e,u,r[n],i).then(function(){return r.length>n+1?S(e,r,n+1,i):void 0})};t.keyWriteDiff=function(e,r,n,i){return(n||new Array(0)).length<r.length?t.keyReadAll(e,i).then(function(t){return T(e,r,t,0,i)}):T(e,r,n,0,i)};var T=function(e,r,n,i,u){var o=32*i;return r[i].length===n[i].length&&r[i].every(function(e,r){return e===n[i][r]})&&r.length>i+1?T(e,r,n,i+1,u):t.keyWrite(e,o,r[i],u).then(function(){return r.length>i+1?T(e,r,n,i+1,u):void 0})},U=function(e){const r=["0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F"];var t="",n=Array.prototype.slice.call(e);return n.reverse().map(function(e){t+=r[e>>4&15]+r[15&e]}),t};return t}();
{
"name" : "1-wire-js",
"version" : "1.1.2",
"version" : "1.1.3",
"description" : "1-Wire USB Interface",

@@ -5,0 +5,0 @@ "main" : "ow.js",

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc