Ventto / pearlfan

GNU/Linux kernel driver and libusb app for a Pearl's USB LED fan

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Unable to get working on Ubuntu 14.04

gordonjct opened this issue · comments

Have installed dependencies, libusb...-dev, and libnetpbm...-dev and did build, ran make. Both the pearlfan and pearltest compile. When run pearlfan or pearltest as user, with sudo or as root get:
Device can not be opened or found.
You may need permission.

In logs note:
[ 1797.644044] usb 7-1: new low-speed USB device number 4 using uhci_hcd
[ 1797.816820] usb 7-1: New USB device found, idVendor=0c45, idProduct=7160
[ 1797.816828] usb 7-1: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[ 1797.816832] usb 7-1: Product: XY LED FAN
[ 1797.816837] usb 7-1: Manufacturer: XY-SUN
[ 1797.833926] input: XY-SUN XY LED FAN as /devices/pci0000:00/0000:00:1d.1/usb7/7-1/7-1:1.0/0003:0C45:7160.000C/input/input21
[ 1797.834241] hid-generic 0003:0C45:7160.000C: input,hidraw7: USB HID v1.00 Device [XY-SUN XY LED FAN ] on usb-0000:00:1d.1-1/input0

So device is found when plugged in.

Please help

I have this same issue but guessing this means this program is maybe for a different device? Is there a way we can specify the /dev device on the command line maybe?

Okay having looked into it this is for a device by the same manufacturer but is a different device. See defutils.h where 0x7701 is the PID of the intended device and we have the 0x7160 device :) I tried changing it but I get:

Transfer error (libusberr = -7) so guessing the protocol is probably slightly different?

Which means LIBUSB_ERROR_TIMEOUT = -7 according to docs.... hmmm

from http://libusb.sourceforge.net/api-1.0/group__syncio.html

int libusb_control_transfer | ( | libusb_device_handle * | dev_handle,
-- | -- | -- | --
  |   | uint8_t | bmRequestType,
  |   | uint8_t | bRequest,
  |   | uint16_t | wValue,
  |   | uint16_t | wIndex,
  |   | unsigned char * | data,
  |   | uint16_t | wLength,
  |   | unsigned int | timeout
  | ) |  

These are the parameters we need to figure out if we are going to get it working :)

Trying to make my own fork here (when I find time) if you want to help out :) https://github.com/jay-to-the-dee/pearlfan

Thank you after posting my thought was that this is a different model/manufacturer. The device is not with me currently will be able to retrieve in early June. Could see if can get another one prior to then and keep you posted. The above parameters are you saying we would have to figure out by trial and error or would that be possible from log messages?

My brand of fan is Maplin but also the Brookstone LED fan looks exactly the same. Care to share your brand for others info? And one can sniff the values from a Windows PC/ VM by monitoring the USB connections and reversing the protocol. Pretty sure it'll be nearly exactly the same as the protocol @Ventto has already figured out for us with just a few minor modifications :)

Happy too, what I have today is the as shown at start of this thread. The logging message from plugging into an Ubuntu 14.04 system. As mentioned the device is not with me at present it will be beginning of June at earliest before able to get hands on.

Will see if can get another one if possible, and extract as much as can from that. FYI currently have access to either Mac OS-x current version or Ubuntu 16.04. So if I get one that is what will use to get information.

