# DeviceSourceManager issue with the touch input on iPad

**URL:** <https://forum.babylonjs.com/t/devicesourcemanager-issue-with-the-touch-input-on-ipad/19612>\
**Category:** Bugs\
**Tags:** input\
**Created:** [March 31, 2021, 10:23pm UTC](https://forum.babylonjs.com/t/devicesourcemanager-issue-with-the-touch-input-on-ipad/19612 "2021-03-31T22:23:50Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![reb-ic](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/reb-ic/32/18481_2.png) [@reb-ic](https://forum.babylonjs.com/u/reb-ic)\
**Post date:** [March 31, 2021, 10:23pm UTC](https://forum.babylonjs.com/t/devicesourcemanager-issue-with-the-touch-input-on-ipad/19612/1 "2021-03-31T22:23:50Z")

</div>

Hi, i’m try to use the class DeviceSourceManager for managing the user inputs but i have problem with the touch input on iPad whit Safari, the device connection is detected but when i use the getDeviceSource method for get the device it return ever null.  
I have try the code on Android whit Chrome and it work.

My code is like that:

```auto
let dsm = new BABYLON.DeviceSourceManager(scene.getEngine());

dsm.onDeviceConnectedObservable.add(function(device){
 	console.log("Connected device type: " + device.deviceType); //Log type 3    	
 });

scene.registerBeforeRender(function() {
    let touch = dsm.getDeviceSource(BABYLON.DeviceType.Touch);
    console.log(touch); //Log null        
 });

```

I have used: Babylon v4.2.0, PEP v0.4.3, Safari on iPadOS 14.  
Thanks for help.

---

<div class="post-metadata">

**Author:** ![Deltakosh](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/deltakosh/32/26635_2.png) [@Deltakosh](https://forum.babylonjs.com/u/Deltakosh)\
**Post date:** [March 31, 2021, 11:56pm UTC](https://forum.babylonjs.com/t/devicesourcemanager-issue-with-the-touch-input-on-ipad/19612/2 "2021-03-31T23:56:30Z")

</div>

Adding @PolygonalSun

---

<div class="post-metadata">

**Author:** ![bghgary](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/bghgary/32/48532_2.png) [@bghgary](https://forum.babylonjs.com/u/bghgary)\
**Post date:** [April 1, 2021, 8:02pm UTC](https://forum.babylonjs.com/t/devicesourcemanager-issue-with-the-touch-input-on-ipad/19612/3 "2021-04-01T20:02:41Z")

</div>



---

<div class="post-metadata">

**Author:** ![PolygonalSun](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/polygonalsun/32/2704_2.png) [@PolygonalSun](https://forum.babylonjs.com/u/PolygonalSun)\
**Post date:** [April 1, 2021, 10:00pm UTC](https://forum.babylonjs.com/t/devicesourcemanager-issue-with-the-touch-input-on-ipad/19612/4 "2021-04-01T22:00:59Z")

</div>

Lemme take a look and see what’s going on

---

<div class="post-metadata">

**Author:** ![PolygonalSun](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/polygonalsun/32/2704_2.png) [@PolygonalSun](https://forum.babylonjs.com/u/PolygonalSun)\
**Post date:** [June 22, 2021, 10:45pm UTC](https://forum.babylonjs.com/t/devicesourcemanager-issue-with-the-touch-input-on-ipad/19612/5 "2021-06-22T22:45:56Z")

</div>

Sorry about the delay on this. The issue appears to be how the iPad/Safari is storing pointerIds and how the DeviceSourceManager searches for the first touch. Safari will put in large negative values for the pointer Id and the DSM starts by searching based off of positive ids (how every other browser works). I am working on a fix for this right now.

---

<div class="post-metadata">

**Author:** ![PolygonalSun](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/polygonalsun/32/2704_2.png) [@PolygonalSun](https://forum.babylonjs.com/u/PolygonalSun)\
**Post date:** [June 23, 2021, 12:14am UTC](https://forum.babylonjs.com/t/devicesourcemanager-issue-with-the-touch-input-on-ipad/19612/6 "2021-06-23T00:14:02Z")

</div>

Fix is in PR: [DeviceSourceManager - Fix touch on iOS by PolygonalSun · Pull Request #10552 · BabylonJS/Babylon.js (github.com)](https://github.com/BabylonJS/Babylon.js/pull/10552)

---

<div class="post-metadata">

**Author:** ![sebavan](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/sebavan/32/57_2.png) [@sebavan](https://forum.babylonjs.com/u/sebavan)\
**Post date:** [June 23, 2021, 2:44pm UTC](https://forum.babylonjs.com/t/devicesourcemanager-issue-with-the-touch-input-on-ipad/19612/7 "2021-06-23T14:44:42Z")

</div>

Will be in the next nightly later today.

---

<div class="post-metadata">

**Author:** ![sebavan](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/sebavan/32/57_2.png) [@sebavan](https://forum.babylonjs.com/u/sebavan)\
**Post date:** [June 23, 2021, 2:44pm UTC](https://forum.babylonjs.com/t/devicesourcemanager-issue-with-the-touch-input-on-ipad/19612/8 "2021-06-23T14:44:59Z")

</div>



---

<div class="post-metadata">

**Author:** ![PolygonalSun](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/polygonalsun/32/2704_2.png) [@PolygonalSun](https://forum.babylonjs.com/u/PolygonalSun)\
**Post date:** [June 23, 2021, 10:17pm UTC](https://forum.babylonjs.com/t/devicesourcemanager-issue-with-the-touch-input-on-ipad/19612/9 "2021-06-23T22:17:36Z")

</div>

PR is merged

---

<div class="post-metadata">

**Author:** ![reb-ic](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/reb-ic/32/18481_2.png) [@reb-ic](https://forum.babylonjs.com/u/reb-ic)\
**Post date:** [July 7, 2021, 10:29am UTC](https://forum.babylonjs.com/t/devicesourcemanager-issue-with-the-touch-input-on-ipad/19612/10 "2021-07-07T10:29:49Z")

</div>

Hi @PolygonalSun , thank you very much for the fix, i will retry again to use DeviceSourceManager class on Apple devices.
