Hello Guest, Welcome to Apnea Board !
As a guest, you are limited to certain areas of the board and there are some features you can't use.
To post a message, you must create a free account using a valid email address.

or Create an Account


New Posts   Today's Posts

Oximetry - Do any of the pulse oximeters work with linux?
#21
(09-21-2015, 06:19 PM)archangle Wrote: SleepyHead also runs pretty well under Wine. I'm not sure whether it will be able to access the oximeter, though. Accessing hardware is a little more difficult than simply running the program.

I did ask almost that exact question of a wine evangelist / expert, and he said that emulating serial RS-232 interfaces over USB was in fact the one exception to the poor hardware interface support in wine. So I think it's worth trying. I'm not sure I have wine setup correctly on my debian system or I'd try it myself now. I understand wine can't run off a dual booted Windows system partition anymore; requiring a separate Windows install. Has anyone tried this or have the necessary oximeter, wine setup, and SleepyHead on Linux to run this test?
Post Reply Post Reply
#22
(12-03-2015, 12:38 PM)GregLawson Wrote: If I manually enterred the cpap session start time the SPO2 and pulse graphs were aligned closely.
I think the short term solution to the time-alignment problem (see start page of SH oxymetry wizard) is to use the SH oximeter import wizard button to "Record attached to computer overnight (provides plethysomogram)". Anyone tried this and tried to assess the correlation of CPAP apneas with SPO2 desaturations and possibly pulse accelerations? If not I have yet another new project:
  1. Move a Windows computer into my bedroom.
  2. Record a night with CPAP and oximeter.
  3. Automatically? align data in SH.
  4. Export aligned data to a csv file.
  5. Import data into my favorite statistical analysis program (open source R anyone?)
  6. Somehow statistically correlate CPAP apnea scoring with SPO2 desaturation scoring.
  7. Hopefully feel relatively confident that SPO2 desaturation is the unambiguous metric of success for CPAP treatment.
Post Reply Post Reply
#23
GregLawson,
FYI:
  1. CMS-50D+ oximeters don't have on-board clock and any recorded data must be synced manually with any CPAP's session data.
  2. The CMS-50"F" and "I" models have an on-board clock.
  3. The Philips-Respironics system's clock is set at the factory to UTC and doesn't allow for drift or time zone change on the system.
  4. Resmed CPAP systems have on-board clocks and allow for the setting to the current time.
  5. However with all clocks, drift can and does occur. Sleepyhead allows the user to use either the recorded time on the oximeter (if available) or the user can choose to align the data with a CPAP session.
  6. Sleepyhead has the ability to correct any clock drift and/or time zone in the File->Preferences->CPAP->CPAP Clock Drift option.

I hope you may find this information useful.
Post Reply Post Reply


#24
OK, I think I know part of the problem. The driver in my kernel, cp210x.c does not have ioctl, or gpio in it. The file in question is found in /usr/src/linux-source-4.2.0/linux-source-4.2.0.tar.bz2
linux-source-4.2.0/drivers/usb/serial/cp210x.c

The driver file hosted on the Silicon Labs website does. However the driver at SiLabs is for an earlier kernel. Although it does not seem to be written up very well, or even in one place, I gleaned that they expect you (me) to combine the gpio functions of their file into the one provided by your (my) distribution. This is, shall we say, slightly out of my expertise.

So it seems one needs to merge the gpio of the SiLabs version into the "current driver" of one's kernel. For the life of me, I don't understand why this was not included in the kernel. Maybe a security issue?

I'd be a bit more gung ho about this, if the SiLabs cp210x.c file compiled on my system. There seems to be a build failure. I'm not a good C programmer, so this is slowing me down. If I could figure this out, maybe I can get the CMS50F to work on my system.
Post Reply Post Reply
#25
(12-04-2015, 09:34 PM)happydreams Wrote: So it seems one needs to merge the gpio of the SiLabs version into the "current driver" of one's kernel. For the life of me, I don't understand why this was not included in the kernel. Maybe a security issue?

