[SOLVED] This device is owned by another user. Change owner to xxxx? (error)

Solution Here (further down)

Original Post:

Hi there. In testing my product, I am setting up wifi and claiming to a test customer. Once I verify functionality I would like to unclaim the device and erase the wifi credentials. Here is what I am doing:

  1. In organization dashboard, click “Unclaim device”
  2. Hold Setup button until fast blue flash to clear wifi.

But now if I go through setup a second time (using the android app (ParticleDeviceSetupLibrary) so that I can simulate what my new customer would see while doing setup, I get the following message after selecting the device in the “Choose your device” screen:

This device is owned by another user. Change owner to xxxx?

Then, if I select “Change Owner”, I get a fail message – unable to change owner – try again. And on the 2nd try it usually succeeds.

So obviously, the unclaim function in the dashboard only makes the device MOSTLY unclaimed. Please note that I have also tested this on a web-based setup (using softAP JS) and the device shows as currently claimed there too (although I can prevent error messages to that effect from being displayed to the user)

Is there a different method I should be using to unclaim each device in preparation to shipping it out to a new customer?

Thanks,
Dan

Hey @dperrigan! If you haven’t already, head over to http://support.particle.io and send us a message. Then we can support you directly and look into what is happening behind the scenes. :slight_smile:

Thanks, Jerry. I did yesterday, and am eagerly awaiting a reply.

Dan

Hi

Any update on this - I would also like to understand any extra steps required fully remove any user links to a device.

No, nothing yet. I’m still stuck in the water.

Dan

I think I’ve figured out how to restore a Photon to something pretty close to a clean from the factory condition. Registering the device on a new account using a phone no longer prompts that the device has already been claimed. Here are the steps. A script would be a wise choice here, but I thought I’d disseminate the information first.

Run this program to reset the antenna, IP configuration, Wi-Fi credentials and EEPROM:

#include "Particle.h"

STARTUP(WiFi.selectAntenna(ANT_INTERNAL));

void setup() {
    EEPROM.clear();

    WiFi.useDynamicIP();
    WiFi.clearCredentials();

    // So you can tell the operations have completed
    pinMode(D7, OUTPUT);
    digitalWrite(D7, HIGH);
}

void loop() {
}

Unclaim the device from your account. You can use the command line, the Particle Build (Web IDE) and presumably product creators have something in their dashboard. Here’s the command line version (insert your device ID):

particle device remove 0123456789ABCDEFGHI

Put the device in DFU mode (blinking yellow) and flash Tinker.

particle flash --usb tinker

Reset server key in case it was changed to a local server:

Download:
https://s3.amazonaws.com/spark-website/cloud_public.der

While still in DFU mode:

particle keys server cloud_public.der

Generate new keys:

particle keys new
particle keys load device.der

The part that I had been missing is clearing the claim code. You need a file that’s 64 bytes long and consists of 0xff bytes, except for the first byte, which is 0x00. Then you flash this to the device in DFU mode:

dfu-util -d 2b04:d006 -a 1 -s 1762:64 -D clear_claim.bin

Be very careful with that command, typing one wrong number can cause massive headaches by corrupting the configuration! By the way, that’s the step that’s necessary to prevent the phone app from saying that the device has already been registered.

Now reset your device and you should be able to claim it with a different user with no warnings. I tested it with both the Android and iOS Particle apps and it seems to work for me.

The files, including clear_claim.bin, are here on github:

I hope this helps!

2 Likes

Wow, @rickkas7. That’s great! I was wondering if there was something related to claiming that was stuck in the Photon’s memory and could be DFU’d out, but couldn’t find it.

Thanks! I’ll give it a shot.

It worked! For my product I actually want to keep the EEPROM set to specific defaults and to ship it with my firmware preloaded. Even with the non-tinker firmware and the non-blank EEPROM, your DFU clear_claim did the trick. The android app didn’t flag the Photon as being previously claimed.

Thanks again,
Dan

1 Like