All 0c45:7160 devices will show as "XY LED FAN" which is pretty generic and unhelpful by itself as that is unlikely to be listed anywhere on the product description :) Do you remember the store you got it from and which part of the world it was from as these products seem to get branded with a retailer's branding? And that'll change depending on location so UK: Maplin (but they won't be around for much longer 😢), USA: Brookstone and that's all I know so far (probably some knocking around on eBay too I would imagine). It'll help other developers obtain such a device and know it should be the same 0c45:7160 chipset :)

I'll see what can do this weekend. The fan was a gift to my son and I at Christmas. It was bought in Australia, in Melbourne as far as I know and at a guess probably at a local market. Where more than a few stalls are managed by Chinese people that bring things in from Hong Kong and China :)

Packaging will ask my son to retrieve and send picture to me to share. If I can, this weekend, will go in search of another one.

Ok have procured another fan, the same make/model. Was through a local company called Jaycar. Running @Ventto version of pearltest with permission (sudo) on Ubuntu 16.04 I get:
Device can not be opened or found.
You may need permission.
Your modified code pearltest with permission (sudo) on same get:
Device found.
Transfer is starting.
Transfer aborted.
Transfer error (libusberr = -7)

( -7 / 2560 bytes)

Transfer is complete.

( -7 / 2560 bytes)

So that looks promising, running pearlfan to load images or the example config file gets, new code:
Displays:
pfan: EOF / read error

@Ventto code gets
Device can not be opened or found.
You may need permission.

Have pictures of the box and instructions to share. Maybe alternate means to share?

What do I need to run on Ubuntu to extract more information.

Using lsusb I can extract this
$ sudo lsusb -D /dev/bus/usb/002/006
Device: ID 0c45:7160 Microdia
Device Descriptor:
bLength 18
bDescriptorType 1
bcdUSB 1.10
bDeviceClass 0 (Defined at Interface level)
bDeviceSubClass 0
bDeviceProtocol 0
bMaxPacketSize0 8
idVendor 0x0c45 Microdia
idProduct 0x7160
bcdDevice 1.03
iManufacturer 1 XY-SUN
iProduct 2 XY LED FAN 翿
iSerial 0
bNumConfigurations 1
Configuration Descriptor:
bLength 9
bDescriptorType 2
wTotalLength 34
bNumInterfaces 1
bConfigurationValue 1
iConfiguration 0
bmAttributes 0xa0
(Bus Powered)
Remote Wakeup
MaxPower 100mA
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 0
bAlternateSetting 0
bNumEndpoints 1
bInterfaceClass 3 Human Interface Device
bInterfaceSubClass 0 No Subclass
bInterfaceProtocol 0 None
iInterface 0
HID Device Descriptor:
bLength 9
bDescriptorType 33
bcdHID 1.00
bCountryCode 0 Not supported
bNumDescriptors 1
bDescriptorType 34 Report
wDescriptorLength 31
Report Descriptors:
** UNAVAILABLE **
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x81 EP 1 IN
bmAttributes 3
Transfer Type Interrupt
Synch Type None
Usage Type Data
wMaxPacketSize 0x0008 1x 8 bytes
bInterval 10
Device Status: 0x0000
(Bus Powered)

I have an 0c45:7160 and this is capable of multiple colours. From the video embedded in the README.md it seems the I can see for the original 0c45:7701 is single colour? If this is the case then perhaps the protocol needs to encode the colour as well as the image?

I've got the supplied software working in a Windows virtual machine so I can probably capture the USB exchange...

You maybe onto something, do have the Windows software no copy to run on. Let me know how you go.

commented

Any news on this? I have the same device ID "0c45:7160 Microdia XY LED FAN" and got the same error message.

Yeah that fan with we have is UF-211-06RGB (reported by the FAN editor and the packaging of the fan).
It's a XY LED FAN (appearently it sends a malformed packet and is not a "USB Device", lol) by XY SUN (according to wireshark capture).
It's a fan with 11 LED's that can display six colours (red, green, blue, yellow magenta, cyan and white) but sadly not independently (at least not via existing fan editor software).

I brought together infos about different fan editors, messed a little bit with the LDAT format and made a few captures with Wireshark:
USB-Fan.tar.gz

The fan Ventto wrote his pearlfan software for is a "USB Device" by SONiX.

@schrmh makes more sense now, sounds like buy a SONiX as it behaves as USB !!

The following project supports this RGB fan:

https://pypi.org/project/microwave-usbfan/

@harbaum
Thanks a bunch for that finding.
I looked at the slides that the guy behind that project uploaded (https://github.com/fergofrog/microwave_usb_fan/blob/master/doc/csides_presentation.pdf).
Kinda a bummer that the fan actually needs to be modded to change the message on-the-fly. Dunno what that bipolar junction transistor (BJT) does and if that would be enough. Would also be interesting to know what µC is there since I can't see one on his pictures.
What I find interesting is that there are at least two different model numbers on the two pcb. While the (main) PCB with the button has a V1.0 and the number UF-211-076RGB printed on it — which brings up like zero useful search results; while e.g. UF-211-06RGB would bring up a bunch for different fans but many of them are for RGB fans — the other PCB has a V1.3 (and some word like "MOTOR" before it? M is not readable) and the number UF-211-07D.
When searching for UF-211-07D I found a bunch of results for different fans. Most often a LED clock fan. I guess this means that the head PCB can be swapped between fans even tho the model of the main pcb doesn't match. I also found a image with a bunch of LED fans and their model numbers: https://sc01.alicdn.com/kf/HTB1qDF5KFXXXXayXpXXq6xXFXXXg/3969222/HTB1qDF5KFXXXXayXpXXq6xXFXXXg.jpg there are now more fans than that — e.g. there is a variant of the clock one with a temperature sensor which has the model UF-211-0507 according to the aliexpress shop; which is basically the blue temperature sensor led fans model number UF-211-05 appended with the 07 from the clock one but without the D, lol — but this should give a nice small overview. Dunno what's up with that UF-211-076RGB tho. I wonder whether he had that model number on the packaging or also UF-211-06RGB like we do.
Also what would be interesting now would be whether we could take e.g. one clock with temperature sensor RGB fan and could add the reprogramming functionality of our RGB fan to it.

Ah btw. while writing that message I stumpled upon more catalog shop from that aliexpress shop and some of them even mention Patents which might be worth to look up: https://sc01.alicdn.com/kf/HTB1jpYmKXXXXXXFXpXXq6xXFXXXb/3969222/HTB1jpYmKXXXXXXFXpXXq6xXFXXXb.jpg_.webp
Also for bluetooth fans but they might be very different: https://sc01.alicdn.com/kf/HTB1gJuWKXXXXXbKXVXXq6xXFXXXn/3969222/HTB1gJuWKXXXXXbKXVXXq6xXFXXXn.jpg_.webp
Interesting is that UF-240-05&07 support clock, temperature and custom message at the same time.

Patent numbers I found while looking at their stuff followed by model number in brackets:
ZL 2014 2 0518599.3 [UF-211-06RGB];
ZL 2014 2 0113701.1 [UF-204-06(RGB-Version)];
ZL 2011 3 0505794.4 [UF-211-06] (on the shop page for the RGB variant there is also that picture for an older non-RGB variant https://sc01.alicdn.com/kf/HTB1oX.bKXXXXXXrXVXXq6xXFXXXu/3969222/HTB1oX.bKXXXXXXrXVXXq6xXFXXXu.jpg_.webp)
ZL201220602850.5 [I think UF-240-07; it's listed on the shop page for the UF-240-05&07 tho]

But I can't just enter those at the chinese patent search http://epub.cnipa.gov.cn. There is a guide https://www.epo.org/searching-for-patents/helpful-resources/asian/china/search.html but well yeah.. Maybe somebody has more luck.

Where does the information about e.g. the mod for on-the-fly changes come from?

@harbaum page 7 counted from the end there is a slide about drawbacks.

Ah thanks. The PDF preview 'in github was incomplete ... I didn't realize that.

The following project supports this RGB fan:

https://pypi.org/project/microwave-usbfan/

I can confirm that this works with the fan that identifies as

0c45:7160 Microdia XY LED FAN

And that you have to press the button off to upload the new programme.