I'd be a bit more gung ho about this, if the SiLabs cp210x.c file compiled on my system. There seems to be a build failure.
Yikes. Your news is annoying enough that I'll try denial to see if it goes away. If it won't go away, we'll have to dig into it as you suggest. So I'll pursue some of the parallel paths mentioned in previous posts to try and disprove that the problem is in the driver.
I might try something like setting up a square wave into one of my cheap Chinese serial to USB (hopefully one presents itself as a cp210x clone). If I sound like a mad scientist, don't worry: I've successfully done something like this before: square waves into a Bus Pirate (cheapy serial bus analyzer). If the predicted characters can be read from /dev/ttyUSB0, its strong evidence the cp210x driver is working "good enough"; if not then I'll have to dig into the driver as you suggest.
(12-04-2015, 09:34 PM)happydreams Wrote: This is, shall we say, slightly out of my expertise.
Outside my expertise also (notice my reluctance to dive right in). But diving into stuff outside my expertise is how I learn new stuff and maybe stave off cognitive decline (or is that why I'm currently obsessed with oximeters and CPAP?). But since I'm already jumping into dozens of new things, the dread 'analysis paralysis' is closer to my real fear. Hopefully we can find an efficient path to resolving the oximeter for Linux issue.
(12-04-2015, 09:34 PM)happydreams Wrote: I'm not a good C programmer, so this is slowing me down.
Its been forty years since I would call myself much of a C programmer, ten years since I've been much of a C++ programmer, and a few days since I've been much of a Ruby programmer. But since majoring in programming language design at UCLA, I've learned to deny the importance of programming languages as a barrier to problem solving. (Note I've been in denial twice in a single post, I must have a defective brain.)
Post Reply Post Reply
#26
I pulled the data sheets for the SilconLabs chips last night. It turns out that the CP2101, 02, 03, and 04 all return the same USB vid and pid, even though only the 2103 and 2104 have the GPIO pins in addition to the usual serial control lines. Only the Product Description String is unambiguous. So one of the first questions to ask is which chip is used, and has it changed? So we need people using Linux who have CMS50 devices to try 'sudo lsusb -v -d10C4:' and then report the resulting iProduct string. Then we can decide if we need a custom driver and/or modifications to the Sleepyhead code. Since I will shortly (I hope) have a CMS50F, I will be able to undertake whichever is necessary. I expect I have the necessary skills, having recently retired after programming embedded systems in C for most of the past thirty years.
Post Reply Post Reply


#27
Here you go... For a CMS50F V3.8 firmware.

$ sudo lsusb -v -d10C4:

Bus 001 Device 006: ID 10c4:ea60 Cygnal Integrated Products, Inc. CP210x UART Bridge / myAVR mySmartUSB light
Device Descriptor:
bLength 18
bDescriptorType 1
bcdUSB 1.10
bDeviceClass 0 (Defined at Interface level)
bDeviceSubClass 0
bDeviceProtocol 0
bMaxPacketSize0 64
idVendor 0x10c4 Cygnal Integrated Products, Inc.
idProduct 0xea60 CP210x UART Bridge / myAVR mySmartUSB light
bcdDevice 1.00
iManufacturer 1 Silicon Labs
iProduct 2 CP2102 USB to UART Bridge Controller
iSerial 3 0001
bNumConfigurations 1
Configuration Descriptor:
bLength 9
bDescriptorType 2
wTotalLength 32
bNumInterfaces 1
bConfigurationValue 1
iConfiguration 0
bmAttributes 0x80
(Bus Powered)
MaxPower 100mA
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 0
bAlternateSetting 0
bNumEndpoints 2
bInterfaceClass 255 Vendor Specific Class
bInterfaceSubClass 0
bInterfaceProtocol 0
iInterface 2 CP2102 USB to UART Bridge Controller
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x81 EP 1 IN
bmAttributes 2
Transfer Type Bulk
Synch Type None
Usage Type Data
wMaxPacketSize 0x0040 1x 64 bytes
bInterval 0
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x01 EP 1 OUT
bmAttributes 2
Transfer Type Bulk
Synch Type None
Usage Type Data
wMaxPacketSize 0x0040 1x 64 bytes
bInterval 0
Device Status: 0x0000
(Bus Powered)

