The chairman of the Federal Communications Commission said a deal has been reached between the agency and mobile carriers that will make smartphone unlocking legal.

FCC Chairman Tom Wheeler said the agreement will ensure customers are allowed to unlock their devices as well as receive information from their carriers on how and when they can do so.

Smartphone unlocking allows users to switch the carriers that provide service for their devices. Some carriers like to keep the devices they sell locked to prevent customers from taking their smartphones to their rivals.

The agreement with carriers, which includes AT&T, Sprint, T-Mobile, U.S. Cellular and Verizon, will require them to notify customers when they become eligible to unlock their phones.

Carriers will also be required to have clear and readily available policies about phone unlocking. Companies will be required to unlock eligible devices within two business days of a customer request. And carriers will unlock phones for active deployed members of the military.

Smartphone unlocking has been illegal for nearly a year. It became illegal after a ruling by the Library of Congress late last year.

But after phone unlocking became illegal, users quickly protested the change through an online petition that was signed by more than 114,000 people. After the petition, the White House weighed in on the topic and said phone unlocking should be allowed.