Last Friday, a riot erupted outside an Apple store in Beijing. It was widely reported that the rioters were hopeful shoppers who, having waited for hours in the freezing cold for the latest iPhone, were so furious when the launch was delayed that they threw eggs at the shop and clashed with the police. It turns out that many were actually migrant workers, hired by "scalpers" who intended to sell the gadget, a status symbol, for a higher price on the black market.

Meanwhile, a protest of another kind was just ending in Wuhan, in central China's Hubei province, thanks to the intervention of its mayor. Up to 200 workers from the Microsoft Xbox production line of Foxconn Technology, also a major supplier of Apple, had staged a strike. They were not demanding sleek new gadgets, but simply decent pay in return for making them, and proper compensation if being transferred. To drive their point home, they had threatened to kill themselves by jumping off a building.

In 2010, a total of 18 of their colleagues in the Shenzhen campus of the Taiwan-owned company did attempt suicide; 14 died. Some employees and labour organisations blamed a combination of factors for the workers' deaths: low wages, long working hours – sometimes up to 16 hours a day – and inhuman treatment. Workers at the campus, some claimed, were not even allowed to talk during working hours. Like many other similar factories, Foxconn, the world's largest electronics manufacture, is staffed mostly by nongmin gong (peasant workers) because they are cheap. These migrants often have no friends in the city.

I felt the pain of my fellow workers because I, too, slaved for 10 years at a factory and endured its strict rules. The restrictions at my state-owned factory, however, paled in comparison to those of cold-hearted capitalism. There is labour law that forbids a 16-hour working day, among other malpractices, but it is not forcefully implemented by the local authority. After all, the private or foreign-invested enterprises bring revenues.

I was very pleased to see the migrant workers beginning to resist. Shortly after Foxconn's suicides, workers from several Japanese-owned Honda factories revolted. They went on strike until their demands for better pay and working conditions were met. In chatrooms on the internet, several Honda workers argued that it would be better to put up a fight than to take one's life. Compared with their fathers, the young workers are savvy about the internet, better educated, more worldly and far more aware of the law and their rights.

Zhao Fengsheng, who has made a personal journey from a village boy in Hunan to a public intellectual in Beijing, is one of this new breed. When the 35-year-old left home to work in a nearby city, he first experienced discrimination against nongmin. He came to the conclusion that the problem is rooted in the system that separates nongmin from their urban cousins and deprives them of equal rights.

In 2007, after Zhao moved to Beijing, he started to attend lectures and made friends with academics and rights activists. Two years later, he launched the China Farmers' Association. Three days after he filed his application with the ministry of civil affairs, he was arrested, interrogated and his application was rejected. His organisation, now called a research centre, continues to send out articles to people on his mailing list. The list has grown from a few dozen to 500, the maximum on his email server.

"Generally, people become more rights conscious as the society progresses," Zhao said to me. "And nongmin are no exception." He is one of the rare voices representing the underprivileged farmers.

This year, there has been a wave of factory revolts across six provinces in China, according to Hong Kong-based China Workers' Info. In Sichuan province, hundreds of workers stormed a courthouse in Shuangliu county as they were fighting for a case over unpaid wages. The labour unrest has been caused partly by rising inflation, which hit those at the bottom of society the hardest. With the traditional Chinese new year approaching, the migrant workers find it particularly difficult to cope with their daily grind.

Many protests were inspired by the Wukan incident. The village in southern China's Guangdong province grabbed headlines around the world after hundreds of its villagers staged well-organised protests to express their anger against the corrupt local officials and land seizure, and the conflicts escalated in the wake of an attempted crackdown by the local authority. The intensive standoff ended in late December, when top provincial leaders agreed to some of their demands.

I was relieved and delighted by the approach the authorities have taken in both the Wukan and Wuhan cases: they have clearly recognised nongmin's rising demands for rights and equality. But a soft approach alone isn't enough. I hope China's leaders will really listen to the farmers, opening up more channels for them to express their grievances, and allowing some kind of independent labour union or at least a collective bargaining mechanism to ease the conflicts. And ultimately, they'll have to grant the same rights to those who make gadgets such as the Xbox and iPhone as those who use them.

• Follow Comment is free on Twitter @commentisfree