Cheers
Post Reply Post Reply
#28
Thank you, HappyDreams. At least the newest CMS50F uses the CP2102 which doesn't have the GPIO pins. So the regular Linux driver should be adequate; no need to merge the Silicon Labs driver code with the kernel driver code. One hopes. Early times still.
Post Reply Post Reply
#29
(12-05-2015, 10:20 AM)pholynyk Wrote: So we need people using Linux who have CMS50 devices to try 'sudo lsusb -v -d10C4:' and then report the resulting iProduct string.
Have mercy on thread readers and use
$ sudo lsusb -v -d10C4:|grep iProduct
iProduct 2 CP2102 USB to UART Bridge Controller
for my Veridian 11-50DP. So my denial of needing GPIO might be working.
(12-05-2015, 10:20 AM)pholynyk Wrote: I pulled the data sheets for the SilconLabs chips last night.
Can you post a link to the data sheets? Others: when you find a nugget of information (especially when Google doesn't return much useful), please post since this Internet thingy is too darned big to find much without links.
If I post quickly, I'm likely to say something stupid, if I wait till I can't say something stupid, I may never post.
If you are reading this I hope that I''ve achieved the right trade-off between signal and noise.
Post Reply Post Reply


#30
(12-05-2015, 04:19 PM)pholynyk Wrote: Thank you, HappyDreams. At least the newest CMS50F uses the CP2102 which doesn't have the GPIO pins. So the regular Linux driver should be adequate; no need to merge the Silicon Labs driver code with the kernel driver code. One hopes. Early times still.
I hope so. I had both source files up in meld, and I'd hesitate to make the changes. There are quite a few differences and I'm not a kernel hacker. I wouldn't know if something was safe to change.

However, if the regular driver is ok, then why doesn't it work? Maybe I just don't understand how to read out the data from the device. I plugged it into my usb port, turned the device on, and went to the menu. I then ran SH. I got to the Ox Wizard and basically clicked go. It that how it is supposed to work? Or do I have to do something else with the cms50f? I mean this could very well be operator error, but there doesn't seem to be very clear instructions - at least for me.

BTW, you should have received the CMS50F by now. It only took 2 days for mine to show up - from the same vendor as you ordered from. I was amazed at how fast I received it.

Post Reply Post Reply


Possibly Related Threads...
Thread Author Replies Views Last Post
  Pulse/Oximeter and Mac Rcgop 0 125 02-03-2017, 10:57 AM
Last Post: Rcgop
  Instructions for using the Contec oximeters Beej 1 150 01-27-2017, 08:11 AM
Last Post: Beej
Idea SleepyHead and Linux MartinT 11 453 12-30-2016, 11:35 AM
Last Post: Crimson Nape
  SleepyHead on iMac with OS X - importing oximetry data Possum 9 1,216 11-04-2016, 12:28 PM
Last Post: AlanE
  PLEASE PLEASE Help me! [Pulse Oximeter issues] Dagswe21 5 445 10-22-2016, 07:42 AM
Last Post: AlanE
  did Linux corrupt my SD card? AirPlease 6 920 09-23-2016, 02:06 AM
Last Post: zagam
  Will most any SD card reader work with ResScan 5.6? caffellatte 3 547 09-22-2016, 09:47 AM
Last Post: caffellatte

Forum Jump:

New Posts   Today's Posts




About Apnea Board

Apnea Board is an educational web site designed to empower Sleep Apnea patients.

For any more information, please use our contact form.